-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
executable file
·52 lines (46 loc) · 1.15 KB
/
main.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
import Expo from 'expo';
import React, { Component } from 'react';
import { Provider as ReduxProvider } from 'react-redux';
import AppComponent from './app';
import Store from './reducers';
import { FontAwesome } from '@expo/vector-icons';
import cacheAssetsAsync from './utilities/cacheAssetsAsync';
class AppContainer extends Component {
state = {
appIsReady: false,
}
componentWillMount() {
this._loadAssetsAsync();
}
async _loadAssetsAsync() {
try {
await cacheAssetsAsync({
images: [
],
fonts: [
FontAwesome.font,
],
});
} catch (e) {
console.warn(
'There was an error caching assets (see: main.js), perhaps due to a ' +
'network timeout, so we skipped caching. Reload the app to try again.'
);
console.log(e.message);
} finally {
this.setState({ appIsReady: true });
}
}
render() {
if (this.state.appIsReady) {
return (
<ReduxProvider store={Store}>
<AppComponent />
</ReduxProvider>
);
} else {
return <Expo.AppLoading />;
}
}
}
Expo.registerRootComponent(AppContainer);