Gathering detailed insights and metrics for react-native-smooth-bootsplash
Gathering detailed insights and metrics for react-native-smooth-bootsplash
Gathering detailed insights and metrics for react-native-smooth-bootsplash
Gathering detailed insights and metrics for react-native-smooth-bootsplash
🚀 Show a splash screen during app startup. Hide it when you are ready.
npm install react-native-smooth-bootsplash
Typescript
Module System
TypeScript (42.76%)
Java (29.68%)
Objective-C (9.39%)
JavaScript (6.69%)
Ruby (6.2%)
Objective-C++ (2.6%)
ReScript (1.55%)
Shell (1.12%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
422 Commits
1 Branches
2 Contributors
Updated on May 31, 2025
Latest Version
4.5.2
Package Id
react-native-smooth-bootsplash@4.5.2
Unpacked Size
127.78 kB
Size
34.31 kB
File Count
54
Published on
Feb 23, 2023
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
3
1
Show a splash screen during app startup. Hide it when you are ready.
For migration from the v3, check the MIGRATION.md
guide.
This module is provided as is, I work on it in my free time.
If your company uses it in a production app, consider sponsoring this project 💰. You also can contact me for premium enterprise support, help with issues, prioritize bugfixes, feature requests, etc.
version | react-native version |
---|---|
4.0.0+ | 0.65.0+ |
3.0.0+ | 0.63.0+ |
1$ npm install --save-dev react-native-smooth-bootsplash 2# --- or --- 3$ yarn add -D react-native-smooth-bootsplash
⚠️ Don't forget going into the ios
directory to execute a pod install
.
Because this package targets React Native 0.65.0+, you probably don't need to link it manually. But if you have a special case, follow these additional instructions:
Add this line to your ios/Podfile
file, then run pod install
.
1target 'YourAwesomeProject' do 2 # … 3 pod 'RNBootSplash', :path => '../node_modules/react-native-smooth-bootsplash' 4end
android/settings.gradle
:1include ':react-native-smooth-bootsplash' 2project(':react-native-smooth-bootsplash').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-smooth-bootsplash/android')
android/app/build.gradle
:1dependencies { 2 // ... 3 implementation project(':react-native-smooth-bootsplash') 4}
MainApplication.java
:1import com.zoontek.rnbootsplash.RNBootSplashPackage; // <- add the RNBootSplashPackage import 2 3public class MainApplication extends Application implements ReactApplication { 4 5 // … 6 7 @Override 8 protected List<ReactPackage> getPackages() { 9 @SuppressWarnings("UnnecessaryLocalVariable") 10 List<ReactPackage> packages = new PackageList(this).getPackages(); 11 // … 12 packages.add(new RNBootSplashPackage()); 13 return packages; 14 } 15 16 // … 17}
ℹ️ For react-native
< 0.71
setup, follow the v4.4.0 README.md
.
In order to speed up the setup, we provide a CLI to generate assets, create the Android Drawable XML file and the iOS Storyboard file automatically ✨.
1$ npx react-native generate-bootsplash --help 2# --- or --- 3$ yarn react-native generate-bootsplash --help
The command can take multiple arguments:
1yarn react-native generate-bootsplash <logoPath> 2 3Generate a launch screen using an original logo file (PNG or SVG) 4 5Options: 6 --background-color <color> color used as launch screen background (in hexadecimal format) (default: "#fff") 7 --logo-width <width> logo width at @1x (in dp - we recommend approximately ~100) (default: 100) 8 --assets-path [path] path to your static assets directory (useful to require the logo file in JS) 9 --flavor <flavor> [android only] flavor build variant (outputs in an android resource directory other than "main") 10 --dark-logo [path] [optional] if specified, will be used for splashscreen that is shown when phone is in dark mode 11 --dark-background-color <color> [optional] color used as launch screen background when phone is in dark mode (in hexadecimal format) (default: "#000"). Only used if --dark-logo-path is set! 12 -h, --help output usage information
1yarn react-native generate-bootsplash assets/bootsplash_logo_original.png \ 2 --background-color=F5FCFF \ 3 --dark-logo=assets/bootsplash_logo_dark.png \ 4 --logo-width=100 \ 5 --assets-path=assets \ 6 --flavor=main
This tool relies on the naming conventions that are used in the /example
project and will therefore create the following files:
1# Only if --assets-path was specified 2assets/bootsplash_logo.png 3assets/bootsplash_logo@1,5x.png 4assets/bootsplash_logo@2x.png 5assets/bootsplash_logo@3x.png 6assets/bootsplash_logo@4x.png 7# if dark logo is specified 8assets/bootsplash_logo_dark.png 9assets/bootsplash_logo_dark@1,5x.png 10assets/bootsplash_logo_dark@2x.png 11assets/bootsplash_logo_dark@3x.png 12assets/bootsplash_logo_dark@4x.png 13 14android/app/src/main/res/values/colors.xml (creation and addition) 15android/app/src/main/res/values-night/colors.xml 16android/app/src/main/res/mipmap-hdpi/bootsplash_logo.png 17android/app/src/main/res/mipmap-mdpi/bootsplash_logo.png 18android/app/src/main/res/mipmap-xhdpi/bootsplash_logo.png 19android/app/src/main/res/mipmap-xxhdpi/bootsplash_logo.png 20android/app/src/main/res/mipmap-xxxhdpi/bootsplash_logo.png 21# if dark logo is specified 22android/app/src/main/res/mipmap-hdpi/bootsplash_logo_dark.png 23android/app/src/main/res/mipmap-mdpi/bootsplash_logo_dark.png 24android/app/src/main/res/mipmap-xhdpi/bootsplash_logo_dark.png 25android/app/src/main/res/mipmap-xxhdpi/bootsplash_logo_dark.png 26android/app/src/main/res/mipmap-xxxhdpi/bootsplash_logo_dark.png 27 28 29ios/YourProjectName/BootSplash.storyboard 30ios/YourProjectName/Images.xcassets/BootSplashLogo.imageset/bootsplash_logo.png 31ios/YourProjectName/Images.xcassets/BootSplashLogo.imageset/bootsplash_logo@2x.png 32ios/YourProjectName/Images.xcassets/BootSplashLogo.imageset/bootsplash_logo@3x.png 33# if dark logo is specified 34ios/YourProjectName/Images.xcassets/BootSplashLogo.imageset/bootsplash_logo_dark.png 35ios/YourProjectName/Images.xcassets/BootSplashLogo.imageset/bootsplash_logo_dark@2x.png 36ios/YourProjectName/Images.xcassets/BootSplashLogo.imageset/bootsplash_logo_dark@3x.png
⚠️ Only .storyboard
files are supported (Apple has deprecated other methods in April 2020).
Edit the ios/YourProjectName/AppDelegate.mm
file:
1#import "AppDelegate.h" 2#import "RNBootSplash.h" // <- add the header import 3 4// … 5 6@implementation AppDelegate 7 8- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 9{ 10 self.moduleName = @"RNBootSplashExample"; 11 self.initialProps = @{}; 12 [super application:application didFinishLaunchingWithOptions:launchOptions]; 13 14 [RNBootSplash initWithStoryboard:@"BootSplash" rootView:self.window.rootViewController.view]; // <- initialization using the storyboard file name 15 16 return YES; 17}
Set the BootSplash.storyboard
as launch screen file:
Drag and drop the file | Create folder reference | Set as Launch Screen File |
---|---|---|
![]() | ![]() | ![]() |
⚠️ On Android >= 12, the splash screen will not appear if you start your app from the terminal / Android Studio. To see it, kill your app and restart it in normal conditions (tap on your app icon in the app launcher).
android/app/build.gradle
file:1dependencies { 2 // … 3 4 implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.0.0") 5 implementation("androidx.core:core-splashscreen:1.0.0") // Add this line 6 7 // …
⚠️ Don't forget going into the android
directory to execute a ./gradlew clean && ./gradlew build
(or perform a Gradle sync in Android Studio).
android/app/src/main/res/values/styles.xml
file:1<resources> 2 3 <style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar"> 4 <!-- Your base theme customization --> 5 </style> 6 7 <!-- BootTheme should inherit from Theme.SplashScreen --> 8 <style name="BootTheme" parent="Theme.SplashScreen"> 9 <item name="windowSplashScreenBackground">@color/bootsplash_background</item> 10 <item name="windowSplashScreenAnimatedIcon">@mipmap/bootsplash_logo</item> 11 <item name="postSplashScreenTheme">@style/AppTheme</item> 12 </style> 13 14</resources>
If you want to have different splashscreen in Dark Mode, also create/edit the android/app/src/main/res/values-night/styles.xml
:
1<resources> 2 <!-- BootTheme should inherit from Theme.SplashScreen --> 3 <style name="BootTheme" parent="Theme.SplashScreen"> 4 <item name="windowSplashScreenAnimatedIcon">@mipmap/bootsplash_logo_dark</item> 5 <item name="postSplashScreenTheme">@style/AppTheme</item> 6 </style> 7</resources>
android/app/src/main/AndroidManifest.xml
file:1<manifest xmlns:android="http://schemas.android.com/apk/res/android" 2 package="com.rnbootsplashexample"> 3 4 <!-- … --> 5 6 <application 7 android:name=".MainApplication" 8 android:label="@string/app_name" 9 android:icon="@mipmap/ic_launcher" 10 android:roundIcon="@mipmap/ic_launcher_round" 11 android:allowBackup="false" 12 android:theme="@style/BootTheme"> <!-- Replace @style/AppTheme with @style/BootTheme --> 13 <!-- … --> 14 </application> 15</manifest> 16
android/app/src/main/java/com/yourprojectname/MainActivity.java
file:1// … 2 3// Add these required imports: 4import android.os.Bundle; 5import com.zoontek.rnbootsplash.RNBootSplash; 6 7public class MainActivity extends ReactActivity { 8 9 // … 10 11 @Override 12 protected void onCreate(Bundle savedInstanceState) { 13 RNBootSplash.init(this); // <- initialize the splash screen 14 super.onCreate(savedInstanceState); // or super.onCreate(null) with react-native-screens 15 } 16}
1type hide = (config?: { fade?: boolean; duration?: number }) => Promise<void>;
Note: Only durations above 220ms are visually noticeable. Smaller values will be ignored and the default duration will be used.
1import RNBootSplash from "react-native-smooth-bootsplash";
2
3RNBootSplash.hide(); // immediate
4RNBootSplash.hide({ fade: true }); // fade with 220ms default duration
5RNBootSplash.hide({ fade: true, duration: 500 }); // fade with custom duration
1type VisibilityStatus = "visible" | "hidden" | "transitioning"; 2type getVisibilityStatus = () => Promise<VisibilityStatus>;
1import RNBootSplash from "react-native-smooth-bootsplash"; 2 3RNBootSplash.getVisibilityStatus().then((status) => console.log(status));
1import React, { useEffect } from "react"; 2import { Text } from "react-native"; 3import RNBootSplash from "react-native-smooth-bootsplash"; 4 5function App() { 6 useEffect(() => { 7 const init = async () => { 8 // …do multiple sync or async tasks 9 }; 10 11 init().finally(async () => { 12 await RNBootSplash.hide({ fade: true, duration: 500 }); 13 console.log("Bootsplash has been hidden successfully"); 14 }); 15 }, []); 16 17 return <Text>My awesome app</Text>; 18}
🤙 A more complex example is available in the /example
folder.
If you are using React Navigation, you can hide the splash screen once the navigation container and all children have finished mounting by using the onReady
function.
1import React from "react"; 2import { NavigationContainer } from "@react-navigation/native"; 3import RNBootSplash from "react-native-smooth-bootsplash"; 4 5function App() { 6 return ( 7 <NavigationContainer onReady={() => RNBootSplash.hide()}> 8 {/* content */} 9 </NavigationContainer> 10 ); 11}
In order to keep fully transparent status and navigation bars on Android once the splash screen is hidden (and control them), this library play nicely with react-native-bars. Check its README for more informations.
Testing code which uses this library requires some setup since we need to mock the native methods.
To add the mocks, create a file jest/setup.js (or any other file name) containing the following code:
1jest.mock("react-native-smooth-bootsplash", () => { 2 return { 3 hide: jest.fn().mockResolvedValueOnce(), 4 getVisibilityStatus: jest.fn().mockResolvedValue("hidden"), 5 }; 6});
After that, we need to add the setup file in the jest config. You can add it under setupFiles option in your jest config file:
1{ 2 "setupFiles": ["<rootDir>/jest/setup.js"] 3}
react-native-splash-screen
encourages you to display an image over your application, react-native-smooth-bootsplash
way-to-go is to design your launch screen using platforms tools.No vulnerabilities found.
No security vulnerabilities found.