-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
46 lines (42 loc) · 1.12 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
37
38
39
40
41
42
43
44
45
46
import * as React from "react";
import { useEffect, useCallback } from "react";
import { StatusBar, SafeAreaView } from "react-native";
import * as SplashScreen from "expo-splash-screen";
import { NavigationContainer } from "@react-navigation/native";
import { Routes } from "./src/routes";
import {
useFonts,
Poppins_600SemiBold,
Poppins_400Regular,
Poppins_500Medium,
Poppins_700Bold,
} from "@expo-google-fonts/poppins";
function App() {
const [fontsLoaded] = useFonts({
Poppins_400Regular,
Poppins_500Medium,
Poppins_600SemiBold,
Poppins_700Bold,
});
useEffect(() => {
async function prepare() {
await SplashScreen.preventAutoHideAsync();
}
prepare();
}, []);
const onLayout = useCallback(async () => {
if (fontsLoaded) {
await SplashScreen.hideAsync();
}
}, [fontsLoaded]);
if (!fontsLoaded) return null;
return (
<SafeAreaView style={{ flex: 1 }} onLayout={onLayout}>
<NavigationContainer>
<StatusBar barStyle={"dark-content"} backgroundColor="#FFF" />
<Routes />
</NavigationContainer>
</SafeAreaView>
);
}
export default App;