You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm having a hard time using react-query with the react-native FlatList component.
I'm using the isFetching prop of useQuery to pass to the FlatList refreshing prop. When the FlatList is refreshed, I'm seeing a weird UI glitch where the FlatList RefreshControl shows, then hides and shows again. This UI glitch is most obvious on Android but it affects iOS too.
Here's a simple example that demonstrates the UI bug:
The above shows that if I don't immediately set isRefreshing, the FlatList component will hide the refresh control, then show it again producing the UI bug.
So it seems like react-query is using a timeout. Is there any way to disable the setTimeout when calling refetch() or queryClient.invalidateQueries() to allow me to use isFetching with the FlatList component?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi
I'm having a hard time using react-query with the react-native FlatList component.
I'm using the
isFetching
prop ofuseQuery
to pass to the FlatListrefreshing
prop. When the FlatList is refreshed, I'm seeing a weird UI glitch where the FlatList RefreshControl shows, then hides and shows again. This UI glitch is most obvious on Android but it affects iOS too.Here's a simple example that demonstrates the UI bug:
The workaround I'm using is to use a different state variable for the refreshing state, and update that state variable whenever onRefresh is called:
This workaround is pretty ridiculous but it works.
To try understand why this bug occurs with the FlatList component, I can demonstrate the issue with the following code:
The above shows that if I don't immediately set isRefreshing, the FlatList component will hide the refresh control, then show it again producing the UI bug.
So it seems like react-query is using a timeout. Is there any way to disable the setTimeout when calling
refetch()
orqueryClient.invalidateQueries()
to allow me to useisFetching
with the FlatList component?This is the query client config i'm using:
I appreciate any suggestions. thanks.
Beta Was this translation helpful? Give feedback.
All reactions