1

I tried many different plugins and instruction to do splash screen but I get error when I change or try to setup android-manifest or my splash screen style, can anyone help me with step by step exactly to setup a splash screen or a video as tutorial please?

I tried such the below links but I got errors when I run-android

https://android.jlelse.eu/change-splash-screen-in-react-native-android-app-d3f99ac1ebd1#.saf96u3bp

Note: I want over android

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129

1 Answers1

2

1> use the module react-native-smart-splash-screen install it on your project 2>In the file MainActivity.java update the code as

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);
}

in the MainApplication.java file

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()
  );
}

now In your landing page in react native app

 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)
 }

if there is some problem visit this repo

https://github.com/UjjwalNepal/Dental

https://github.com/react-native-component/react-native-smart-splash-screen

add the dependencies as mentioned in the link above in gradle settings as well and add the dependency in android/app/build.gradle as mentioned in the link above

Ujjwal Nepal
  • 546
  • 5
  • 13
  • thanks alot i have already used this one but am wondering how about make splash screen for RN android without any package or any JavaScript code ? – Ali Al Roomi Feb 23 '17 at 11:43
  • If you are well known with java its easy to write it in android native itself, don't know about these with RN but the above suggestions work good you can check my app in store with the splashscreen https://play.google.com/store/apps/details?id=com.loksewaquiz – Ujjwal Nepal Feb 24 '17 at 03:27
  • thanks i make just what you explain above and it is works fine with me many thanks – Ali Al Roomi Apr 13 '17 at 22:12