fix: iOS app crash when UI manager isn't ready #1795
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Please read and mark the following check list before creating a pull request:
I read and followed the CONTRIBUTING.md guide.
I read and followed the New Feature Checklist guide.
Short description of what this resolves:
Calling
UIManager.measureInWindow
can throw an exception and crash the app if the UIManager isn't defined yet (seenullthrows
in the react native code). I have not been able to reproduce this directly, but have been getting a handful of app crash reports per day that point to this (see stack trace below).My proposed solution is to catch the exception and then try again after a short delay. The delay is to prevent a possible infinite loop slowing down the app.
Stack trace