在导航中反应本机多色标题

时间:2018-06-21 11:45:09

标签: javascript ios objective-c reactjs react-native

我想实现具有多种颜色标题的导航器,但它只能设置一种颜色

enter image description here

如何设置多种颜色标题?

class Home extends Component {
    render() {
        return (
            <View>
                <StatusBar barStyle="light-content" />
            </View>
        );
    }
}

Home.navigationOptions = {
    title: 'Home',
    headerStyle: {
            backgroundColor: MyConstants.colorNavbar,
    },
    headerTitleStyle: {
        color: 'white',
    },
    headerBackTitleStyle: {
        color: 'white',
    },
    headerTintColor: 'white',
};

export default Home;

2 个答案:

答案 0 :(得分:1)

这很简单,这是代码:

<Text style={{fontWeight: 'bold'}}>
    I am bold
    <Text style={{color: 'red'}}>
        and red
    </Text>
</Text>

这是文档:https://facebook.github.io/react-native/docs/text.html

答案 1 :(得分:0)

请在下面找到运行代码

<Text style={{color: 'red'}}>
    Ho
    <Text style={{color: 'green'}}>
         me
    </Text>
</Text>