Skip to content

Commit

Permalink
fix reducer error, bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
aksonov committed Oct 1, 2018
1 parent 045331c commit fd42d37
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "react-native-router-flux",
"version": "4.0.4",
"version": "4.0.5",
"description": "React Native Router using Flux architecture",
"repository": {
"type": "git",
Expand Down
6 changes: 2 additions & 4 deletions src/Reducer.js
Expand Up @@ -3,11 +3,9 @@ import { NavigationActions, StackActions } from 'react-navigation';
import * as ActionConst from './ActionConst';
import { getActiveState, popPrevious } from './State';

export default function createReducer(navigationStore) {
export default function createReducer() {
return (state, action) => {
if (!navigationStore) {
navigationStore = require('./navigationStore').default;
}
const navigationStore = require('./navigationStore').default;
const { type, routeName } = action;
if (type === ActionConst.POP_TO) {
let nextScene = '';
Expand Down
2 changes: 1 addition & 1 deletion src/navigationStore.js
Expand Up @@ -520,7 +520,7 @@ class NavigationStore {

setCustomReducer = (Navigator) => {
this.getStateForAction = Navigator.router.getStateForAction;
const reducer = createReducer(this);
const reducer = createReducer();
Navigator.router.getStateForAction = (cmd, state) => (this.reducer ? this.reducer(state, cmd) : reducer(state, cmd));
};

Expand Down

0 comments on commit fd42d37

Please sign in to comment.