mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-12-03 19:51:53 +00:00
Merge pull request #26307 from iRoachie/react-navigation
[react-navigation] Add index to NavigationLeafRoute
This commit is contained in:
Vendored
+4
@@ -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
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user