-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
69 lines (61 loc) · 1.62 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
import React from 'react';
import { Asset, AppLoading, Font, Constants } from 'expo';
import { Platform, View, StatusBar } from 'react-native';
import { Ionicons } from '@expo/vector-icons';
import { loadSavedTalksAsync, loadAuthenticationAsync } from './src/utils/storage';
import Navigation from './src/Navigation';
import Home from './src/screens/Home';
const theme = {
font: {
primary: 'open-sans-bold',
},
colors: {
main: '#1dafec',
},
};
export default class App extends React.Component {
state = {
fontLoaded: false,
};
_loadResourcesAsync = () => {
return Promise.all([
this._loadAssetsAsync(),
this._loadDataAsync(),
])
}
_loadDataAsync = () => {
return loadSavedTalksAsync();
}
_loadAssetsAsync = async () => {
return Promise.all([
Font.loadAsync({
'open-sans-bold': require('./src/assets/OpenSans-Bold.ttf'),
'open-sans': require('./src/assets/OpenSans-Regular.ttf'),
'open-sans-semibold': require('./src/assets/OpenSans-SemiBold.ttf'),
...Ionicons.font,
}),
Asset.fromModule(require('./src/assets/logo.png')).downloadAsync(),
Asset.fromModule(
require('react-navigation/src/views/assets/back-icon.png')
).downloadAsync(),
]);
};
render() {
if (!this.state.fontLoaded) {
return (
<AppLoading
startAsync={this._loadResourcesAsync}
onError={console.error}
onFinish={() => {
this.setState({ fontLoaded: true });
}}
/>
);
}
return (
<View style={{ flex: 1 }}>
<Navigation />
</View>
);
}
}