forked from Chattahooligans/hooligan-hymnal-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
85 lines (75 loc) · 2.09 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import React from 'react';
import { AppLoading } from 'expo';
import { Asset } from 'expo-asset';
import * as Font from 'expo-font';
import { Platform, View, StatusBar, YellowBox } from 'react-native';
import { Ionicons } from '@expo/vector-icons';
import { Provider } from 'unstated';
import { loadSavedTalksAsync } from './src/utils/storage';
import Navigation from './src/Navigation';
import Home from './src/screens/Home';
import imagesArray from './assets';
YellowBox.ignoreWarnings(['Warning: bind()']);
const theme = {
font: {
primary: 'open-sans-bold'
},
colors: {
main: '#A3D8F7'
}
};
class App extends React.Component {
state = {
errorMessage: null,
fontLoaded: false
};
_loadResourcesAsync = () => {
return Promise.all([this._loadAssetsAsync(), this._loadDataAsync()]);
};
_loadDataAsync = () => {
return loadSavedTalksAsync();
};
/*
'open-sans-bold': require('./assets/OpenSans-Bold.ttf'),
'open-sans': require('./assets/OpenSans-Regular.ttf'),
'open-sans-semibold': require('./assets/OpenSans-SemiBold.ttf'),
*/
_loadAssetsAsync = async () => {
return Promise.all([
Font.loadAsync({
'heebo-light': require('./assets/Heebo-Light.ttf'),
'heebo': require('./assets/Heebo-Regular.ttf'),
'heebo-medium': require('./assets/Heebo-Medium.ttf'),
'heebo-bold': require('./assets/Heebo-Bold.ttf'),
...Ionicons.font
}),
Asset.loadAsync(imagesArray),
Asset.fromModule(
require('react-navigation/src/views/assets/back-icon.png')
).downloadAsync()
]);
};
render() {
const { fontLoaded } = this.state;
if (!fontLoaded) {
return (
<AppLoading
startAsync={this._loadResourcesAsync}
onError={console.error}
onFinish={() => {
this.setState({ fontLoaded: true });
}}
/>
);
}
return (
<Provider>
<View style={{ flex: 1 }}>
<Navigation />
<StatusBar barStyle="light-content" />
</View>
</Provider>
);
}
}
export default App;