From 2df24ef30c22e69eb6d2a1011749a5a4e124dc5d Mon Sep 17 00:00:00 2001 From: Pavel Galeta Date: Tue, 21 May 2019 19:53:32 +0300 Subject: [PATCH] fix(navigation): Fixes Redux navigation middleware being called twice (#273 by @superp) --- boilerplate/App/Navigation/ReduxNavigation.js | 2 +- boilerplate/App/Redux/CreateStore.js | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/boilerplate/App/Navigation/ReduxNavigation.js b/boilerplate/App/Navigation/ReduxNavigation.js index eb11453..8914469 100644 --- a/boilerplate/App/Navigation/ReduxNavigation.js +++ b/boilerplate/App/Navigation/ReduxNavigation.js @@ -7,7 +7,7 @@ import { import { connect } from 'react-redux' import AppNavigation from './AppNavigation' -createReactNavigationReduxMiddleware( +export const appNavigatorMiddleware = createReactNavigationReduxMiddleware( 'root', (state) => state.nav ) diff --git a/boilerplate/App/Redux/CreateStore.js b/boilerplate/App/Redux/CreateStore.js index 963275e..e812532 100644 --- a/boilerplate/App/Redux/CreateStore.js +++ b/boilerplate/App/Redux/CreateStore.js @@ -2,7 +2,7 @@ import { createStore, applyMiddleware, compose } from 'redux' import Config from '../Config/DebugConfig' import createSagaMiddleware from 'redux-saga' import ScreenTracking from './ScreenTrackingMiddleware' -import { createReactNavigationReduxMiddleware } from 'react-navigation-redux-helpers' +import { appNavigatorMiddleware } from '../Navigation/ReduxNavigation' // creates the store export default (rootReducer, rootSaga) => { @@ -12,11 +12,7 @@ export default (rootReducer, rootSaga) => { const enhancers = [] /* ------------- Navigation Middleware ------------ */ - const navigationMiddleware = createReactNavigationReduxMiddleware( - 'root', - state => state.nav - ) - middleware.push(navigationMiddleware) + middleware.push(appNavigatorMiddleware) /* ------------- Analytics Middleware ------------- */ middleware.push(ScreenTracking)