-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
36 lines (29 loc) · 885 Bytes
/
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
import "react-native-gesture-handler";
import { useCallback, useEffect, useState } from "react";
import { NavigationContainer } from "@react-navigation/native";
import * as SplashScreen from "expo-splash-screen";
import { RootStackNavigator } from "@/src/navigator/RootStack";
import { useAppFonts } from "@/src/theme";
SplashScreen.preventAutoHideAsync();
export default function App() {
const [appIsReady, setAppIsReady] = useState(false);
const [fontsLoaded] = useAppFonts();
useEffect(() => {
if (fontsLoaded) {
setAppIsReady(true);
}
}, [fontsLoaded]);
const onRootReady = useCallback(async () => {
if (appIsReady) {
await SplashScreen.hideAsync();
}
}, [appIsReady]);
if (!appIsReady) {
return null;
}
return (
<NavigationContainer onReady={onRootReady}>
<RootStackNavigator />
</NavigationContainer>
);
}