How to create Splash Screen on React-Native Android Application

Tolga ÇINAR
lTunes Tribe
Published in
3 min readNov 2, 2019

Hello everyone,

We will talk about “How to create Splash Screen on React-Native Android Application” in this post.

Firstly, what’s splash screen?

This screen is using for during start to application. When your application open, you are seeing firstly this screen. It’s generally application logo, application name, etc…

Example Project Dependencies:

  • React: 16.9.0
  • React-Native: 0.61.3

Before start development, we need an images for this screen. I’m using this website for re-size. You can use this or alternative websites. We are doing re-size because of devices resolutions.

Screenshot 1: Splash Screen Images.

Images should be in root/android/app/src/main/res folder and folders name should be like a Screenshot 1. (Drawable-xxx). If you use this site for re-size, it will create this folders for you. Now, items are ready for development. We will use Android studio on this step. When I check splash screen images with Android Studio, They looks as follows.

Screenshot 2: Splash Screen Resources.

Now, we are create a new drawable resources file in drawable folder. Right click to drawable folder and New > Drawable File Resource Example file name is splash.xml. You can check screenshot 3 for example file.

Screenshot 3: Splash.xml file

Let’s start to write splash.xml. We are creating a new item in drawable resources. The screenshot is as follows.

Screenshot 4: Splash.xml file detail.

We created bitmap in item tag and defined path and gravity for this bitmap. It’s meaning; images in drawable/screen folder and fill the page with this image.

After created splash.xml, we need to update styles.xml. This file in root/app/res/values folder. The screenshot as follows.

Screenshot 5: Styles.xml file path.

Now, we add new style tag in styles.xml file and we define name and parent property. After this, we add item tag in style tag. The screenshot is as follows.

Screenshot 6: styles.xml file detail.

We continue to develope on AndroidManifest.xml. Firstly, we will do some update in Activity tag. We are changing .MainActivity via .SplashActivity and adding android:theme=”@style/SplashTheme” property in this activity tag.

Let’s do last change for AndroidManifest.xml document. Now, we add new activity tag after current activity tag. The screenshot for all of this updates are as follows.

Screenshot 7: AndroidManifest.xml file detail.

We came to final step. We will create SplashActivity.java file. Right Click to com.splashexample (This may be different due to your project name) and New -> Java Class

Screenshot 8: Create SplashActivity.java
Screenshot 9: SplashActivity.java file detail.

We created new intent for pass to MainActivity and started this intent with startActivity() When we open application, firstly SplashActivity will open and we will see splash image on screen. After this, application will continue with MainActivity.

Now, we finished splash screen. Let’s try it.

Screenshot 10: Result.

I shared example project on Github. You can download as follows link.

Example Project:

https://github.com/cinarrtolga/react-native-splash-screen-example

Best regards.

--

--