Skip to content

Instantly share code, notes, and snippets.

@Yassir4
Created September 15, 2020 08:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Yassir4/d31e4b94fc317fbfdd2f84b28fb33022 to your computer and use it in GitHub Desktop.
Save Yassir4/d31e4b94fc317fbfdd2f84b28fb33022 to your computer and use it in GitHub Desktop.
Repositories
// add this
const refreshing = networkStatus === NetworkStatus.refetch
// prevent the loading indicator from appearing while refreshing
if (loading && repositories.length === 0 && !refreshing)
return (
<View style={styles.loading}>
<ActivityIndicator size="large" color="rgb(0, 122, 255)" />
</View>
)
// then add proper props to flatlist
<FlatList
...
onRefresh={refetch}
refreshing={refreshing} // to display the pull refresh indicator
/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment