TabNavigator内的StackNavigator无法更改导航栏颜色

时间:2018-03-30 03:43:34

标签: react-native

我有一个StackNavigator:

const infoNavigator = StackNavigator({
InfoMain: {
    screen: PFInfoMain,
    navigationOptions: {
        title: 'Information',
        tintColor: 'red'
    }
},
InfoDetail: {screen: PFInfoDetail}
});

TabNavigator内部:

iOS:

const iosTabs = TabNavigator({
Info: {
    screen: infoNavigator,
    navigationOptions: {
        tabBarLabel: 'Info',
        tabBarIcon: ({tintColor}) => (
            <Image
                source={require('../assets/home.png')}
                style={[styles.icon, {tintColor: tintColor}]}
            />
        )
    }
}...

机器人:

const androidTabs = TabNavigator(
{
    Info: {screen: infoNavigator} ...

在infoNavigator中使用tintColor:'red'的navigationOptions只是设置导航栏颜色(标题?)的无数尝试失败之一。

没有任何效果。

有人可以帮忙吗?谢谢!

1 个答案:

答案 0 :(得分:0)

假设您正在使用react-navigation

docs中没有提到tintColor这样的内容。

用户headerTintColorheaderStyle

static navigationOptions = ({ navigation, screenProps }) => ({
       headerTintColor: "red",
       headerStyle: {
         backgroundColor:"red"
       }
   });
相关问题