Created
September 15, 2020 08:12
-
-
Save Yassir4/d31e4b94fc317fbfdd2f84b28fb33022 to your computer and use it in GitHub Desktop.
Repositories
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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