feat(splash-screen): implement launchFadeOutDuration support on iOS#2524
Conversation
|
Released dev build of splash-screen with dev version: 8.0.2-dev-2524-20260512T102123.0 |
|
|
||
| public func hide(settings: SplashScreenSettings) { | ||
| hideSplash(fadeOutDuration: settings.fadeOutDuration, isLaunchSplash: false) | ||
| let fadeOutDuration = self.isLaunchSplash ? config.launchFadeOutDuration : settings.fadeOutDuration |
There was a problem hiding this comment.
Can you explain the rationale behind this logic? Didn't seem like the equivalent existed on Android but maybe I didn't see right.
There was a problem hiding this comment.
On Android (using the Android 12 API), launchFadeOutDuration is applied inside OnExitAnimationListener, which is a system callback that runs before hide() is ever called from JS, so the system already knows it's closing the launch splash and applies the right duration at that point.
On iOS there's no equivalent system hook. The only way to dismiss the splash (including the launch one) is through hideSplash(), which is triggered by hide(). The problem is that hide() receives a SplashScreenSettings object coming from the js call, and that object has no context about whether it's hiding the launch splash or a programmatically shown one. Without the isLaunchSplash flag, hide() would always use settings.fadeOutDuration from the js parameters (default 200ms), ignoring the launchFadeOutDuration set in capacitor.config.ts.
So the flag is needed to let hide() decide:
"am I closing the launch splash, so use config.launchFadeOutDuration"
vs
"am I closing a programmatic splash, so use settings.fadeOutDuration from the js call".
There was a problem hiding this comment.
Ok makes sense, thanks for the detailed explanation!
There was a problem hiding this comment.
With which app did you test btw, capacitor-testapp?
There was a problem hiding this comment.
yup, with capacitor-testapp, by adding StatusBar.setStyle({ style: Style.Light }); right after SplashScreen.hide(); in the App.tsx file
3b8fc3b to
b37e708
Compare
OS-pedrogustavobilro
left a comment
There was a problem hiding this comment.
Tested with capacitor-testapp, changing values of launchFadeOutDuration in capacitor config, and also adding fadeOutDuration to show or hide. All seems to be working on different iOS versions (tested 15, 18 and 26)
Description
Implemented
launchFadeOutDurationsupport on iOS for cross-platform consistency with Android.Change Type
Rationale / Problems Fixed
launchFadeOutDurationwas not being read from config on iOS, and theisLaunchSplashflag was missing, causinghide()to always use the JS call'sfadeOutDurationinstead of the configured value. This PR implements fulllaunchFadeOutDurationsupport on iOS for cross-platform consistency with Android.Relates to: RMET-5084
Platforms Affected