Skip to content
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

fix: iOS app crash when UI manager isn't ready #1795

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jgillick
Copy link

@jgillick jgillick commented Dec 1, 2023

Please read and mark the following check list before creating a pull request:

Short description of what this resolves:

Calling UIManager.measureInWindow can throw an exception and crash the app if the UIManager isn't defined yet (see nullthrows 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

Error Got unexpected undefined 
    Users/runner/work/together/together/packages/dating-app/node_modules/nullthrows/nullthrows.js:7:23 nullthrows
    Users/runner/work/together/together/packages/dating-app/node_modules/react-native/Libraries/ReactNative/UIManager.js:88:40 measureInWindow
    Users/runner/work/together/together/packages/dating-app/node_modules/@ui-kitten/components/devsupport/components/measure/measure.component.js:60:48 measureSelf
    Users/runner/work/together/together/packages/dating-app/node_modules/@ui-kitten/components/devsupport/components/measure/measure.component.js:50:23 onUIManagerMeasure
    (native) apply
    Users/runner/work/together/together/packages/dating-app/node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:474:12 __invokeCallback
    Users/runner/work/together/together/packages/dating-app/node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:124:27 anonymous
    Users/runner/work/together/together/packages/dating-app/node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:368:10 __guard
    Users/runner/work/together/together/packages/dating-app/node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:123:16 invokeCallbackAndReturnFlushedQueue

@jgillick jgillick changed the title Prevent crash if UI manager isn't ready yet. fix: app crash when UI manager isn't ready Dec 1, 2023
@jgillick jgillick changed the title fix: app crash when UI manager isn't ready fix: iOS app crash when UI manager isn't ready Dec 1, 2023
@jgillick
Copy link
Author

jgillick commented Dec 1, 2023

FYI, this PR seems to be a duplicate of #1752 and #1790, but resolves it differently.

Feel free to close this if you prefer the other solutions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant