-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Android: Timers do not run if specified before App mounts #22089
Comments
Just out of curiosity, what exactly is the use case for this? I thought the |
Nothing happens, like ever. No log messages or errors, the function just never gets called. It gets called immediately if you set the timeout to 0, however. We have to make a network request to determine which content pane to show users on app launch based on their remote session state... since NetInfo is also broken before React Native launches on Android I was trying to use setTimeout to handle slow network requests. On iOS, we can use NetInfo before React-Native launches to immediately display a "network required" error message and exit the application; on Android, I was trying to find a way to avoid launching all of react-native if the network request was going to fail anyway. I'm going to have to work around this by launching the application into a headless component of some sort that can use NetInfo and it is going to greatly increase the complexity of the app boot process. iOS boot looks something like: |
There are two considerations for moving this logic into an actual component instead of pre |
All of that is entirely in place already... our app is used frequently in retail stores to finance sales, so we wanted to short-circuit the loading timeout if there was no network whatsoever to save customers' time (potentially standing in line / with a retail rep). I wound up just mounting a headless component that does the check in |
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions. |
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information. |
Environment
Description
If you call
setTimeout
orsetInterval
as the very first thing in the application, before any calls to react-native itself, they will never run. They do in iOS.Reproducible Demo
Wrap your startup AppRegistry call in a setTimeout:
The text was updated successfully, but these errors were encountered: