A splash screen for react-native and wix navigation.
npm install react-native-mixed-splashThis package is two packages in one.
IOS side: react-native-splash-screen
Android side: react-native-bootsplash
See instruction for integrate IOS in __react-native-splash-screen__, for Android in __react-native-bootsplash__.
1. ``npm i --save `
2. `cd ios && pod install`
`
#import "AppDelegate.h"
#import
#import
#import "RNSplashScreen.h" // here
@implementation AppDelegate
- (BOOL)application:(UIApplication )application didFinishLaunchingWithOptions:(NSDictionary )launchOptions
{
// ...other code
[ReactNativeNavigation bootstrapWithDelegate:self launchOptions:launchOptions];
[RNSplashScreen show];
return YES;
}
@end
`
Edit the android/app/src/main/java/com/yourprojectname/MainActivity.java file:
`
package com.orlev.miniut;
import com.reactnativenavigation.NavigationActivity;
import com.zoontek.rnbootsplash.RNBootSplash;
import android.os.Bundle;
public class MainActivity extends NavigationActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
RNBootSplash.init(R.drawable.splashscreen, MainActivity.this);
}
}
`
Keep you AndroidManifest like this (android:theme="@style/AppTheme"):
`
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="false"
android:theme="@style/AppTheme"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustPan">
`
Create splashscreen on android/app/src/main/res/drawable/splashscreen.xml
`
android:height="386dp"
android:drawable="@drawable/splash_icon"
android:gravity="center" />
`
Update styles file android/app/src/main/res/values/styles.xml
`
`
`
import SplashScreen from "react-native-mixed-splash";
SplashScreen.hide(); // SplashScreen.show();
``