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 calling beginSheet more times than we call endSheet. 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 calling beginSheet 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 the beginSheet 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:
Release the sheet window when closed. I don't think there's any benefit keeping it around, especially if we're already nilling it out in hide.
Set the font of the label to be the same as iOS.
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.
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.