mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-29 01:45:49 +08:00
Fix tabBarOnPress to destructure arguments
This commit is contained in:
4
types/react-navigation/index.d.ts
vendored
4
types/react-navigation/index.d.ts
vendored
@@ -347,10 +347,10 @@ export interface NavigationTabScreenOptions extends NavigationScreenOptions {
|
||||
> | string | null));
|
||||
tabBarVisible?: boolean;
|
||||
tabBarTestIDProps?: { testID?: string, accessibilityLabel?: string };
|
||||
tabBarOnPress?: (
|
||||
tabBarOnPress?: (options: {
|
||||
scene: TabScene,
|
||||
jumpToIndex: (index: number) => void
|
||||
) => void;
|
||||
}) => void;
|
||||
}
|
||||
|
||||
export interface NavigationDrawerScreenOptions extends NavigationScreenOptions {
|
||||
|
||||
@@ -140,7 +140,7 @@ const tabNavigatorScreenOptions: NavigationTabScreenOptions = {
|
||||
tabBarVisible: true,
|
||||
tabBarIcon: <View />,
|
||||
tabBarLabel: 'label',
|
||||
tabBarOnPress: (scene, index) => {}
|
||||
tabBarOnPress: ({scene, jumpToIndex}) => {}
|
||||
};
|
||||
|
||||
const tabNavigatorConfig: TabNavigatorConfig = {
|
||||
@@ -154,6 +154,15 @@ const tabNavigatorConfigWithInitialLayout: TabNavigatorConfig = {
|
||||
initialLayout: { height: 0, width: 100 },
|
||||
};
|
||||
|
||||
const tabNavigatorConfigWithNavigationOptions: TabNavigatorConfig = {
|
||||
...tabNavigatorConfig,
|
||||
navigationOptions: {
|
||||
tabBarOnPress: ({scene, jumpToIndex}) => {
|
||||
jumpToIndex(scene.index);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
const BasicTabNavigator = TabNavigator(
|
||||
routeConfigMap,
|
||||
tabNavigatorConfig,
|
||||
|
||||
Reference in New Issue
Block a user