Hide Splash Screen in Ionic Capacitor React

我们两清 提交于 2020-06-26 07:22:25

问题


How can we disable the splash screen on an Ionic App? I am using Ionic 4, Capacitor and React. I have tried to add this on capacitor.config.json

{
  "plugins": {
    "SplashScreen": {
      "launchShowDuration": 0
    }
  }
}

The above code is not working at all.


回答1:


You can hide the splash screen using the SplashScreen plugin :

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

function useSplashHide(){
    useEffect(() => {
        SplashScreen.hide();
    }, []);
} 

Documentation is here




回答2:


You can just add below line in config.xml

<preference name="SplashScreenDelay" value="0"/>


来源:https://stackoverflow.com/questions/60238935/hide-splash-screen-in-ionic-capacitor-react

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!