Try new ListView.DataSource({ rowHasChanged: (row1, row2) => row1 !== row2 up new ListView.DataSource({ rowHasChanged: (row1, row2) => row1 !== row2 outside the component:
var ds = new ListView.DataSource({ rowHasChanged: (row1, row2) => row1 !== row2 class MainPage extends Component { this.state = { dataSource: new ListView.DataSource({ rowHasChanged: (row1, row2) => row1 !== row2, }), loaded: false, searchText: '', state: '', }; }
Then set the state as follows:
filterStates(searchText, states) { ... this.setState({ dataSource: ds.cloneWithRows(rows), loaded : true, }); }
and this:
fetchData() { fetch(REQUEST_URL) .then((response) => response.json()) .then((responseData) => { this.setState({ dataSource: ds.cloneWithRows(responseData), loaded: true, }); }) .done(); }
source share