-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
48 lines (39 loc) · 1.36 KB
/
App.tsx
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
import { StatusBar } from 'expo-status-bar';
import reducers from './services';
import React from 'react';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import { createStore, applyMiddleware } from 'redux';
import { composeWithDevTools } from 'redux-devtools-extension';
import reduxThunk from 'redux-thunk';
import { Provider } from 'react-redux';
import useCachedResources from './hooks/useCachedResources';
import Main from './screens';
import { verifyAuth } from './services/user/actions';
import { View, Image } from 'react-native';
import Layout from './constants/Layout';
const composeEnhancers = composeWithDevTools(applyMiddleware(reduxThunk))
const store = createStore(
reducers,
composeEnhancers
);
export type AppDispatch = typeof store.dispatch
export type RootState = ReturnType<typeof reducers>
function configureStore() {
store.dispatch(verifyAuth(store.getState()))
return store;
}
export default function App() {
const isLoadingComplete = useCachedResources();
if (!isLoadingComplete) {
return <Image source={require('./assets/images/splash.png')} style={{ height: Layout.window.height, width: Layout.window.width }} />
} else {
return (
<Provider store={configureStore()}>
<SafeAreaProvider>
<Main />
<StatusBar style="auto" />
</SafeAreaProvider>
</Provider>
);
}
}