mirror of
https://github.com/status-im/react-navigation.git
synced 2025-02-24 09:08:15 +00:00
[flow] Fixes for v2 libdef (#4230)
* [flow] Remove "any" type from NavigationComponent "any" cripples the typechecker, so it's best to avoid. It was introduced in #3392, but I don't think the intention was to keep it there. * [flow] Remove `any` type from `createNavigator` return And use objects with spread sub-types instead of unions for `React$ComponentType` type param
This commit is contained in:
parent
d168ab26f9
commit
550001b053
20
flow/react-navigation.js
vendored
20
flow/react-navigation.js
vendored
@ -269,21 +269,26 @@ declare module 'react-navigation' {
|
|||||||
|
|
||||||
declare export type NavigationComponent =
|
declare export type NavigationComponent =
|
||||||
| NavigationScreenComponent<NavigationRoute, *, *>
|
| NavigationScreenComponent<NavigationRoute, *, *>
|
||||||
| NavigationContainer<*, *, *>
|
| NavigationContainer<*, *, *>;
|
||||||
| any;
|
|
||||||
|
|
||||||
declare export type NavigationScreenComponent<
|
declare export type NavigationScreenComponent<
|
||||||
Route: NavigationRoute,
|
Route: NavigationRoute,
|
||||||
Options: {},
|
Options: {},
|
||||||
Props: {}
|
Props: {}
|
||||||
> = React$ComponentType<NavigationNavigatorProps<Options, Route> & Props> &
|
> = React$ComponentType<{
|
||||||
|
...Props,
|
||||||
|
...NavigationNavigatorProps<Options, Route>,
|
||||||
|
}> &
|
||||||
({} | { navigationOptions: NavigationScreenConfig<Options> });
|
({} | { navigationOptions: NavigationScreenConfig<Options> });
|
||||||
|
|
||||||
declare export type NavigationNavigator<
|
declare export type NavigationNavigator<
|
||||||
State: NavigationState,
|
State: NavigationState,
|
||||||
Options: {},
|
Options: {},
|
||||||
Props: {}
|
Props: {}
|
||||||
> = React$ComponentType<NavigationNavigatorProps<Options, State> & Props> & {
|
> = React$ComponentType<{
|
||||||
|
...Props,
|
||||||
|
...NavigationNavigatorProps<Options, State>,
|
||||||
|
}> & {
|
||||||
router: NavigationRouter<State, Options>,
|
router: NavigationRouter<State, Options>,
|
||||||
navigationOptions?: ?NavigationScreenConfig<Options>,
|
navigationOptions?: ?NavigationScreenConfig<Options>,
|
||||||
};
|
};
|
||||||
@ -534,7 +539,10 @@ declare module 'react-navigation' {
|
|||||||
State: NavigationState,
|
State: NavigationState,
|
||||||
Options: {},
|
Options: {},
|
||||||
Props: {}
|
Props: {}
|
||||||
> = React$ComponentType<NavigationContainerProps<State, Options> & Props> & {
|
> = React$ComponentType<{
|
||||||
|
...Props,
|
||||||
|
...NavigationContainerProps<State, Options>,
|
||||||
|
}> & {
|
||||||
router: NavigationRouter<State, Options>,
|
router: NavigationRouter<State, Options>,
|
||||||
navigationOptions?: ?NavigationScreenConfig<Options>,
|
navigationOptions?: ?NavigationScreenConfig<Options>,
|
||||||
};
|
};
|
||||||
@ -766,7 +774,7 @@ declare module 'react-navigation' {
|
|||||||
view: NavigationView<O, S>,
|
view: NavigationView<O, S>,
|
||||||
router: NavigationRouter<S, O>,
|
router: NavigationRouter<S, O>,
|
||||||
navigatorConfig?: NavigatorConfig
|
navigatorConfig?: NavigatorConfig
|
||||||
): any;
|
): NavigationNavigator<S, O, *>;
|
||||||
|
|
||||||
declare export function StackNavigator(
|
declare export function StackNavigator(
|
||||||
routeConfigMap: NavigationRouteConfigMap,
|
routeConfigMap: NavigationRouteConfigMap,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user