Closed Freddy03h closed 1 year ago
I can confirm that I'm running into this issue as well, thinking it was a swr
issue.
If anyone runs into the issue, you can just polyfill it with something like this for now:
window.requestIdleCallback =
function(cb) {
var start = Date.now();
return setTimeout(function() {
cb({
didTimeout: false,
timeRemaining: function() {
return Math.max(0, 50 - (Date.now() - start));
},
});
}, 1);
};
Taken from https://github.com/pladaria/requestidlecallback-polyfill, but the package itself won't work since window.requestIdleCallback
is defined by react-native
. So you just have to remove that if.
@Freddy03h @svenlombaert I have found the issue that's causing this and submitted a PR to fix it. It's easy to fix this yourself using patch-package.
I hope this can get fixed? It's pretty confusing that the function is defined and everything seems right, but then the code just stops executing when we try to use the function. Took me a bit to realize what the issue was since it works fine on Android.
I don't know about to following of the issue, I stoped using requestIdleCallback
Bump. Any movement on this?
requestIdleCallback
isn't supported on iOS, but in that case I would expect React Native would have a dummy function to run, rather than halting execution permanently at the call to window.requestIdleCallback()
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.
This issue was closed because it has been stalled for 7 days with no activity.
Just wondering is there any update on this in Hermes? Can we run requestIdleCallback on iOS yet?
It appears that the fix was merged in https://github.com/facebook/react-native/pull/29895 but I'm not sure which release will contain it. cc @sammy-SC
It appears that the fix was merged in #29895 but I'm not sure which release will contain it. cc @sammy-SC
@gaearon This (https://github.com/facebook/react-native/commit/72abed2c96d65769567e2b7e492764c1a58e6e81) will be shipped in 0.73 (it's already included in rc0-rc3)
Description
requestIdleCallback
is never called on iOS. On a debug or release mode the behavior is the same. On Android it still work as expected. The only way forrequestIdleCallback
to be called on iOS is by providing an timeout option (but all called ofrequestIdleCallback
will be withdidTimeout
…).It's a regression in 0.62.X, it worked well on 0.61.5 (and since, at least, 0.47.X on my own app).
React Native version:
Steps To Reproduce
Expected Results
Expect to
requestIdleCallback
work as expected.Snack, code example, screenshot, or link to a repository:
Expo/Snack is not yet on 0.62, the best way is to create a new project with react native cli or by cloning https://github.com/react-native-community/rn-diff-purge/tree/release/0.62.2/RnDiffApp
Thank you