Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

splash-screen: fadeOutDuration not working on Android #1322

Closed
nijakobius opened this issue Dec 9, 2022 · 12 comments · Fixed by #1393
Closed

splash-screen: fadeOutDuration not working on Android #1322

nijakobius opened this issue Dec 9, 2022 · 12 comments · Fixed by #1393

Comments

@nijakobius
Copy link

nijakobius commented Dec 9, 2022

Bug Report

Plugin(s)

@capacitor/[email protected]

Capacitor Version

Latest Dependencies:

  @capacitor/cli: 4.6.1
  @capacitor/core: 4.6.1
  @capacitor/android: 4.6.1
  @capacitor/ios: 4.6.1

Installed Dependencies:

  @capacitor/cli: 4.6.1
  @capacitor/core: 4.6.1
  @capacitor/ios: 4.6.1
  @capacitor/android: 4.6.1

Platform(s)

Android (all Versions).

Current Behavior

When I use Capacitor.Plugins.SplashScreen.hide({fadeOutDuration: 6000}); the SplashScreen disappears immediately, possibly with a very short fade.

Expected Behavior

The SplashScreen should be fading out over 6 seconds.

Or, if this is not possible on Android, the docs should mention that fadeOutDuration is iOS-only: https://capacitorjs.com/docs/apis/splash-screen

@Ionitron
Copy link
Collaborator

Ionitron commented Dec 9, 2022

This issue may need more information before it can be addressed. In particular, it will need a reliable Code Reproduction that demonstrates the issue.

Please see the Contributing Guide for how to create a Code Reproduction.

Thanks!
Ionitron 💙

@nijakobius
Copy link
Author

nijakobius commented Dec 9, 2022

This issue may need more information before it can be addressed. In particular, it will need a reliable Code Reproduction that demonstrates the issue.

Please see the Contributing Guide for how to create a Code Reproduction.

Thanks! Ionitron 💙

The code is literally just

Capacitor.Plugins.SplashScreen.hide({fadeOutDuration: 6000});

The app can be completely devoid of any other content, since this is just about the fade animation to hide the SplashScreen. Should be reproducible in ANY app you may have lying around. Just paste in the command and delete everything else :)

@Ionitron
Copy link
Collaborator

Ionitron commented Dec 9, 2022

This issue may need more information before it can be addressed. In particular, it will need a reliable Code Reproduction that demonstrates the issue.

Please see the Contributing Guide for how to create a Code Reproduction.

Thanks!
Ionitron 💙

@digaus
Copy link

digaus commented Dec 16, 2022

Same issue. Start splash does not respect the fadeOutDuration when using android 12 splash screen behaviour. Maybe plugin needs to be refactored because the fadeOutDuration is set when showing the splash and not when hiding.

Or we need to add fadeOutDuration to the plugin config so it is set inside the showOnLaunch method. Default is now always 200ms and causes flickering when we use an app which uses fullscreen options.

Here is a repo: https://github.com/digaus/keyboard-demo

Note that fadeout should take 5 seconds but it takes just 200ms

@stevium
Copy link

stevium commented Dec 19, 2022

I have the same, this is really crucial for initial user impression when opening an app for the first time.

@jcesarmobile
Copy link
Member

On SDK 33 there would be an easy fix by using a global variable for storing the fadeOutDuration and make hide to overwrite the value, but on previous versions the initial value gets retained when declared instead of getting the current value when it's being used.

Refactoring is not going to work neither, if the animation listener is moved elsewhere, then it creates two new issues.

  1. The fallback to the legacy splash screen no longer works if the user is still using AppTheme.NoActionBar as it's the exit animation listener what fails and allows us to detect that they are using the old splash theme parent.
  2. On Android < 31 it uses a default android icon instead of the splash screen icon for the animation

So I think best option would be to add a new launchFadeOutDuration config option.

@NePheus
Copy link

NePheus commented Dec 26, 2022

Default is now always 200ms and causes flickering when we use an app which uses fullscreen options.

Good to know where our flickering come from :) then this is the same issue we have. And I thought I made a misstake somewhere.

@digaus
Copy link

digaus commented Jan 2, 2023

On SDK 33 there would be an easy fix by using a global variable for storing the fadeOutDuration and make hide to overwrite the value, but on previous versions the initial value gets retained when declared instead of getting the current value when it's being used.

Refactoring is not going to work neither, if the animation listener is moved elsewhere, then it creates two new issues.

  1. The fallback to the legacy splash screen no longer works if the user is still using AppTheme.NoActionBar as it's the exit animation listener what fails and allows us to detect that they are using the old splash theme parent.
  2. On Android < 31 it uses a default android icon instead of the splash screen icon for the animation

So I think best option would be to add a new launchFadeOutDuration config option.

Happy new year :)

Yeah thats what I currently also did locally. Maybe also completely remove the animation when it is set to 0 ?

@jcesarmobile
Copy link
Member

can you give #1393 a try?

@NePheus
Copy link

NePheus commented Jan 27, 2023

I just tested it and with setting launchFadeDuration to 0, the initial flickering is gone (using avd file, but with static content)! Thank you very much!

Is it possible for you to create a nightly release in npm?

@george-martinec
Copy link

@ionitron-bot
Copy link

ionitron-bot bot commented Mar 9, 2023

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of the plugin, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Mar 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants