feat: support running in background (paused) state#103
feat: support running in background (paused) state#103gustavo-bonfim wants to merge 2 commits intoSimonErm:masterfrom
Conversation
|
Hello @GustavoBonfimS, |
|
It's hard to say whether it's a bug or a feature; the only documentation I found was this: However, I found people experiencing issues with timers:
I created a sample project to test the timers in a more isolated way: In the tests, it was possible to identify that setInterval works differently on iOS and Android. Android: Teste.Android.mp4ios: rn-timers-test-ios.movMy team and I faced issues with this library in the following scenario: I'll be willing to help with more tests. |
|
Thank ou for the detailed description :-) |
Context
React Native has a limitation where setTimeout does not run while the app is in the "background" state (paused but not completely closed). This issue affects the task queue, causing tasks to execute only when the app returns to the "active" state.
Solution
This Pull Request adds a check for the app's state before using setTimeout. If the app is in the "background" state, the function is executed immediately, ensuring the task queue works correctly.