diff --git a/flow/react-navigation.js b/flow/react-navigation.js index 17813fe..0234115 100644 --- a/flow/react-navigation.js +++ b/flow/react-navigation.js @@ -283,6 +283,10 @@ declare module 'react-navigation' { | NavigationScreenComponent | NavigationContainer<*, *, *>; + declare interface withOptionalNavigationOptions { + navigationOptions?: NavigationScreenConfig, + } + declare export type NavigationScreenComponent< Route: NavigationRoute, Options: {}, @@ -290,8 +294,11 @@ declare module 'react-navigation' { > = React$ComponentType<{ ...Props, ...NavigationNavigatorProps, - }> & - ({} | { navigationOptions: NavigationScreenConfig }); + }> & withOptionalNavigationOptions; + + declare interface withRouter { + router: NavigationRouter, + } declare export type NavigationNavigator< State: NavigationState, @@ -300,10 +307,7 @@ declare module 'react-navigation' { > = React$ComponentType<{ ...Props, ...NavigationNavigatorProps, - }> & { - router: NavigationRouter, - navigationOptions?: ?NavigationScreenConfig, - }; + }> & withRouter & withOptionalNavigationOptions; declare export type NavigationRouteConfig = | NavigationComponent @@ -549,10 +553,7 @@ declare module 'react-navigation' { > = React$ComponentType<{ ...Props, ...NavigationContainerProps, - }> & { - router: NavigationRouter, - navigationOptions?: ?NavigationScreenConfig, - }; + }> & withRouter & withOptionalNavigationOptions; declare export type NavigationContainerProps = $Shape<{ uriPrefix?: string | RegExp,