我正在使用反应导航来导航屏幕。在这里,我使用了TabBarBotoom和堆栈导航器。
headerRight(右边的标题有3个图标)在stacknavigator内部,因此在导航时会闪烁。任何解决方案。在标题中吗?
版本:
“反应导航”:“ ^ 3.2.3”
“反应”:“ 16.8.1”,
react-native-cli:2.0.1
本机:0.58.4
renderMyHomeHeader = (navigation) => {
let navigationOptions = {
headerStyle: {
backgroundColor: 'black',
borderWidth: 0,
borderBottomWidth: 0,
width: deviceWidth,
height: headerHeight
},
headerLeft: headerTitleNavigationOptions('Home'),
//headerLeft: headerLeftNavigatorOptions(navigation),
headerRight: headerRightNavigatorOptions(navigation) // Here I have many screens
};
navigationOptions: ({ navigation }) => ({
headerStyle: {
backgroundColor: 'black',
borderWidth:0,
borderBottomWidth:0
},
})
if (navigation.state.routeName != 'Home') {
navigationOptions = {
header: null
};
}
return navigationOptions;
}
const BottomTabNavigator = createBottomTabNavigator({
Home: {
screen: createStackNavigator({
HomeScreen: {
screen: HomeScreen
},
User: {
screen: User
},
},
{
defaultNavigationOptions: ({ navigation }) => (
renderMyHomeHeader(navigation)
),
navigationOptions: ({ navigation }) => ({
tabBarVisible: showTabBar(navigation),
tabBarIcon: ({focused}) => (<Image style={{tintColor: focused ? '#C7A985': '#FFFFFF', width: 45, borderColor:'white', height:45, paddingTop:0, resizeMode:'contain'}} source={{uri: 'image'}} />),
//tabBarIconColor: 'white',
tabBarOnPress: ({}) => (navigation.navigate('Home')),
inactiveTintColor:'white'
}),
transitionConfig: () => ({
transitionSpec: {
duration: 0,
timing: Animated.timing,
opacity: 0
},
}),
},
),
},