-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
65 lines (59 loc) · 2.31 KB
/
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import 'react-native-gesture-handler';
import { NavigationContainer } from '@react-navigation/native';
import { useFonts } from 'expo-font';
import * as SplashScreen from 'expo-splash-screen';
import { StatusBar } from 'expo-status-bar';
import { useCallback } from 'react';
import { StyleSheet } from 'react-native';
import { SafeAreaView, SafeAreaProvider } from 'react-native-safe-area-context';
import { Provider } from 'react-redux';
import { Palette } from './constants/Colors';
import MainStack from './navigators/MainStack';
import store from './store';
export default function App() {
/*
This part fetching fonts from assets, and then hiding splash screen
*/
const [fontsLoaded] = useFonts({
'Gordita-Regular': require('./assets/fonts/GorditaRegular.otf'),
'Gordita-Regular-Italic': require('./assets/fonts/GorditaRegularItalic.otf'),
'Gordita-Black': require('./assets/fonts/GorditaBlack.otf'),
'Gordita-Black-Italic': require('./assets/fonts/GorditaBlackItalic.otf'),
'Gordita-Bold': require('./assets/fonts/GorditaBold.otf'),
'Gordita-Bold-Italic': require('./assets/fonts/GorditaBoldItalic.otf'),
'Gordita-Light': require('./assets/fonts/GorditaLight.otf'),
'Gordita-Light-Italic': require('./assets/fonts/GorditaLightItalic.otf'),
'Gordita-Medium': require('./assets/fonts/GorditaMedium.otf'),
'Gordita-Medium-Italic': require('./assets/fonts/GorditaMediumItalic.otf'),
'Gordita-Thin': require('./assets/fonts/GorditaThin.otf'),
'Gordita-Thin-Italic': require('./assets/fonts/GorditaThinItalic.otf'),
'Gordita-Ultra': require('./assets/fonts/GorditaUltra.otf'),
'Gordita-Ultra-Italic': require('./assets/fonts/GorditaUltraItalic.otf'),
});
const onLayoutRootView = useCallback(async () => {
if (fontsLoaded) {
await SplashScreen.hideAsync();
}
}, [fontsLoaded]);
if (!fontsLoaded) {
return null;
}
return (
<Provider store={store}>
<SafeAreaProvider>
<SafeAreaView style={styles.container} onLayout={onLayoutRootView}>
<StatusBar style="dark" />
<NavigationContainer>
<MainStack />
</NavigationContainer>
</SafeAreaView>
</SafeAreaProvider>
</Provider>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: Palette.yellow,
},
});