-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
67 lines (58 loc) · 2.04 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, {Component} from 'react';
import '@tensorflow/tfjs-react-native';
import {Provider} from "react-redux"
import {getRedux, initStore} from "./store/storeInit";
import {AppLoading} from 'expo';
import {Ionicons} from '@expo/vector-icons';
import * as Font from 'expo-font';
import MainScreenManager from "./views/MainScreenManager";
export default class App extends Component {
constructor(props) {
super(props);
this.state = {
isLoadingComplete: false,
};
}
_loadResourcesAsync = async () => {
return Promise.all([
Font.loadAsync({
...Ionicons.font,
Roboto: require("native-base/Fonts/Roboto.ttf"),
Roboto_medium: require("native-base/Fonts/Roboto_medium.ttf"),
Ionicons: require("native-base/Fonts/Ionicons.ttf"),
MaterialCommunityIcons: require("native-base/Fonts/MaterialCommunityIcons.ttf"),
BigStomach: require("./assets/fonts/Big-Stomach.ttf"),
Monospace: require("./assets/fonts/monospace.medium.ttf"),
MonospaceBold: require("./assets/fonts/monospace.bold.ttf"),
}),
initStore()
])
};
_handleLoadingError = error => {
// In this case, you might want to report the error to your error
// reporting service, for example Sentry
console.error(error)
};
_handleFinishLoading = () => {
this.setState({isLoadingComplete: true})
}
render() {
if (!this.state.isLoadingComplete) {
return (
<>
<AppLoading
startAsync={this._loadResourcesAsync}
onError={this._handleLoadingError}
onFinish={this._handleFinishLoading}
/>
</>
)
} else {
return (
<Provider store={getRedux()}>
<MainScreenManager/>
</Provider>
)
}
}
}