Fix Splash Screen White Screen



  1. Install the plugin and the Ionic-Native wrapper:


ionic plugin add cordova-plugin-splashscreen

npm install --save @ionic-native/splash-screen


Amend 'config.xml':

<preference name="SplashMaintainAspectRatio" value="true"/>
  <preference name="SplashScreen" value="screen"/>
  <preference name="SplashScreenDelay" value="30000"/>
  <preference name="AutoHideSplashScreen" value="false"/>
  <preference name="SplashShowOnlyFirstTime" value="false"/>
  <preference name="FadeSplashScreen" value="false"/>

 Import SplashScreen in your 'app.module.ts' providers section:

import { SplashScreen } from '@ionic-native/splash-screen';
@NgModule({
  declarations: [...]
  imports: [IonicModule.forRoot(MyApp)],
  bootstrap: [IonicApp],
  entryComponents: [...],
  providers: [SplashScreen, ...]
})
export class AppModule {}

 In your 'app.component.ts':

import { SplashScreen } from '@ionic-native/splash-screen';
@Component({
  templateUrl: 'app.html'
})
export class MyApp {
  constructor(
    public _app: App,
    public _platform: Platform,
    public _SplashScreen: SplashScreen) {
    this.initializeApp();
  }

Then in 'initializeApp()':


 initializeApp() {
    this._platform.ready().then(() => {
      // do whatever you need to do here.
      setTimeout(() => {
        this._SplashScreen.hide();
      }, 100);
    });
  }

Comments

Popular posts from this blog

Hide Tabs when open sub pages