Skip to content

feat(splash-screen): implement launchFadeOutDuration support on iOS#2524

Merged
OS-ruimoreiramendes merged 2 commits into
nextfrom
fix/splash-screen-launch-fade-out-duration
May 12, 2026
Merged

feat(splash-screen): implement launchFadeOutDuration support on iOS#2524
OS-ruimoreiramendes merged 2 commits into
nextfrom
fix/splash-screen-launch-fade-out-duration

Conversation

@OS-ruimoreiramendes
Copy link
Copy Markdown
Contributor

@OS-ruimoreiramendes OS-ruimoreiramendes commented May 8, 2026

Description

Implemented launchFadeOutDuration support on iOS for cross-platform consistency with Android.

Change Type

  • Fix
  • Feature
  • Refactor
  • Breaking Change
  • Documentation

Rationale / Problems Fixed

launchFadeOutDuration was not being read from config on iOS, and the isLaunchSplash flag was missing, causing hide() to always use the JS call's fadeOutDuration instead of the configured value. This PR implements full launchFadeOutDuration support on iOS for cross-platform consistency with Android.

Relates to: RMET-5084

Platforms Affected

  • Android
  • iOS
  • Web

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 8, 2026

Released dev build of splash-screen with dev version: 8.0.2-dev-2524-20260512T102123.0

@OS-ruimoreiramendes OS-ruimoreiramendes changed the title fix(splash-screen): change launchFadeOutDuration default to 0 refactor(splash-screen): change launchFadeOutDuration default to 0 May 8, 2026
@OS-pedrogustavobilro OS-pedrogustavobilro self-assigned this May 11, 2026

public func hide(settings: SplashScreenSettings) {
hideSplash(fadeOutDuration: settings.fadeOutDuration, isLaunchSplash: false)
let fadeOutDuration = self.isLaunchSplash ? config.launchFadeOutDuration : settings.fadeOutDuration
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain the rationale behind this logic? Didn't seem like the equivalent existed on Android but maybe I didn't see right.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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".

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok makes sense, thanks for the detailed explanation!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With which app did you test btw, capacitor-testapp?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup, with capacitor-testapp, by adding StatusBar.setStyle({ style: Style.Light }); right after SplashScreen.hide(); in the App.tsx file

Comment thread splash-screen/ios/Sources/SplashScreenPlugin/SplashScreen.swift
@OS-ruimoreiramendes OS-ruimoreiramendes force-pushed the fix/splash-screen-launch-fade-out-duration branch from 3b8fc3b to b37e708 Compare May 12, 2026 10:12
@OS-ruimoreiramendes OS-ruimoreiramendes changed the title refactor(splash-screen): change launchFadeOutDuration default to 0 feat(splash-screen): implement launchFadeOutDuration support on iOS May 12, 2026
Copy link
Copy Markdown
Contributor

@OS-pedrogustavobilro OS-pedrogustavobilro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

@OS-ruimoreiramendes OS-ruimoreiramendes merged commit d1b094d into next May 12, 2026
9 checks passed
@OS-ruimoreiramendes OS-ruimoreiramendes deleted the fix/splash-screen-launch-fade-out-duration branch May 12, 2026 14:12
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.

2 participants