Created
December 31, 2018 17:02
-
-
Save crobinson42/2be87c7c139d9a42c1217345b9e7d5c7 to your computer and use it in GitHub Desktop.
Reactotron react-native config - redux implementation locking up up
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Reactotron from 'reactotron-react-native'; | |
import sagaPlugin from 'reactotron-redux-saga'; | |
import { reactotronRedux } from 'reactotron-redux'; | |
import envLocal from './.local.json'; | |
export default () => Reactotron | |
// your local IP goes in .env.local.json (which is in .gitignore) | |
.configure({ host: envLocal.ip }) | |
// .use(sagaPlugin()) | |
.use(reactotronRedux()) | |
.useReactNative() | |
.connect(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { applyMiddleware, createStore as reduxCreateStore } from 'redux'; | |
import { composeWithDevTools } from 'remote-redux-devtools'; | |
import createSagaMiddleware from 'redux-saga'; | |
import thunkMiddleware from 'redux-thunk'; | |
import { createReactNavigationReduxMiddleware } from 'react-navigation-redux-helpers'; | |
import Reactotron from '../../ReactotronConfig'; | |
import { realm } from '../models'; | |
import rootSaga from '../sagas'; | |
import reducer from '../reducers'; | |
const TEST_ENV = process && process.env && process.env.TEST_ENV; | |
let ReactotronDevTool; | |
if (!TEST_ENV) ReactotronDevTool = Reactotron(); | |
const devToolsComposer = composeWithDevTools({ realtime: __DEV__ }); | |
const reactNavigationMiddleware = createReactNavigationReduxMiddleware( | |
'Splash', | |
state => state.navigationReducers | |
); | |
const sagaMiddleware = createSagaMiddleware({ | |
// sagaMonitor: __DEV__ && !TEST_ENV ? ReactotronDevTool.createSagaMonitor() : undefined | |
}); | |
const middlewares = [ | |
thunkMiddleware.withExtraArgument(realm), | |
reactNavigationMiddleware, | |
sagaMiddleware | |
]; | |
const createStore = __DEV__ && !TEST_ENV ? ReactotronDevTool.createStore : reduxCreateStore; | |
const store = createStore( | |
reducer, | |
devToolsComposer(applyMiddleware(...middlewares)) | |
); | |
sagaMiddleware.run(rootSaga); | |
export default store; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment