-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
53 lines (47 loc) · 1.45 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
50
51
52
53
import 'react-native-gesture-handler';
import React,{useCallback} from 'react';
import { StatusBar } from 'expo-status-bar';
import { StyleSheet, View } from 'react-native';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import Constants from 'expo-constants';
import RootNavigator from './src/navigations/RootNavigator';
import { AuthProvider } from './src/store/auth/AuthContext';
import { PokemonProvider } from './src/store/pokemon/PokemonContext';
import { useFonts } from 'expo-font';
import * as SplashScreen from 'expo-splash-screen';
import FONTS from './assets/fonts';
import Compose from './src/utils/Compose';
SplashScreen.preventAutoHideAsync();
export default function App() {
const [fontsLoaded] = useFonts(FONTS);
const onLayoutRootView = useCallback(async () => {
if (fontsLoaded) {
await SplashScreen.hideAsync();
}
}, [fontsLoaded]);
if (!fontsLoaded) {
return null;
}
return (
<Compose components={[AuthProvider, PokemonProvider]}>
<SafeAreaProvider onLayout={onLayoutRootView}>
<View style={styles.container}>
<StatusBar style="auto" />
<RootNavigator />
</View>
</SafeAreaProvider>
</Compose>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
paddingTop: Constants.statusBarHeight,
},
innerContainer: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});