1>使用模塊react-native-smart-splash-screen將它安裝到您的項目中CT 2>在文件MainActivity.java
import com.reactnativecomponent.splashscreen.RCTSplashScreenPackage;
replace the getPackages() method with the following
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new VectorIconsPackage(),
new MapsPackage(),
new RCTSplashScreenPackage()
);
}
現在在MainApplication.java文件更新代碼
import com.reactnativecomponent.splashscreen.RCTSplashScreen;
import android.os.Bundle;
import android.content.Intent;
in the onCreate method delete the method and copy the code below
@Override
protected void onCreate(Bundle savedInstanceState) {
RCTSplashScreen.openSplashScreen(this);
super.onCreate(savedInstanceState);
}
在您的着陸頁中反應的本機應用
import SplashScreen from 'react-native-smart-splash-screen'
in the lifecycle method componentWillMount() add the following as:
componentDidMount(){
SplashScreen.close(SplashScreen.animationType.scale, 2000, 800)
}
如果有問題請訪問此回購
https://github.com/UjjwalNepal/Dental
https://github.com/react-native-component/react-native-smart-splash-screen
添加的依賴關係如在鏈接上面提到的gradle中設置以及和添加在機器人/應用/的build.gradle 依賴性如在鏈接提到
得益於以上很多我有已經使用這一個,但我想知道如何做啓動屏幕RN機器人沒有任何包或任何JavaScript代碼? –
如果你很熟悉Java,它很容易在Android本地編寫它,但不知道這些與RN,但上述建議工作良好,你可以用閃屏https://play.google檢查我的應用程序商店。 com/store/apps/details?id = com.loksewaquiz –
謝謝我只是做了上面的解釋,它對我很好,謝謝 –