Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import BattleScreen from "./src/screens/BattleScreen";
import TeamSelectionScreen from "./src/screens/TeamSelectionScreen";
import { Provider } from "react-redux";
import { compose, createStore } from "redux";
import reducers from "./src/reducers";
import Reactotron from "reactotron-react-native";
import { reactotronRedux } from "reactotron-redux";
Reactotron.configure({ host: "YOUR_INTERNAL_IP_ADDRESS" }) // example: 192.168.254.108
.useReactNative()
.use(reactotronRedux())
.connect();
const store = Reactotron.createStore(reducers, {}, compose());
//const store = createStore(reducers); // replace the above code with this one on deployment
console.ignoredYellowBox = ["Setting a timer"];
const RootStack = createStackNavigator(
{
Login: LoginScreen,
TeamSelect: TeamSelectionScreen,
Battle: BattleScreen
},
{
initialRouteName: "Login"
}
);
export default initializeStore = () => {
// create the store
if (__DEV__) {
// reactotron development mode
const sagaMonitor = Reactotron.createSagaMonitor();
var sagaMiddleware = createSagaMiddleware({sagaMonitor});
const middlewares = applyMiddleware(
thunk,
sagaMiddleware
);
const enhancers = compose(middlewares, autoRehydrate());
var store = Reactotron.createStore(reducers, enhancers);
} else {
// release mode
var sagaMiddleware = createSagaMiddleware();
const middlewares = applyMiddleware(
thunk,
sagaMiddleware
);
const enhancers = compose(middlewares, autoRehydrate());
var store = createStore(reducers, enhancers);
}
// run sagas
sagaMiddleware.run(Sagas);
// load previous
if (Platform.OS === 'ios') {
export default initializeStore = () => {
// create the store
if (__DEV__) {
// reactotron development mode
const sagaMonitor = Reactotron.createSagaMonitor();
var sagaMiddleware = createSagaMiddleware({sagaMonitor});
const middlewares = applyMiddleware(
thunk,
sagaMiddleware
);
const enhancers = compose(middlewares, autoRehydrate());
var store = Reactotron.createStore(reducers, enhancers);
} else {
// release mode
var sagaMiddleware = createSagaMiddleware();
const middlewares = applyMiddleware(
thunk,
sagaMiddleware
);
const enhancers = compose(middlewares, autoRehydrate());
var store = createStore(reducers, enhancers);
}
// run sagas
sagaMiddleware.run(Sagas);
// load previous
persistStore(store, {
import {createStore, applyMiddleware} from 'redux';
import Reactotron from 'reactotron-react-native';
import createSagaMiddleware from 'redux-saga';
import reducers from './reducers';
import rootSaga from './sagas';
/**
* Reactotron linking for Redux-Saga.
*/
const sagaMonitor = Reactotron.createSagaMonitor();
const sagaMiddleware = createSagaMiddleware({sagaMonitor});
/**
* Redux store creation.
*/
const store = Reactotron.createStore(
reducers,
applyMiddleware(sagaMiddleware)
);
/**
* Starts root saga listener.
*/
sagaMiddleware.run(rootSaga);
export default store;
const middlewares = [reduxThunk];
if (__DEV__) {
if (process.env.LOGGER_ENABLED) {
middlewares.push(createLogger());
}
}
return applyMiddleware(...middlewares);
};
let store;
if (__DEV__) {
if (process.env.TRON_ENABLED) {
store = Reactotron.createStore(
rootReducer,
compose(getMiddleware())
);
} else {
store = createStore(
rootReducer,
composeWithDevTools(getMiddleware())
);
}
} else {
store = createStore(rootReducer, compose(getMiddleware()));
}
export const configureStore = store;
export const persistor = persistStore(configureStore);
export default function configureStore() {
const sagaMiddleware = createSagaMiddleware({
sagaMonitor: Reactotron.createSagaMonitor(),
});
const persistedReducer = persistReducer(
{
key: 'root',
storage: AsyncStorage,
whitelist: ['auth'],
debug: true,
},
rootReducer
);
const store = Reactotron.createStore(
persistedReducer,
compose(applyMiddleware(sagaMiddleware, logger))
);
const persistor = persistStore(store);
sagaMiddleware.run(rootSaga);
return { store, persistor };
}
import { createStore, applyMiddleware, compose } from 'redux';
import { Platform } from 'react-native';
import rootReducer from './reducers/index';
import thunk from 'redux-thunk';
import initialState from './initial-state';
import { startListeningToAuthChanges } from './actions/auth';
import devTools from 'remote-redux-devtools';
import Reactotron from 'reactotron-react-native';
export const store = Reactotron.createStore(
rootReducer,
initialState,
applyMiddleware(thunk),
);
constructor(props) {
super(props);
const middlewares = [thunk];
this.store = Reactotron.createStore(
getRootReducer(navigationReducer),
{},
composeWithDevTools(applyMiddleware(...middlewares))
);
}