I found similar questions but nothing works. If I click a list item I get error "undefined is not a function this.state.datasource.slice()"
I try to make all "ordered" true
I found similar questions but nothing works. If I click a list item I get error "undefined is not a function this.state.datasource.slice()"
I try to make all "ordered" true
Assuming you really want to slice your array -> Try:
this.state.dataSource.slice(1,2)
according to this you have to define a beginning and an end to slice like so:
arr.slice([begin[, end]])
If you looked at the ListView
documentation, when you initialize the dataSource
for your ListView
component, you can supply a method that tells the ListView
if the dataSource
has changed, so that the ListView
will re-render.
constructor() {
super();
const ds = new ListView.DataSource({rowHasChanged: (e1, e2) => e1 !== e2});
this.state = {
dataSource: ds.cloneWithRows([/* initial data */]),
};
}