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