fix: Properly dismiss RCTDevLoadingView #2211
Merged
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.
Summary:
This is attempt #2 to fix issues with the refactor of RCTDevLoadingView , the first being #2201 . Namely, the RCTDevLoadingView sheet doesn't always dismiss, and sticks around blocking the app.
This PR addresses two main things:
React Native seems to not balance its' own calls to
[RCTDevLoadingView showMessage]
and[RCTDevLoadingView hide]
. As a result, we might end up callingbeginSheet
more times than we callendSheet
. My theory is we're ending up with multiple sheets/modals, which is why the sheet is sticking around. We can fix this by only callingbeginSheet
if we aren't already presented.Digging around a couple of places in StackOverflow, it seems it's also important to call
[mySheetWindow orderOut:]
I thebeginSheet
completion handler to make the sheet go away. In my testing, this seems to be true.While we're here, let's fix a couple of nits:
hide
.Test Plan:
Launching the app a bunch of times (sometimes with breakpoints set to interrupt the flow), I seem to not have the sheet stick around. Of course this is intermittent, so it's not a definitive test.