1 | import { AppLoading, Asset } from 'expo';
|
2 | import React from 'react';
|
3 | import { StyleSheet, View } from 'react-native';
|
4 | import { connect } from 'react-redux';
|
5 | import { Ionicons } from '@expo/vector-icons';
|
6 |
|
7 | @connect()
|
8 | class App extends React.Component {
|
9 | state = { assetsAreLoaded: false };
|
10 |
|
11 | componentDidMount() {
|
12 | this._loadAssetsAsync().done();
|
13 | }
|
14 |
|
15 | render() {
|
16 | if (!this.state.assetsAreLoaded) {
|
17 | return <AppLoading />;
|
18 | } else {
|
19 | return (
|
20 | <View style={styles.container}>
|
21 | <Ionicons name="md-options" size={28} />
|
22 | </View>
|
23 | );
|
24 | }
|
25 | }
|
26 |
|
27 | async _loadAssetsAsync() {
|
28 | try {
|
29 | await Asset.loadAsync([require('./assets/icon.png')]);
|
30 | } finally {
|
31 | this.setState({ assetsAreLoaded: true });
|
32 | }
|
33 | }
|
34 |
|
35 | _handleEventAsync = async ({ nativeEvent, type = 'Event' }) => {
|
36 | console.log(type);
|
37 | for (let item of nativeEvent.collection) {
|
38 | console.log(item);
|
39 | }
|
40 | };
|
41 | }
|
42 |
|
43 | export default App;
|
44 |
|
45 | const styles = StyleSheet.create({
|
46 | container: {
|
47 | flex: 1,
|
48 | },
|
49 | });
|