-
Notifications
You must be signed in to change notification settings - Fork 32
/
App.js
68 lines (58 loc) · 1.33 KB
/
App.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
56
57
58
59
60
61
62
63
64
65
66
67
68
import React from 'react';
import { AsyncStorage } from 'react-native';
import { Provider } from 'react-redux';
import {
createStore,
combineReducers,
applyMiddleware,
compose,
} from 'redux';
import reduxThunk from 'redux-thunk';
import { createLogger } from 'redux-logger';
import { persistStore, autoRehydrate } from 'redux-persist';
import {
ActionSheetProvider,
} from '@expo/react-native-action-sheet';
import SlopeNinja from './src/SlopeNinja';
/* reducers */
import nav from './src/reducers/nav';
import favorites from './src/reducers/favorites';
import resorts from './src/reducers/resorts';
import userSession from './src/reducers/userSession';
const app = combineReducers({
resorts,
});
const rootReducer = combineReducers({
app,
nav,
favorites,
userSession,
});
const middlewares = [reduxThunk];
if (__DEV__) { // eslint-disable-line no-undef
middlewares.push(createLogger());
}
const store = createStore(
rootReducer,
undefined,
compose(
applyMiddleware(...middlewares),
autoRehydrate(),
),
);
// begin periodically persisting the store
persistStore(
store,
{
storage: AsyncStorage,
whitelist: ['favorites', 'userSession'],
},
);
const App = () => (
<Provider store={store}>
<ActionSheetProvider>
<SlopeNinja />
</ActionSheetProvider>
</Provider>
);
export default App;