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

Commit 7cd0425

Browse files
committed
reduxifyNavigator -> createReduxContainer
For consistency with `react-navigation@3` naming conventions.
1 parent 9d28e18 commit 7cd0425

5 files changed

Lines changed: 27 additions & 17 deletions

File tree

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import {
4040
combineReducers,
4141
} from 'redux';
4242
import {
43-
reduxifyNavigator,
43+
createReduxContainer,
4444
createReactNavigationReduxMiddleware,
4545
createNavigationReducer,
4646
} from 'react-navigation-redux-helpers';
@@ -55,13 +55,13 @@ const appReducer = combineReducers({
5555
...
5656
});
5757

58-
// Note: createReactNavigationReduxMiddleware must be run before reduxifyNavigator
58+
// Note: createReactNavigationReduxMiddleware must be run before createReduxContainer
5959
const middleware = createReactNavigationReduxMiddleware(
6060
"root",
6161
state => state.nav,
6262
);
6363

64-
const App = reduxifyNavigator(AppNavigator, "root");
64+
const App = createReduxContainer(AppNavigator, "root");
6565
const mapStateToProps = (state) => ({
6666
state: state.nav,
6767
});
@@ -95,13 +95,13 @@ function createReactNavigationReduxMiddleware<State: {}>(
9595
```
9696

9797
* Returns a middleware that can be applied to a Redux store.
98-
* Param `key` needs to be unique for the Redux store. Most people only have one store, so can use any string (eg. `"root"`), as long as it's consistent with the call to `reduxifyNavigator` below.
98+
* Param `key` needs to be unique for the Redux store. Most people only have one store, so can use any string (eg. `"root"`), as long as it's consistent with the call to `createReduxContainer` below.
9999
* Param `navStateSelector` selects the navigation state from your store.
100100

101-
### `reduxifyNavigator` (required)
101+
### `createReduxContainer` (required)
102102

103103
```js
104-
function reduxifyNavigator(
104+
function createReduxContainer(
105105
navigator: Navigator,
106106
key: string,
107107
): React.ComponentType<{ state: NavigationState, dispatch: Dispatch }>;

index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ declare module 'react-navigation-redux-helpers' {
1919

2020
export function createNavigationReducer(navigator: Navigator): Reducer<ReducerState>;
2121

22-
export function reduxifyNavigator<S, P>(
22+
export function createReduxContainer<S, P>(
2323
navigator: Navigator,
2424
key: string,
2525
): React.ComponentType<{ state: NavigationState; dispatch: NavigationDispatch } & P>;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ type RequiredProps<State: NavigationState> = {
2222
type InjectedProps<State: NavigationState> = {
2323
navigation: NavigationScreenProp<State>,
2424
};
25-
function reduxifyNavigator<State: NavigationState, Props: RequiredProps<State>>(
25+
function createReduxContainer<State: NavigationState, Props: RequiredProps<State>>(
2626
Navigator: NavigationContainer<
2727
State,
2828
*,
@@ -71,5 +71,5 @@ function reduxifyNavigator<State: NavigationState, Props: RequiredProps<State>>(
7171
}
7272

7373
export {
74-
reduxifyNavigator,
74+
createReduxContainer,
7575
};

src/index.js

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
import invariant from 'invariant';
44

55
import { createReactNavigationReduxMiddleware } from './middleware';
6-
import { reduxifyNavigator } from './reduxify-navigator';
6+
import { createReduxContainer } from './create-redux-container';
77
import { createNavigationReducer } from './reducer';
88

99
function initializeListeners() {
1010
invariant(
1111
false,
1212
"initializeListeners is deprecated in " +
13-
"[email protected]! Please use reduxifyNavigator " +
13+
"[email protected]! Please use createReduxContainer " +
1414
"instead.",
1515
);
1616
}
@@ -19,7 +19,7 @@ function createReduxBoundAddListener() {
1919
invariant(
2020
false,
2121
"createReduxBoundAddListener is deprecated in " +
22-
"[email protected]! Please use reduxifyNavigator " +
22+
"[email protected]! Please use createReduxContainer " +
2323
"instead.",
2424
);
2525
}
@@ -28,7 +28,7 @@ function createNavigationPropConstructor() {
2828
invariant(
2929
false,
3030
"createNavigationPropConstructor is deprecated in " +
31-
"[email protected]! Please use reduxifyNavigator " +
31+
"[email protected]! Please use createReduxContainer " +
3232
"instead.",
3333
);
3434
}
@@ -37,7 +37,16 @@ function createDidUpdateCallback() {
3737
invariant(
3838
false,
3939
"createDidUpdateCallback is deprecated in " +
40-
"[email protected]! Please use reduxifyNavigator " +
40+
"[email protected]! Please use createReduxContainer " +
41+
"instead.",
42+
);
43+
}
44+
45+
function reduxifyNavigator() {
46+
invariant(
47+
false,
48+
"reduxifyNavigator is deprecated in " +
49+
"[email protected]! Please use createReduxContainer " +
4150
"instead.",
4251
);
4352
}
@@ -46,9 +55,10 @@ export * from './types';
4655
export {
4756
// Current
4857
createReactNavigationReduxMiddleware,
49-
reduxifyNavigator,
5058
createNavigationReducer,
59+
createReduxContainer,
5160
// Deprecated
61+
reduxifyNavigator,
5262
initializeListeners,
5363
createReduxBoundAddListener,
5464
createNavigationPropConstructor,

src/middleware.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ function initializeListeners(key: string, state: NavigationState) {
9393
const subscribers = reduxSubscribers.get(key);
9494
invariant(
9595
subscribers,
96-
"Before calling `reduxifyNavigator`, please call " +
96+
"Before calling `createReduxContainer`, please call " +
9797
"`createReactNavigationReduxMiddleware`, so that we know " +
9898
"when to trigger your listener.",
9999
);
@@ -116,7 +116,7 @@ function createNavigationPropConstructor(key: string) {
116116
const actionSubscribers = reduxSubscribers.get(key);
117117
invariant(
118118
actionSubscribers,
119-
"Before calling `reduxifyNavigator`, please call " +
119+
"Before calling `createReduxContainer`, please call " +
120120
"`createReactNavigationReduxMiddleware`, so that we know " +
121121
"when to trigger your listener.",
122122
);

0 commit comments

Comments
 (0)