-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
65 lines (55 loc) · 1.55 KB
/
Copy pathindex.js
File metadata and controls
65 lines (55 loc) · 1.55 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
53
54
55
56
57
58
59
60
61
62
63
64
65
// react
import React from 'react';
import { AppRegistry, View } from 'react-native';
// redux
import { applyMiddleware, createStore } from 'redux';
import logger from 'redux-logger';
import thunk from 'redux-thunk';
import { Provider } from 'react-redux';
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';
// reducers
import { scannedAddress, accounts, user, slide } from './src/reducers';
// App
import { Spinner } from '@shoutem/ui';
import App from './App';
// Disable annoying debug warnings
console.disableYellowBox = true;
const config = {
key: 'root',
storage,
blacklist: [ 'scannedAddress', 'accounts' ]
};
const reducer = persistCombineReducers(config, { scannedAddress, accounts, slide, user });
function configureStore() {
const store = createStore(reducer, applyMiddleware(thunk, logger));
const persistor = persistStore(store);
return { persistor, store };
}
const ReduxApp = () => {
const { persistor, store } = configureStore();
const styles = {
loadingContainer: {
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
height: '100%'
}
};
return (
<Provider store={store}>
<PersistGate
loading={
<View style={styles.loadingContainer}>
<Spinner />
</View>
}
persistor={persistor}
>
<App />
</PersistGate>
</Provider>
);
};
AppRegistry.registerComponent('Globe', () => ReduxApp);