-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathApp.tsx
41 lines (31 loc) · 1 KB
/
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
37
38
39
40
41
import { useCallback, useEffect, useState } from "react";
import { useFonts } from "expo-font";
import * as SplashScreen from "expo-splash-screen";
import {
Poppins_400Regular, Poppins_700Bold,
} from "@expo-google-fonts/poppins";
import Laudiolin from "@app/Laudiolin";
function App() {
const [loaded, setLoaded] = useState(false);
const [rendered, setRendered] = useState(false);
// Load app assets & fonts.
const [fontsLoaded] = useFonts({
Poppins_400Regular,
Poppins_700Bold
});
// Wait for our fonts to load.
useEffect(() => {
if (fontsLoaded) setLoaded(true);
}, [fontsLoaded]);
// Hide splash screen when the app is done loading.
const onLoad = useCallback(async() => {
if (rendered) return;
if (loaded) {
await SplashScreen.hideAsync();
setRendered(true);
}
}, [loaded]);
return loaded ? <Laudiolin onLoad={onLoad} /> : null;
}
// noinspection JSUnusedGlobalSymbols
export default App;