-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
84 lines (77 loc) · 3.44 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
import React from 'react';
import {StyleSheet, View,Image} from 'react-native';
import {AppLoading, Asset, Font} from 'expo'
import {Root} from './app/config/Route';
console.disableYellowBox = true;
function cacheImages(images) {
return images.map(image => {
if (typeof image === 'string') {
return Image.prefetch(image);
} else {
return Asset.fromModule(image).downloadAsync();
}
});
}
export default class App extends React.Component {
state = {
isReady: false,
};
async _loadResourcesAsync () {
const imageAssets = cacheImages([
'https://cdn4.iconfinder.com/data/icons/business-conceptual-part1-1/513/business-woman-512.png',
'https://tiraerasdereggaeton.com/wp-content/uploads/2018/03/avatar-user-boy-389cd1eb1d503149-512x512.png',
'https://freeiconshop.com/wp-content/uploads/edd/bulb-curvy-flat.png',
'https://cdn.dribbble.com/users/285475/screenshots/4550443/presto_walk.gif',
'https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png',
"https://static1.squarespace.com/static/51277219e4b08376dc025505/t/55f17df3e4b0d3922cc4c416/1441889779581/?format=300w",
"http://yourdost-blog-images.s3-ap-southeast-1.amazonaws.com/wp-content/uploads/2016/01/03170233/cute-cat.jpg",
"https://images.unsplash.com/10/wii.jpg?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=592b3b24ffafc20dbe8b0a1df97ef5c6&w=1000&q=80",
"http://www.nebrija.com/medios/actualidadnebrija/wp-content/uploads/sites/2/2016/11/bbva-educacion-1920x0-c-f-787x459.jpg",
"https://st.depositphotos.com/2185383/4533/v/950/depositphotos_45330093-stock-illustration-cinema-concept.jpg",
"http://www.youthvillage.co.za/wp-content/uploads/2014/10/football-fiesta-salisbury.jpg",
"https://optinmonster.com/wp-content/uploads/2016/03/Reduce-Shopping-Cart-Abandonment.png",
"https://www.rd.com/wp-content/uploads/2017/10/02_Fruit_Healthy-Holiday-Food-Gifts-Instead-of-Fruit-Cake_632353679-Avdeyukphoto-760x506.jpg",
require('./assets/image/initiateSmall.gif'),
require('./assets/image/colorful.jpg'),
require('./assets/image/square.png'),
require('./assets/image/walk_small.gif'),
require('./assets/image/finished.gif'),
require('./assets/image/login-bg.jpg'),
]);
await Promise.all([
...imageAssets, Font.loadAsync({
'regular':require('./assets/fonts/Montserrat-Regular.ttf'),
'light':require('./assets/fonts/Montserrat-Light.ttf'),
'bold': require('./assets/fonts/Montserrat-Bold.ttf')
}),
]);
};
_handleLoadingError = error => {
console.warn(error);
};
_handleFinishLoading = () => {
this.setState({ isLoadingComplete: true });
};
render() {
if (!this.state.isLoadingComplete) {
return (
<AppLoading
startAsync={this._loadResourcesAsync}
onError={this._handleLoadingError}
onFinish={this._handleFinishLoading}
/>
);
} else {
return (
<View style={styles.container}>
<Root/>
</View>
);
}
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
},
});