Skip to content

Feat hideable tabs in TabBar

Compare
Choose a tag to compare
@drash-course drash-course released this 30 Jan 13:29
· 166 commits to feat-hidden-tabs since this release

In this fork of react-navigation (1.0.0-beta.27), tabs created in a TabNavigator can now be hidden from the TabBar by setting the { hiddenTabs: ['MyTab'] } config.

To hide a tab by default, you can write:

const tabNav = TabNavigator({
  FirstTab: { screen: firstScreen },
  SomeTab: { screen: secondScreen },
}, {
  hiddenTabs: ['SomeTab']
});

Hidden tabs can be made visible again by dispatching the showTab action, like so:

this.props.navigation.dispatch(
  NavigationActions.showTab({ tabRouteName: 'SomeTab' })
);

Tabs can also be hidden programatically with the hideTabaction:

this.props.navigation.dispatch(
  NavigationActions.hideTab({ tabRouteName: 'SomeTab' })
);