react native flatlist pull to refresh 1

react native flatlist pull to refresh

// Make sure to also set the refreshing prop correctly.
 this.onRefresh()}
  	refreshing={this.state.isFetching}
/>

Here is what the above code is Doing:
1. We’re setting the refreshing prop to a state variable isFetching.
2. When the pull to refresh is activated, we set isFetching to true, which will show the loading indicator.
3. We then wait one second and after that, we set isFetching back to false and load new data into our FlatList.

Similar Posts