Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

react native

How to integrate a splash screen in React Native with Bootsplash

Gautham Vijayan


In this shot, we will learn how to integrate splash screens in React Native for both Android and iOS.


First, let’s create a new React Native project from the terminal.

npx react-native init reactnativesplash
cd reactnativesplash

Install the react-native-bootsplash package from the terminal.

npm i react-native-bootsplash

Now, place your logo in the root folder and run the command below to generate assets required for both Android and iOS.

npx react-native generate-bootsplash logo.png

Configuration in Android

In the Android folder, create a new folder called “drawable.” Inside the “drawable” folder, create a bootsplash.xml file.

Inside the file, add the following code.

<?xml version="1.0" encoding="utf-8"?>

<layer-list xmlns:android="" android:opacity="opaque">
    <item android:drawable="@color/bootsplash_background" />

        <bitmap android:src="@mipmap/bootsplash_logo" android:gravity="center" />

In the “values” folder and inside styles.xml, add the code below.

<style name="BootTheme" parent="AppTheme">
    <item name="android:background">@drawable/bootsplash</item>

Now, in, add the lines of code below at the top of the file.

import android.os.Bundle;
import android.view.WindowManager;

import com.facebook.react.ReactActivityDelegate; 
import com.zoontek.rnbootsplash.RNBootSplash; 

Below the getMainComponentName() function, paste the following code.

  protected void onCreate(Bundle savedInstanceState) {

Finally, in AndroidManifest.xml, add the following code below the activities.

    <action android:name="android.intent.action.MAIN" />

In the activity, add the tag below.


Configuration in iOS

Open the React Native project in Xcode and have your React Native project in your finder. In the iOS folder, drag and drop Bootsplash.storyboard into Xcode. You will get a prompt; click on “finish.”

Now, go to the AppDelegate.m file and the following lines of code.

#import "RNBootSplash.h"

Add the lines of code below.

[self.window makeKeyAndVisible];

// code u need to add 
  [RNBootSplash initWithStoryboard:@"BootSplash" rootView:rootView];

// code u need to add 

  return YES; 

Now, go to the terminal and install the pods.

cd ios 
pod install

How to test Android and iOS splash screens

Before we test for Android and iOS devices, we need to import the react-native-bootsplash package in App.js.

In the useEffect hook, we are going to hide the splash screen after 3 seconds when the application opens.

Our App.js should look as follows.

import React, {useEffect} from 'react';
import {SafeAreaView, Text, View} from 'react-native';
import RNBootSplash from 'react-native-bootsplash';

const App = () => {
  useEffect(() => {
    setTimeout(() => {
      RNBootSplash.hide({fade: true});
    }, 3000);
  }, []);

  return (
        <Text>Splash Screen</Text>

export default App;

Now, let’s test the Android version.

Go to the terminal and run the following code.

npm run android

You should see the splash screen in the Android emulator.

Now, let’s test the iOS version.

npm run ios


In this shot, we learned how to integrate splash screens in both Android and iOS devices for a React Native app.

You can find all the code used in this project here.


react native

View all Courses

Keep Exploring