[IOS] Stuck on Splash Screen with Code Push
See original GitHub issueš» My environment
- react-native-bootsplash version: 2.2.4
- react-native version: 0.61.5
- Platform: ios
- OS version: 13.5
- Device: N/A
- Simulator: Both
- Android Studio version: N/A
- Android buildToolsVersion: N/A
- Xcode version:Ā N/A
šµļøāāļø Reproducing the issue
I do not have time to create full reproduction repo, but I was facing an issue with Code Push & RNBootsplash hence Iād like to note down my findings:
Setup:
- Setup RNBootsplash with simple usage (detail not important):
setTimeout(
() => RNBootsplash.hide({ duration: 200 }),
500,
)
- Setup RNCodePush with following config:
{
checkFrequency: RNCodePush.CheckFrequency. ON_APP_START,
updateDialog: true,
}
- Create a native build and CodePush build so that thereās an CodePush update available from the native build.
Steps and Expected Behaviour:
- Upon launch, CodePush will automatically check for update
- CodePush finds the update, and shows itās native dialog (modal) for update prompt
- While 1 & 2 is happening, RNBootsplash will hide the splash screen
- Close the App, and reopen the App
- CodePush still has context of update available, hence shows the native dialog (modal) for update prompt immediately
- While 5 is happening, RNBootsplash should still hide the splash screen behind the scene
Actual Behaviour: 1-4. works as expected 5. native dialog (modal) for update prompt shows for split second, then disappears 6. Screen stuck on the splash screen and cannot proceed
š¤Solution
Temporal Solution
Identifying this issue took some time, but once identified the temporal āfixā was straigthforward. What I did was change the CodePush config to use the following:
{
checkFrequency: RNCodePush.CheckFrequency. MANUAL,
updateDialog: true,
}
And call a manual check after RNBootsplash.hide
is complete. This avoids the dialog to show while RNBootsplash is still in action.
This solution have solved this issue, but it is not the ideal solution.
Ideal Solution (Ask)
I am no expert with native mobile development, but my guess here is that thereās some native view interaction rules of RNBootsplash which is not cooperating well/designed for, while other native view/overlay is in place (In this case, CodePushās native dialog/modal). Based on my assumption, I believe the ideal solution is for RNBootsplash to look for the right native view to interact with while keeping other native views untouched. Apologies if my assumption is out of place, but hope this would at least help others whoās encountering similar issue.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:5 (2 by maintainers)
@rarira Thatās exactly why I work on Promise support. Itā too hard to handle async state with imperative functions and timer. Android support is already done, iOS nearly is.
The BootSplash is designed using a simple UIViewController which came above the
RCTRootView
. Itās standard iOS behavior, there is no magic šI donāt see why? You resolved a race condition. This is not a workaround, but proper handling of this behavior š.
PS: Iām currently working on a new major version with Promises to make it easier to deal with async flow.