const uri = 'https://instalura-api.herokuapp.com/api/fotos';
//const uri = 'https://instalura-api.herokuapp.com/api/public/fotos/rafael';
return AsyncStorage.getItem('token')
.then(token => {
fetch(uri,
method = 'GET',
headers = {
'Content-Type': 'application/json',
'X-AUTH-TOKEN': token })
.then((response) => response.json())
.then((responseJson) => {
this.setState({
data: responseJson
}, function () {
});
})
.catch((error) => {
console.error(error);
});
});
}
//
<FlatList keyExtractor={(item) => String(item.id)} // ERRO AQUI
data={this.state.data}
renderItem={({ item }) =>
<Post foto={item}
likeCallback={this.like.bind(this)}
comentarioCallback={this.adicionaComentario.bind(this)}
/>
} />