4

I am using react-navigation to navigate the screens. Here I have used TabBarBotoom and stack navigator.

The headerRight (header right there is 3 icons) is inside the stacknavigator so while navigating it gets flickering. Any solution for this. In header right there?

Version:

"react-navigation": "^3.2.3"

"react": "16.8.1",

react-native-cli: 2.0.1

react-native: 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
          },
        }),
      },
    ),
  },
sejn
  • 2,040
  • 6
  • 28
  • 82

0 Answers0