onRefresh function Example

suggest change
_refreshListView(){
  //Start Rendering Spinner
  this.setState({refreshing:true})
  this.state.cars.push(
    {name:'Fusion',color:'Black'},
    {name:'Yaris',color:'Blue'}
  )
  //Updating the dataSource with new data
  this.setState({ dataSource:
      this.state.dataSource.cloneWithRows(this.state.cars) })
  this.setState({refreshing:false}) //Stop Rendering Spinner
}

This updates the array and then the data source. A real refresh should request data (for example with the Fetch API, including async/await) and set refreshing to false when that request finishes. These two setState calls run immediately, so the spinner may never appear.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents