Skip to content
This repository was archived by the owner on Jan 18, 2022. It is now read-only.

Commit ad32af4

Browse files
committed
[native] Fix up Flow type of createReduxContainer
1 parent 0d79984 commit ad32af4

1 file changed

Lines changed: 18 additions & 7 deletions

File tree

src/create-redux-container.js

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
import type {
44
NavigationState,
55
NavigationDispatch,
6-
NavigationContainer,
6+
NavigationNavigator,
77
NavigationScreenProp,
8+
NavigationNavigatorProps,
89
} from '@react-navigation/core';
910

1011
import * as React from 'react';
@@ -22,19 +23,29 @@ type RequiredProps<State: NavigationState> = {
2223
type InjectedProps<State: NavigationState> = {
2324
navigation: NavigationScreenProp<State>,
2425
};
25-
function createReduxContainer<State: NavigationState, Props: RequiredProps<State>>(
26-
Navigator: NavigationContainer<
26+
function createReduxContainer<
27+
State: NavigationState,
28+
Options: {},
29+
NavigatorProps: NavigationNavigatorProps<Options, State>,
30+
NavigatorType: NavigationNavigator<
2731
State,
28-
*,
29-
$Diff<Props, RequiredProps<State>>,
32+
Options,
33+
NavigatorProps,
3034
>,
35+
ContainerProps: {
36+
...$Diff<NavigatorProps, InjectedProps<State>>,
37+
...$Exact<RequiredProps<State>>,
38+
},
39+
>(
40+
Navigator: NavigatorType,
3141
key?: string = "root",
32-
): React.ComponentType<Props> {
42+
): React.ComponentType<ContainerProps> {
3343
const didUpdateCallback = createDidUpdateCallback(key);
3444
const propConstructor = createNavigationPropConstructor(key);
3545

36-
class NavigatorReduxWrapper extends React.PureComponent<Props> {
46+
class NavigatorReduxWrapper extends React.PureComponent<ContainerProps> {
3747

48+
static router = Navigator.router;
3849
currentNavProp: ?NavigationScreenProp<State>;
3950

4051
componentDidMount() {

0 commit comments

Comments
 (0)