diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index ef4904c11f..dd9efa0de4 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -96,6 +96,10 @@ export interface NavigationLeafRoute { * they will be defined by the router. */ key: string; + /** + * Index that represents the depth of the stack + */ + index: number; /** * For example 'Home'. * This is used as a key in a route config when creating a navigator. diff --git a/types/react-navigation/react-navigation-tests.tsx b/types/react-navigation/react-navigation-tests.tsx index b59474bd11..9697e61de8 100644 --- a/types/react-navigation/react-navigation-tests.tsx +++ b/types/react-navigation/react-navigation-tests.tsx @@ -6,6 +6,7 @@ import { } from 'react-native'; import { createDrawerNavigator, + createBottomTabNavigator, DrawerNavigatorConfig, NavigationAction, NavigationActions, @@ -451,3 +452,20 @@ class Page2 extends React.Component { return { this.navigatorRef = instance; }} />; } } + +const BottomStack = createBottomTabNavigator({ + Posts: { + screen: Page2, + navigationOptions: ({ navigation }: NavigationScreenProps) => { + let tabBarVisible = true; + + if (navigation.state.index > 0) { + tabBarVisible = false; + } + + return { + tabBarVisible + }; + } + } +});