-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.tsx
More file actions
30 lines (25 loc) · 777 Bytes
/
Copy pathApp.tsx
File metadata and controls
30 lines (25 loc) · 777 Bytes
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
import { NavigationContainer } from "@react-navigation/native";
import StackNavigator from "./navigation";
import useAppInit from "./src/hooks/useAppInit";
import * as SplashScreen from "expo-splash-screen";
import { useCallback } from "react";
import { View } from "react-native";
SplashScreen.preventAutoHideAsync();
export default function App() {
const { isLoadingComplete } = useAppInit();
const onLayoutRootView = useCallback(async () => {
if (isLoadingComplete) {
await SplashScreen.hideAsync();
}
}, [isLoadingComplete]);
if (!isLoadingComplete) {
return null;
}
return (
<NavigationContainer>
<View style={{ flex: 1 }} onLayout={onLayoutRootView}>
<StackNavigator />
</View>
</NavigationContainer>
);
}