You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
1.7 KiB
66 lines
1.7 KiB
import AsyncStorage from "@react-native-async-storage/async-storage"; |
|
import { applyMiddleware, createStore, compose, combineReducers } from "redux"; |
|
import { createLogger } from "redux-logger"; |
|
import thunk from "redux-thunk"; |
|
import { persistStore, persistReducer } from "redux-persist"; |
|
import autoMergeLevel2 from "redux-persist/lib/stateReconciler/autoMergeLevel2"; |
|
import publicApi from "./reducers/public"; |
|
import user from "./reducers/user"; |
|
import book from "./reducers/book"; |
|
import blog from "./reducers/blog"; |
|
import product from "./reducers/product"; |
|
import faq from "./reducers/faq"; |
|
import file from "./reducers/file"; |
|
import userFactor from "./reducers/userFactor"; |
|
import userProduct from "./reducers/userProduct"; |
|
import qr from './reducers/qr'; |
|
|
|
const persistConfig = { |
|
key: "root", |
|
storage: AsyncStorage, |
|
stateReconciler: autoMergeLevel2, // see "Merge Process" section for details. |
|
whitelist: ["profile"], |
|
}; |
|
|
|
const initialState = {}; |
|
|
|
const middleWare = [thunk]; |
|
|
|
// const loggerMiddleware = createLogger({ |
|
// predicate: () => process.env.NODE_ENV === "development", |
|
// }); |
|
// middleWare.push(loggerMiddleware); |
|
|
|
const store = createStore( |
|
persistReducer( |
|
persistConfig, |
|
combineReducers({ |
|
publicApi, |
|
user, |
|
book, |
|
blog, |
|
product, |
|
faq, |
|
file, |
|
userFactor, |
|
userProduct, |
|
qr |
|
}) |
|
), |
|
initialState, |
|
compose(applyMiddleware(...middleWare)) |
|
); |
|
|
|
const persistor = persistStore(store); |
|
|
|
const ReactNative = require("react-native"); |
|
try { |
|
ReactNative.I18nManager.allowRTL(true); |
|
// enableScreens(); |
|
} catch (e) { |
|
// console.log(e); |
|
} |
|
|
|
// console.disableYellowBox = true; |
|
|
|
export default store;
|
|
|