-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathindex.js
41 lines (36 loc) · 1.35 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import React, { Component } from 'react';
import {
AppRegistry,
} from 'react-native';
import { createStore ,applyMiddleware, compose } from 'redux'
import { Provider } from 'react-redux'
import MyStackNavigation from "./src/navigation/MyStackNavigation";
import reducers from './src/reducers/reducers'
import devToolsEnhancer from 'remote-redux-devtools';
import thunk from 'redux-thunk';
import {persistStore, persistCombineReducers} from 'redux-persist';
import { PersistGate } from 'redux-persist/es/integration/react';
import storage from 'redux-persist/es/storage' // default: localStorage if web, AsyncStorage if react-native
const config = {
key: 'root',
storage,
};
function configureStore(){
let reducer = persistCombineReducers(config, reducers);
let store = createStore(reducer, compose(applyMiddleware(thunk),devToolsEnhancer({ realtime: true, port: 8000 })));
let persistor = persistStore(store);
return { persistor, store }
}
export default class CoinOnline extends Component {
render() {
const { persistor, store } = configureStore();
return (
<Provider store={store}>
<PersistGate persistor={persistor}>
<MyStackNavigation />
</PersistGate>
</Provider>
);
}
}
AppRegistry.registerComponent('CoinOnline', () => CoinOnline);