Does the ReactNative ListView accept an array of arrays? I need to get the API data as follows:
[[{"userId":1,"userName":"Ricardo"},{"userId":1,"userName":"Ricardo"}],[{"userId":1,"userName":"Ricardo"},{"userId":1,"userName":"Ricardo"}]].
I made the following code to display it:
renderRowUsers(rowData, sectionID, rowID) {
return rowData.map(function(user, i){
return(
<View key={i}>
<Text>{user.userId}</Text>
<View>
<Text>{user.userName}</Text>
</View>
</View>
);
});
}
and
const usersDS = new ListView.DataSource({
rowHasChanged: (r1, r2) => r1.user !== r2.user
});
this.state = {
usersDataSource: usersDS.cloneWithRows([{
"userId": "",
"userName": "Ricardo"
}])
}
<ListView
style={{paddingTop: 2, height:100}}
dataSource={this.state.usersDataSource}
renderRow={this.renderRowUsers.bind(this)}
/>
But this returns me the following error:
"StaticRender.reder (): A valid React element (or null) must be returned. have returned undefined, an array or some other invalid object. "