hide()
show()

Splash Screen

The Splash Screen API provides methods for showing or hiding a Splash image.

Example

import { Plugins } from '@capacitor/core';
const { SplashScreen } = Plugins;

// Hide the splash (you should do this on app launch)
SplashScreen.hide();

// Show the splash for an indefinite amount of time:
SplashScreen.show({
  autoHide: false
});

// Show the splash for two seconds and then auto hide:
SplashScreen.show({
  showDuration: 2000,
  autoHide: true
});

Hiding the Splash Screen

By default, the Splash Screen is set to automatically hide after a certain amount of time (3 seconds). However, your app should boot much faster than this!

To make sure you provide the fastest app loading experience to your users, you must hide the splash screen automatically when your app is ready to be used. Simply add the SplashScreen.hide() call near the top of your app's JS, such as in app.component.ts if using Angular.

If your app needs longer than 3 seconds to load, configure the default duration by setting launchShowDuration in your capacitor.config.json:

{
  "plugins": {
    "SplashScreen": {
      "launchShowDuration": 5000
    }
  }
}

Then run npx cap copy to apply these changes.

API

SplashScreenPlugin

hide

hide(options?:
SplashScreenHideOptions
, callback?: Function): Promise<void>
Hide the splash screen
options
SplashScreenHideOptions
callback Function
Returns: Promise<void>

show

show(options?:
SplashScreenShowOptions
, callback?: Function): Promise<void>
Show the splash screen
options
SplashScreenShowOptions
callback Function
Returns: Promise<void>

Interfaces

interface SplashScreenHideOptions {
// How long (in ms) to fade out. Default is 200ms
fadeOutDuration ?: number
}
interface SplashScreenShowOptions {
// Whether to auto hide the splash after showDuration
autoHide ?: boolean
// How long (in ms) to fade in. Default is 200ms
fadeInDuration ?: number
// How long (in ms) to fade out. Default is 200ms
fadeOutDuration ?: number
// How long to show the splash screen when authHide is enabled (in ms) Default is 3000ms
showDuration ?: number
}