-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
59 lines (49 loc) · 1.5 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
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { AppLoading, Asset } from 'expo';
import Navigation from './screens/Routes/AppNavigator';
import { Block } from './components';
const images = [
require('./assets/icons/dashboard.png'),
require('./assets/icons/dispatch.png'),
require('./assets/icons/user.png'),
require('./assets/icons/masterdata.png'),
require('./assets/icons/production.png'),
require('./assets/icons/tool.png'),
require('./assets/images/illustration.png'),
require('./assets/images/illustration_1.png'),
require('./assets/images/illustration_2.png'),
require('./assets/images/illustration_3.png'),
require('./assets/images/illustration_4.png'),
];
export default class App extends React.Component {
state = {
isLoadingComplete: false,
}
handleResourcesAsync = async () => {
// we're caching all the images
// for better performance on the app
const cacheImages = images.map(image => {
return Asset.fromModule(image).downloadAsync();
});
return Promise.all(cacheImages);
}
render() {
if (!this.state.isLoadingComplete && !this.props.skipLoadingScreen) {
return (
<AppLoading
startAsync={this.handleResourcesAsync}
onError={error => console.warn(error)}
onFinish={() => this.setState({ isLoadingComplete: true })}
/>
)
}
return (
<Block white>
<Navigation />
</Block>
);
}
}
const styles = StyleSheet.create({
});