I am fairly new to react native and I am trying to render json data on the android emulator, however, I am getting an error which I have no idea about. Will appreciate any help I can get.
-
the json data where do you keep that.Husain Khanbahadur– Husain Khanbahadur2018-10-01 08:32:07 +00:00Commented Oct 1, 2018 at 8:32
-
Make a const for the json data and export it from that file and then import it in the file where you want to use.Husain Khanbahadur– Husain Khanbahadur2018-10-01 08:33:23 +00:00Commented Oct 1, 2018 at 8:33
-
hey @knevagi, it would be really easy to help you if you can share your code on the snack.expo.ioDima Portenko– Dima Portenko2018-10-01 08:44:44 +00:00Commented Oct 1, 2018 at 8:44
Add a comment
|
1 Answer
Could you replace your class code in LibraryList.js with this?
class LibraryList extends Component {
renderRow(library) {
return <ListItems library={library} />;
}
render() {
return(
<FlatList
data={this.props.libraries}
renderItem={({item}) => <Text>{item.title}</Text>}
keyExtractor={item => item.title}
/>
);
}
}
2 Comments
Knevagi
Oh man that worked. Thank you so much. Can you please explain what you did?
Fatih Bulut
ListView is no longer used. You should use FlatList instead. facebook.github.io/react-native/docs/flatlist