From 8abd412a024d5993273914f685fa6695756aceb4 Mon Sep 17 00:00:00 2001 From: Qibang Date: Wed, 24 Jan 2018 02:36:05 +0800 Subject: [PATCH] feat: add `tabBarOnPress` (#23068) --- types/react-navigation/index.d.ts | 12 +++++++++++- types/react-navigation/react-navigation-tests.tsx | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index 30aa2c1ff8..37d6360688 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -327,7 +327,12 @@ export interface NavigationTabRouterConfig { // Does the back button cause the router to switch to the initial tab backBehavior?: 'none' | 'initialRoute'; // defaults `initialRoute` } - +export interface TabScene { + route: NavigationRoute; + focused: boolean; + index: number; + tintColor?: string; +} export interface NavigationTabScreenOptions extends NavigationScreenOptions { tabBarIcon?: React.ReactElement @@ -341,6 +346,11 @@ export interface NavigationTabScreenOptions extends NavigationScreenOptions { any > | string | null)); tabBarVisible?: boolean; + tabBarTestIDProps?: { testID?: string, accessibilityLabel?: string }; + tabBarOnPress?: ( + scene: TabScene, + jumpToIndex: (index: number) => void + ) => void; } export interface NavigationDrawerScreenOptions extends NavigationScreenOptions { diff --git a/types/react-navigation/react-navigation-tests.tsx b/types/react-navigation/react-navigation-tests.tsx index aca3f1bcf6..40d19f0fee 100644 --- a/types/react-navigation/react-navigation-tests.tsx +++ b/types/react-navigation/react-navigation-tests.tsx @@ -138,6 +138,7 @@ const tabNavigatorScreenOptions: NavigationTabScreenOptions = { tabBarVisible: true, tabBarIcon: , tabBarLabel: 'label', + tabBarOnPress: (scene, index) => {} }; const tabNavigatorConfig: TabNavigatorConfig = {