-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
61 lines (55 loc) · 1.68 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
import React, { Component } from 'react'
import { Text, View, StyleSheet } from 'react-native'
import { AppLoading } from "expo";
import { Asset } from "expo-asset";
import Navigation from "./navigation";
import { Block } from "./components";
import * as constants from "./constants";
const images = [
require('./assets/icons/back.png'),
require('./assets/icons/plants.png'),
require('./assets/icons/seeds.png'),
require('./assets/icons/flowers.png'),
require('./assets/icons/sprayers.png'),
require('./assets/icons/pots.png'),
require('./assets/icons/fertilizers.png'),
require('./assets/images/plants_1.png'),
require('./assets/images/plants_2.png'),
require('./assets/images/plants_3.png'),
require('./assets/images/explore_1.png'),
require('./assets/images/explore_2.png'),
require('./assets/images/explore_3.png'),
require('./assets/images/explore_4.png'),
require('./assets/images/explore_5.png'),
require('./assets/images/explore_6.png'),
require('./assets/images/avatar.png'),
]
export default class App extends Component {
state = {
isLoadingComplete: false,
}
handleResourcesAsync = async () => {
const cacheImages = images.map(img => {
return Asset.fromModule(img).downloadAsync();
});
return Promise.all(cacheImages);
}
render() {
if (!this.state.isLoadingComplete && !this.props.skipLoadingScreen) {
return (
<AppLoading
startAsync={this.handleResourcesAsync}
onError={console.warn}
onFinish={() => this.setState({ isLoadingComplete: true })}
/>
)
}
return (
<Block white>
<Navigation />
</Block>
)
}
}
const styles = StyleSheet.create({
})