-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
38 lines (31 loc) · 1008 Bytes
/
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
import React, { useState, useCallback } from 'react';
import { NavigationContainer } from '@react-navigation/native';
import Routes from './src/routes';
import { AppLoading } from 'expo';
import * as Font from 'expo-font';
console.disableYellowBox = true;
export default function App() {
const [isLoading, setIsLoading] = useState(true);
const onFinish = useCallback(() => {
setIsLoading(false);
}, [setIsLoading]);
const loadCustomFonts = useCallback(async () => {
setIsLoading(true);
return await Font.loadAsync({
'Poppins-Light': require('./assets/fonts/Poppins-Light.ttf'),
'Poppins-Regular': require('./assets/fonts/Poppins-Regular.ttf'),
'Poppins-Bold': require('./assets/fonts/Poppins-Bold.ttf'),
});
}, [setIsLoading]);
return (
<>
{isLoading ? (
<AppLoading startAsync={loadCustomFonts} onFinish={onFinish} />
) : (
<NavigationContainer>
<Routes />
</NavigationContainer>
)}
</>
);
}