Skip to content

Instantly share code, notes, and snippets.

@hungdev
Created July 14, 2018 18:23
Show Gist options
  • Select an option

  • Save hungdev/8ff13bd3eaa82e0e4b1d5d1a874bfc56 to your computer and use it in GitHub Desktop.

Select an option

Save hungdev/8ff13bd3eaa82e0e4b1d5d1a874bfc56 to your computer and use it in GitHub Desktop.
hide tabbar in stack

I got DrawerNavigator > TabNavigator > StackNavigator. I want to hide the tabBar inside my stack on some screen. How can I do this?

react-navigation/react-navigation#581 https://reactnavigation.org/docs/en/navigation-options-resolution.html#a-tab-navigator-contains-a-stack-and-you-want-to-hide-the-tab-bar-on-specific-screens

const FeedStack = createStackNavigator({
  FeedHome: FeedScreen,
  Details: DetailsScreen,
});

FeedStack.navigationOptions = ({ navigation }) => {
  let tabBarVisible = true;
  if (navigation.state.index > 0) {
    tabBarVisible = false;
  }

  return {
    tabBarVisible,
  };
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment