-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
74 lines (50 loc) · 1.48 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import React, { useState, useEffect } from 'react';
import { Platform, SafeAreaView, StatusBar, StyleSheet } from 'react-native';
import MainTabNav from './src/navigation/tabNavigator'
import { AppLoading } from 'expo';
import { useFonts } from 'expo-font';
import * as Font from 'expo-font';
import DatabaseManager from './src/database/DatabaseManager'
import { initializeAllSettings } from './src/services/storage/settingsAsyncStorage';
let customFonts = {
'Arial': require('./src/assets/fonts/arial.ttf'),
}
interface iState {
fontsLoaded: boolean;
}
interface IProps {
}
export default class App extends React.Component<IProps, iState> {
constructor(props: IProps) {
super(props);
this.state = {
fontsLoaded: false,
}
}
async _loadFontsAsync() {
await Font.loadAsync(customFonts);
this.setState({ fontsLoaded: true });
}
componentDidMount() {
this._loadFontsAsync();
initializeAllSettings();
DatabaseManager.initializeDatabase();
}
render() {
if (!this.state.fontsLoaded) {
return <AppLoading />;
} else {
return (
<SafeAreaView style={styles.container}>
<MainTabNav />
</SafeAreaView >
)
}
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
//marginTop: Platform.OS === "android" ? StatusBar.currentHeight : 0
}
});