I am not understanding ListView so just want to ask some questions to get a better idea of it.
In my program I have an array of dictionaries.
The dictionaries each have a title and description.
The array holding them is called partners.
I want to make a ListView that posts each title one underneath the other.
I created a constructor that looks like this (I think this is the part that is a problem)
constructor(props){
super(props)
this.ds= new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2})
this.state = {
dataSource: this.ds.cloneWithRows(partners),
}
}
Then I have a a rendow row function that looks as follows
renderRow(rowData){
return(
<View>
<Text>{rowData}</Text>
</View>
)
}
then my actual render and return function
render () {
return(
<View style={styles.mainContainer}>
<ListView
dataSource={this.dataSource}
renderRow={this.renderRow} />
</View>
)
}
Currently when I run this I get the following error
"cannot read property 'row identities' of undefined.
Thanks so much for any direction
you forgot the state in this.state.dataSource
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With