-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ios.js
55 lines (46 loc) · 1.26 KB
/
index.ios.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import React, { Component } from 'react'
import { AppRegistry } from 'react-native'
import { Provider } from 'react-redux'
import { applyMiddleware, createStore } from 'redux'
import { persistStore, persistCombineReducers } from 'redux-persist'
import autoMergeLevel2 from 'redux-persist/lib/stateReconciler/autoMergeLevel2'
import thunk from 'redux-thunk'
import { composeWithDevTools } from 'redux-devtools-extension'
import storage from 'redux-persist/lib/storage'
import Align from 'src/app'
import reducers from 'reducers'
import array from 'utils/arrayMiddleware'
const config = {
key: 'primary1',
version: 1,
storage,
blacklist: ['ui'],
stateReconciler: autoMergeLevel2,
}
const store = createStore(
persistCombineReducers(config, reducers),
undefined,
composeWithDevTools(applyMiddleware(thunk, array)),
)
export default class Root extends Component {
constructor() {
super()
this.state = { rehydrated: false }
}
componentDidMount() {
persistStore(store, null, () => {
this.setState({ rehydrated: true })
})
}
render() {
if (!this.state.rehydrated) {
return null
}
return (
<Provider store={store}>
<Align />
</Provider>
)
}
}
AppRegistry.registerComponent('Align', () => Root)