-
Notifications
You must be signed in to change notification settings - Fork 5
/
main.js
39 lines (35 loc) · 982 Bytes
/
main.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
import Exponent from 'exponent';
import React, { Component } from 'react';
import { Provider } from 'react-redux';
import { AsyncStorage } from 'react-native';
import { persistStore } from 'redux-persist';
import EStyleSheet from 'react-native-extended-stylesheet';
import store from './redux/store';
import Routes from './Routes';
import Colors from './constants/Colors';
import { LoadingSpinner } from './components';
import './helpers/ReactotronConfig';
EStyleSheet.build(Colors);
class App extends Component {
state = { rehydrated: false }
componentWillMount() {
persistStore(store, {
storage: AsyncStorage,
whitelist: ['gamesLiked', 'channelsLiked'],
debounce: 500
}, () => this.setState({
rehydrated: true
}));
}
render() {
if (!this.state.rehydrated) {
return <LoadingSpinner />;
}
return (
<Provider store={store}>
<Routes />
</Provider>
);
}
}
Exponent.registerRootComponent(App);