Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// @flow
import { Platform } from 'react-native';
import { composeWithDevTools } from 'remote-redux-devtools';
import { applyMiddleware, createStore } from 'redux';
import Thunk from 'redux-thunk';
import { createNetworkMiddleware } from 'react-native-offline';
import { persistStore, autoRehydrate } from 'redux-persist';
import realmPersist from 'redux-persist-realm';
import reducer from './reducer';
const preloadedState = {};
const networkMiddleware = createNetworkMiddleware();
const composeEnhancers = composeWithDevTools({
name: Platform.OS,
hostname: '127.0.0.1',
port: 8888,
realtime: true,
});
const store = createStore(
reducer,
preloadedState,
composeEnhancers(
applyMiddleware(...[
networkMiddleware,
Thunk,
]),
autoRehydrate()
createNetworkMiddleware
} from "react-native-offline";
import LoginScreen from "./src/screens/LoginScreen";
import UsersScreen from "./src/screens/UsersScreen";
import ChatScreen from "./src/screens/ChatScreen";
import { Provider } from "react-redux";
import { createStore, combineReducers, applyMiddleware } from "redux";
import ChatReducer from "./src/reducers/ChatReducer";
import { watcherSaga } from "./src/sagas";
const sagaMiddleware = createSagaMiddleware();
const networkMiddleware = createNetworkMiddleware();
const persistConfig = {
key: "root",
storage,
blacklist: ["network", "chat"]
};
const chatPersistConfig = {
key: "chat",
storage: storage,
blacklist: ["isNetworkBannerVisible"]
};
const rootReducer = combineReducers({
chat: persistReducer(chatPersistConfig, ChatReducer),
network
export default function createReduxStore({
withSaga = false,
queueReleaseThrottle = 1000,
} = {}) {
const networkMiddleware = createNetworkMiddleware({
regexActionType: /^OTHER/,
actionTypes: ['ADD_ONE', 'SUB_ONE'],
queueReleaseThrottle,
});
const sagaMiddleware = createSagaMiddleware();
const rootReducer = combineReducers({
counter,
network,
});
const middlewares = [networkMiddleware];
if (withSaga === true) {
middlewares.push(sagaMiddleware);
}