Merge pull request #26307 from iRoachie/react-navigation

[react-navigation] Add index to NavigationLeafRoute
This commit is contained in:
Armando Aguirre
2018-06-06 13:05:19 -07:00
committed by GitHub
2 changed files with 22 additions and 0 deletions
+4
View File
@@ -96,6 +96,10 @@ export interface NavigationLeafRoute<Params = NavigationParams> {
* 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.
@@ -6,6 +6,7 @@ import {
} from 'react-native';
import {
createDrawerNavigator,
createBottomTabNavigator,
DrawerNavigatorConfig,
NavigationAction,
NavigationActions,
@@ -451,3 +452,20 @@ class Page2 extends React.Component {
return <RootNavigator ref={(instance: NavigationContainerComponent | null): void => { this.navigatorRef = instance; }} />;
}
}
const BottomStack = createBottomTabNavigator({
Posts: {
screen: Page2,
navigationOptions: ({ navigation }: NavigationScreenProps) => {
let tabBarVisible = true;
if (navigation.state.index > 0) {
tabBarVisible = false;
}
return {
tabBarVisible
};
}
}
});