Skip to content

Instantly share code, notes, and snippets.

@faustoct1
Last active May 14, 2019 05:34
Show Gist options
  • Save faustoct1/224de444788e4292f570f8508709e3ff to your computer and use it in GitHub Desktop.
Save faustoct1/224de444788e4292f570f8508709e3ff to your computer and use it in GitHub Desktop.
import React, { Component } from 'react';
import { FlatList, View, Text } from 'react-native';
class List extends Component {
/*
essa abordagem ajuda carregar componentes mais rapido de forma async ao msm tempo q List inicializa :)
*/
initAsync = async () => {
}
constructor(props) {
super(props)
this.initAsync()
}
componentWillUnmount = async () => {
}
componentDidMount = async () => {
}
render = () => {
return (
<View style={flex:1,height:'100%'}>
<FlatList
keyExtractor={(item, index) => index}
data={[1,2,3,4,5]}
renderItem={({item,index}) => <View><Text>{item}</Text></View>}
}} />
</View>
)
}
}
});
export default List;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment