Skip to content

Instantly share code, notes, and snippets.

@crobinson42
Created December 31, 2018 17:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crobinson42/2be87c7c139d9a42c1217345b9e7d5c7 to your computer and use it in GitHub Desktop.
Save crobinson42/2be87c7c139d9a42c1217345b9e7d5c7 to your computer and use it in GitHub Desktop.
Reactotron react-native config - redux implementation locking up up
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();
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