crazycodeboy /react-native-splash-screen
A splash screen for react-native, hide when application loaded ,it works on iOS and Android.
★ 5,653⑂ 1,095👁 59⑃ 153● 519▤ 12
+0
Daily
5,653
stars
1,095
forks
59
watchers
153
prs
519
issues
12
releases
README
react-native-splash-screen






A splash screen API for react-native which can programatically hide and show the splash screen. Works on iOS and Android.
Content
- Changes
- Installation
- Examples
- Getting started
- API
- Testing
- Troubleshooting
- Contribution
Changes
For React Native = 0.47.0 use v3.+, for React Native = 0.3.1
import org.devio.rn.splashscreen.SplashScreenReactPackage;
// react-native-splash-screen getPackages() {
return Arrays.asList(
new MainReactPackage(),
new SplashScreenReactPackage() //here
);
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
}
iOS:
1. cd ios
2. run pod install
OR
1. In XCode, in the project navigator, right click Libraries ➜ Add Files to [your project's name]
2. Go to node_modules ➜ react-native-splash-screen and add SplashScreen.xcodeproj
3. In XCode, in the project navigator, select your project. Add libSplashScreen.a to your project's Build Phases ➜ Link Binary With Libraries
4. To fix 'RNSplashScreen.h' file not found, you have to select your project → Build Settings → Search Paths → Header Search Paths to add:
$(SRCROOT)/../node_modules/react-native-splash-screen/ios
Third step(Plugin Configuration):
Android:
Update the MainActivity.java to use react-native-splash-screen via the following changes:
java
import android.os.Bundle; // here
import com.facebook.react.ReactActivity;
// react-native-splash-screen = 0.3.1
import org.devio.rn.splashscreen.SplashScreen; // here
// react-native-splash-screen
import
import "RNSplashScreen.h" // here
@implementation AppDelegate
- (BOOL)application:(UIApplication )application didFinishLaunchingWithOptions:(NSDictionary )launchOptions
{
// ...other code
[RNSplashScreen show]; // here
// or
//[RNSplashScreen showSplash:@"LaunchScreen" inRootView:rootView];
return YES;
}
@end
Getting started
Import react-native-splash-screen in your JS file.
import SplashScreen from 'react-native-splash-screen'
Android:
Create a file called launch_screen.xml in app/src/main/res/layout (create the layout-folder iTop issues
#167Android App Crashing on Open66 comments · 2018-01-30#219Build failed on Android, HELP48 comments · 2018-05-29#71Splash screen doesn't disappear42 comments · 2017-07-22#606not working splash screen for react-native 0.71.041 comments · 2023-01-19#32MainActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView40 comments · 2017-02-21#87LaunchImage is not hiding in iOS38 comments · 2017-08-21#634React Native 0.73 Integration36 comments · 2023-12-13#289Some firebase functionality not working with react-native-splash-screen 29 comments · 2018-08-20