-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
36 lines (28 loc) · 1.01 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
import { StatusBar } from "expo-status-bar";
import NavTabs from "./src/components/NavTabs";
import { OriginLocationProvider } from "./src/context/OriginLocation";
import { ToiletResponseProvider } from "./src/context/ToiletResponse";
import * as SplashScreen from "expo-splash-screen";
import { createContext, useCallback, useContext, useEffect, useState } from "react";
import { AppReadyContext, AppReadyContextProvider } from "./src/context/AppReady";
SplashScreen.preventAutoHideAsync();
export default function App() {
const [appIsReady, setAppIsReady] = useState(true);
const onLayoutRootView = useCallback(async () => {
if (appIsReady) {
await SplashScreen.hideAsync();
}
}, [appIsReady]);
if (!appIsReady) {
return null;
}
return (
<AppReadyContext.Provider value={{ appIsReady, setAppIsReady}}>
<ToiletResponseProvider>
<OriginLocationProvider>
<NavTabs />
</OriginLocationProvider>
</ToiletResponseProvider>
</AppReadyContext.Provider>
);
}