-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
49 lines (36 loc) · 1.24 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
import { StatusBar } from 'expo-status-bar';
import { NavigationContainer } from '@react-navigation/native';
import * as SplashScreen from 'expo-splash-screen';
import { useFonts } from 'expo-font';
import { useCallback, useEffect } from 'react';
import AuthStack from './Navigators/AuthStack';
import { AppProvider } from './Providers/AppProvider';
import Authenticator from './Authenticator';
import { CartProvider } from './Providers/CartProvider';
SplashScreen.preventAutoHideAsync();
export default function App() {
const [fontsLoaded] = useFonts({
'Regular': require('./assets/fonts/Nunito-Regular.ttf'),
'Medium': require('./assets/fonts/Nunito-Medium.ttf'),
'SemiBold': require('./assets/fonts/Nunito-SemiBold.ttf'),
'Bold': require('./assets/fonts/Nunito-Bold.ttf'),
'ExtraBold': require('./assets/fonts/Nunito-ExtraBold.ttf'),
});
const onLayoutRootView = useCallback(async () => {
if (fontsLoaded) await SplashScreen.hideAsync();
}, [fontsLoaded]);
useEffect(() => {
onLayoutRootView();
});
if (!fontsLoaded) return null;
return (
<NavigationContainer>
<AppProvider>
<CartProvider>
<StatusBar style='dark' />
<Authenticator />
</CartProvider>
</AppProvider>
</NavigationContainer>
);
}