Browse Source

Use `createNavigationReducer`.

Herby Vojčík 6 years ago
parent
commit
43c14e0979
1 changed files with 6 additions and 2 deletions
  1. 6 2
      index.js

+ 6 - 2
index.js

@@ -1,13 +1,17 @@
 "use strict";
 
 import React, {Component} from 'react';
-import {createReactNavigationReduxMiddleware, createReduxBoundAddListener} from 'react-navigation-redux-helpers';
+import {
+    createReactNavigationReduxMiddleware,
+    createReduxBoundAddListener,
+    createNavigationReducer
+} from 'react-navigation-redux-helpers';
 import {connect} from 'react-redux';
 
 export const navigatorPieces = (BareNavigator, name = "root") => {
     const middleware = createReactNavigationReduxMiddleware(name, x => x);
     const addListener = createReduxBoundAddListener(name);
-    const reducer = (state, action) => BareNavigator.router.getStateForAction(action, state);
+    const reducer = createNavigationReducer(BareNavigator);
 
     class Navigator extends Component {
         render () {