From ce73af4e00eb928d1410bdc06f94e06e37c488f6 Mon Sep 17 00:00:00 2001 From: Steven Date: Mon, 26 Feb 2018 13:35:23 -0800 Subject: [PATCH] fixed error in react-navigation preventing declaring navigationOptions as a function (#23879) --- types/react-navigation/index.d.ts | 1 + .../react-navigation-tests.tsx | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index 531a18e9e5..c4e396783f 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -13,6 +13,7 @@ // Sergei Butko: // Veit Lehmann: // Roberto Huertas: +// Steven Miller // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 diff --git a/types/react-navigation/react-navigation-tests.tsx b/types/react-navigation/react-navigation-tests.tsx index a7eaad092b..017a9b9153 100644 --- a/types/react-navigation/react-navigation-tests.tsx +++ b/types/react-navigation/react-navigation-tests.tsx @@ -199,6 +199,26 @@ function renderBasicStackNavigator(): JSX.Element { ); } +const stackNavigatorConfigWithNavigationOptionsAsFunction: StackNavigatorConfig = { + mode: "card", + headerMode: "screen", + navigationOptions: ({navigationOptions, navigation, screenProps}) => (stackNavigatorScreenOptions), +}; + +const AdvancedStackNavigator = StackNavigator( + routeConfigMap, + stackNavigatorConfigWithNavigationOptionsAsFunction +); + +function renderAdvancedStackNavigator(): JSX.Element { + return ( + { }} + style={viewStyle} + /> + ); +} + /** * Drawer navigator. */