From f36dec240b293b3a166f31b90eb4f2a11bd8451c Mon Sep 17 00:00:00 2001 From: Ashoat Tevosyan Date: Thu, 25 Oct 2018 17:14:57 -0400 Subject: [PATCH] [flow] Fix type of getCurrentNavigation (#5173) As of 2.18 we seem to be okay returning `null` here. --- .../react-navigation/flow/react-navigation.js | 30 +++++++++++++------ 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/packages/react-navigation/flow/react-navigation.js b/packages/react-navigation/flow/react-navigation.js index 193ce7e2..640ba845 100644 --- a/packages/react-navigation/flow/react-navigation.js +++ b/packages/react-navigation/flow/react-navigation.js @@ -535,14 +535,26 @@ declare module 'react-navigation' { ) => NavigationEventSubscription, getParam: ( paramName: ParamName, - fallback?: $ElementType<$PropertyType<{| - ...{| params: {| [ParamName]: void |} |}, - ...$Exact, - |}, 'params'>, ParamName>, - ) => $ElementType<$PropertyType<{| - ...{| params: {| [ParamName]: void |} |}, - ...$Exact, - |}, 'params'>, ParamName>, + fallback?: $ElementType< + $PropertyType< + {| + ...{| params: {| [ParamName]: void |} |}, + ...$Exact, + |}, + 'params' + >, + ParamName + > + ) => $ElementType< + $PropertyType< + {| + ...{| params: {| [ParamName]: void |} |}, + ...$Exact, + |}, + 'params' + >, + ParamName + >, dangerouslyGetParent: () => NavigationScreenProp<*>, isFocused: () => boolean, // Shared action creators that exist for all routers @@ -1213,6 +1225,6 @@ declare module 'react-navigation' { dispatch: NavigationDispatch, actionSubscribers: Set, getScreenProps: () => {}, - getCurrentNavigation: () => NavigationScreenProp + getCurrentNavigation: () => ?NavigationScreenProp ): NavigationScreenProp; }