This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathApp.tsx
45 lines (40 loc) · 1.53 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
import { useFonts } from 'expo-font';
import * as SplashScreen from 'expo-splash-screen';
import { useCallback } from 'react';
import 'react-native-gesture-handler';
import { ThemeProvider } from 'styled-components/native';
import Routes from './src/routes';
import theme from './src/stylesheets/theme';
import { AppWrapper } from './AppStyles';
import { UserContextProvider } from './src/context/UserContext';
SplashScreen.preventAutoHideAsync();
export default function App() {
const [fontsLoaded] = useFonts({
'Inter-Black': require('./assets/fonts/Inter/Inter-Black.ttf'),
'Inter-Bold': require('./assets/fonts/Inter/Inter-Bold.ttf'),
'Inter-ExtraBold': require('./assets/fonts/Inter/Inter-ExtraBold.ttf'),
'Inter-ExtraLight': require('./assets/fonts/Inter/Inter-ExtraLight.ttf'),
'Inter-Light': require('./assets/fonts/Inter/Inter-Light.ttf'),
'Inter-Medium': require('./assets/fonts/Inter/Inter-Medium.ttf'),
'Inter-Regular': require('./assets/fonts/Inter/Inter-Regular.ttf'),
'Inter-SemiBold': require('./assets/fonts/Inter/Inter-SemiBold.ttf'),
'Inter-Thin': require('./assets/fonts/Inter/Inter-Thin.ttf')
});
const onLayoutRootView = useCallback(async () => {
if (fontsLoaded) {
await SplashScreen.hideAsync();
}
}, [fontsLoaded]);
if (!fontsLoaded) {
return null;
}
return (
<AppWrapper onLayout={onLayoutRootView}>
<ThemeProvider theme={theme}>
<UserContextProvider>
<Routes />
</UserContextProvider>
</ThemeProvider>
</AppWrapper>
);
}