From a2a2edb6575687847190b6f0a542f26f2145b4e2 Mon Sep 17 00:00:00 2001 From: yamiscott Date: Fri, 4 May 2018 23:53:47 +0100 Subject: [PATCH] Fixed SwitchNavigatorConfig interface to use the correct backBehavior value for initialRoute. And added a test to cover this. (#25533) --- types/react-navigation/index.d.ts | 2 +- .../react-navigation-tests.tsx | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index db45006ef0..d5f9801b5d 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -631,7 +631,7 @@ export interface SwitchNavigatorConfig { initialRouteName: string; resetOnBlur?: boolean; paths?: NavigationPathsConfig; - backBehavior?: 'none' | 'intialRoute'; + backBehavior?: 'none' | 'initialRoute'; } // Return createNavigationContainer diff --git a/types/react-navigation/react-navigation-tests.tsx b/types/react-navigation/react-navigation-tests.tsx index fb6e72a623..6b8b5c99e8 100644 --- a/types/react-navigation/react-navigation-tests.tsx +++ b/types/react-navigation/react-navigation-tests.tsx @@ -288,6 +288,26 @@ function renderBasicSwitchNavigator(): JSX.Element { ); } +const switchNavigatorConfigWithInitialRoute: SwitchNavigatorConfig = { + initialRouteName: 'screen', + resetOnBlur: false, + backBehavior: 'initialRoute' +}; + +const SwitchNavigatorWithInitialRoute = SwitchNavigator( + routeConfigMap, + switchNavigatorConfigWithInitialRoute, +); + +function renderSwitchNavigatorWithInitialRoute(): JSX.Element { + return ( + { }} + style={viewStyle} + /> + ); +} + /** * Drawer navigator. */