-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
60 lines (53 loc) · 1.77 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
import React, { useCallback, useEffect } from 'react';
import { StyleSheet } from 'react-native';
import { PaperProvider } from 'react-native-paper';
import { MainNavigation } from './src/navigation';
import { useFonts } from 'expo-font';
import * as SplashScreen from 'expo-splash-screen';
import { Provider } from 'react-redux';
import store from './src/store';
import { initSQLiteDB } from './src/persistence';
/* Database initialization */
(async () => {
try {
const response = await initSQLiteDB();
} catch (error) {}
})();
export default function App() {
const [fontsLoaded, fontError] = useFonts({
'Poppins-Black': require('./assets/fonts/Poppins-Black.ttf'),
'Poppins-SemiBold': require('./assets/fonts/Poppins-SemiBold.ttf'),
'Poppins-ExtraBold': require('./assets/fonts/Poppins-ExtraBold.ttf'),
'Poppins-ExtraLight': require('./assets/fonts/Poppins-ExtraLight.ttf'),
'Poppins-Light': require('./assets/fonts/Poppins-Light.ttf'),
'Poppins-Medium': require('./assets/fonts/Poppins-Medium.ttf'),
'Poppins-Regular': require('./assets/fonts/Poppins-Regular.ttf'),
'Poppins-Bold': require('./assets/fonts/Poppins-Bold.ttf'),
'Poppins-Thin': require('./assets/fonts/Poppins-Thin.ttf'),
});
const onLayoutRootView = useCallback(async () => {
if (fontsLoaded || fontError) {
await SplashScreen.hideAsync();
}
}, [fontsLoaded, fontError]);
if (!fontsLoaded || fontError) {
return null;
}
if (fontsLoaded && !fontError) {
return (
<Provider store={store}>
<PaperProvider>
<MainNavigation />
</PaperProvider>
</Provider>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});