From e542c84e29e92017a9e29b432bebd5ef20f41b50 Mon Sep 17 00:00:00 2001 From: Ashoat Tevosyan Date: Wed, 10 Apr 2019 12:35:30 -0400 Subject: [PATCH] [flow] Support custom navigators using Transitioner (#5801) --- flow/react-navigation.js | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/flow/react-navigation.js b/flow/react-navigation.js index f191741047..de7c89e293 100644 --- a/flow/react-navigation.js +++ b/flow/react-navigation.js @@ -238,6 +238,7 @@ declare module 'react-navigation' { */ index: number, routes: Array, + isTransitioning?: boolean, }; declare export type NavigationRoute = @@ -407,7 +408,9 @@ declare module 'react-navigation' { NavigationSceneRendererProps & { mode: HeaderMode, router: NavigationRouter, - getScreenDetails: NavigationScene => NavigationScreenDetails, + getScreenDetails: NavigationScene => NavigationScreenDetails< + NavigationStackScreenOptions + >, leftInterpolator: (props: NavigationSceneRendererProps) => {}, titleInterpolator: (props: NavigationSceneRendererProps) => {}, rightInterpolator: (props: NavigationSceneRendererProps) => {}, @@ -466,10 +469,10 @@ declare module 'react-navigation' { disableKeyboardHandling?: boolean, |}; - declare export type StackNavigatorConfig = {| + declare export type StackNavigatorConfig = $Shape<{| ...NavigationStackViewConfig, ...NavigationStackRouterConfig, - |}; + |}>; /** * Switch Navigator @@ -658,7 +661,9 @@ declare module 'react-navigation' { onWillBlur?: NavigationEventCallback, onDidBlur?: NavigationEventCallback, }; - declare export var NavigationEvents: React$ComponentType<_NavigationEventsProps>; + declare export var NavigationEvents: React$ComponentType< + _NavigationEventsProps + >; /** * Navigation container @@ -709,6 +714,7 @@ declare module 'react-navigation' { isStale: boolean, key: string, route: NavigationRoute, + descriptor: ?NavigationDescriptor, }; declare export type NavigationTransitionProps = $Shape<{ @@ -920,9 +926,9 @@ declare module 'react-navigation' { router: NavigationRouter, }; - declare type NavigationDescriptor = { + declare export type NavigationDescriptor = { key: string, - state: NavigationLeafRoute | NavigationStateRoute, + state: NavigationRoute, navigation: NavigationScreenProp<*>, getComponent: () => React$ComponentType<{}>, }; @@ -1037,7 +1043,9 @@ declare module 'react-navigation' { */ transitionConfig?: () => TransitionConfig, } & NavigationNavigatorProps; - declare export var CardStackTransitioner: React$ComponentType<_CardStackTransitionerProps>; + declare export var CardStackTransitioner: React$ComponentType< + _CardStackTransitionerProps + >; declare type _CardStackProps = { screenProps?: {}, @@ -1108,7 +1116,9 @@ declare module 'react-navigation' { truncatedTitle?: ?string, width?: ?number, }; - declare export var HeaderBackButton: React$ComponentType<_HeaderBackButtonProps>; + declare export var HeaderBackButton: React$ComponentType< + _HeaderBackButtonProps + >; declare type _DrawerViewProps = { drawerLockMode?: 'unlocked' | 'locked-closed' | 'locked-open',