Skip to content

bakerface/react-navigation-options-from

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-navigation-options-from

Get react-navigation options from nested navigators

Created to help preserve functionality of nested navigators when upgrading to react-navigation v2. See react-navigation #4309 for more details.

import getNavigationOptionsFrom from "react-navigation-options-from";

const tabs = {
  MainTab: {
    screen: MyHomeScreen,
    path: '/',
    navigationOptions: {
      ...
    },
  },
  SettingsTab: {
    screen: MySettingsScreen,
    path: '/settings',
    navigationOptions: {
      ...
    },
  },
};

const TabNav = createBottomTabNavigator(tabs, {
  tabBarPosition: 'bottom',
  animationEnabled: false,
  swipeEnabled: false,
});

// everything above remains unchanged
// this line is added to inherit navigation options
TabNav.navigationOptions = getNavigationOptionsFrom(tabs);

const StacksOverTabs = createStackNavigator({
  Root: {
    screen: TabNav,
  },
});

About

Get react-navigation options from nested navigators

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published