-
Notifications
You must be signed in to change notification settings - Fork 1
/
App.js
26 lines (22 loc) · 799 Bytes
/
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
import * as React from 'react';
import { Provider } from 'react-redux';
import createStore from './app/shared/reducers';
import * as SplashScreen from 'expo-splash-screen';
import NavContainer from './app/navigation/nav-container';
const store = createStore();
export default function App() {
// prevent the splashscreen from disappearing until the redux store is completely ready (hidden in nav-container.js)
const [displayApp, setDisplayApp] = React.useState(false);
React.useEffect(() => {
if (!displayApp) {
SplashScreen.preventAutoHideAsync()
.then(() => setDisplayApp(true))
.catch(() => setDisplayApp(true));
}
}, [displayApp, setDisplayApp]);
return displayApp ? (
<Provider store={store}>
<NavContainer />
</Provider>
) : null;
}