-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
53 lines (43 loc) · 1.32 KB
/
index.js
File metadata and controls
53 lines (43 loc) · 1.32 KB
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
42
43
44
45
46
47
48
49
50
51
52
import { AppRegistry, Text, View } from 'react-native'
import React from 'react'
import { applyMiddleware, createStore } from 'redux'
import { Provider } from 'react-redux'
import logger from 'redux-logger'
import { persistStore, persistCombineReducers } from 'redux-persist'
import storage from 'redux-persist/lib/storage' // default: localStorage if web, AsyncStorage if react-native
import { PersistGate } from 'redux-persist/es/integration/react'
import { countdowns } from './reducers/CountdownReducer'
import { slide } from './reducers/SlideReducer'
import { user } from './reducers/UserReducer'
import App from './App'
import Loading from './components/Loading'
// Disable annoying debug warnings
console.disableYellowBox = true
const config = {
key: 'root',
storage,
}
const reducer = persistCombineReducers(config, {
countdowns,
slide,
user,
})
function configureStore () {
const store = createStore(reducer, applyMiddleware(logger))
const persistor = persistStore(store)
return {persistor, store}
}
const ReduxApp = () => {
const {persistor, store} = configureStore()
return (
<Provider store={store}>
<PersistGate
loading={<Loading />}
persistor={persistor}
>
<App />
</PersistGate>
</Provider>
)
}
AppRegistry.registerComponent('Monota', () => ReduxApp)