-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
49 lines (44 loc) · 1.12 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
42
43
44
45
46
47
48
49
import {
Montserrat_300Light,
Montserrat_400Regular,
Montserrat_700Bold,
} from '@expo-google-fonts/montserrat';
import { loadAsync } from 'expo-font';
import { hideAsync, preventAutoHideAsync } from 'expo-splash-screen';
import { useCallback, useEffect, useState } from 'react';
import { StatusBar, View } from 'react-native';
import 'react-native-gesture-handler';
import Main from './src/screens/Main';
export default function App() {
const [appIsReady, setAppIsReady] = useState(false);
useEffect(() => {
(async () => {
try {
await preventAutoHideAsync();
await loadAsync({
Montserrat_300Light,
Montserrat_400Regular,
Montserrat_700Bold,
});
} catch {
// handle error
} finally {
setAppIsReady(true);
}
})();
}, []);
const onLayout = useCallback(() => {
if (appIsReady) {
hideAsync();
}
}, [appIsReady]);
if (!appIsReady) {
return null;
}
return (
<View onLayout={onLayout} style={{ flex: 1 }}>
<StatusBar translucent backgroundColor="transparent" />
<Main />
</View>
);
}