When I use
const onRefresh = () => {
setRefreshing(true);
setTimeout(() => {
setRefreshing(false);
}, 2000);
};
with RefreshControl in Scroll View and then I get change the page in the middle of refreshing, I get the error below. Normally I can fix this error with a useEffect hook but I can't seem to get it working in any way. Any ideas on how to fix this?
Warning: Can't perform a React state update on an unmounted component.
This is a no-op, but it indicates a memory leak in your application.
To fix, cancel all subscriptions and asynchronous tasks in a useEffect cleanup function.