Hi all!
In this tutorial, I'll guide you to build a custom splash screen for a bare react native app. There are many tutorials on how to do this for React Native out there, for sure. But a lot of them rely on native codes and as a result, as a developer, we lost a bit of control over the screen that greets our users, every time they open our app.
I have had horrible experiences using some of those methods, resulting in low-quality splash screens! So I dug around and found a tutorial that suits my need. The original article can be found here on dev.to site, written by Mateo Hrastnik.
In my version, I tweaked it to accommodate my preferred setup. In the original article, Mateo used a static image and animated its opacity using the Animated hook from React Native. In my version, you will find that I am more ambitious, wanting a more complicated animation on my splash screen. Here's the result:
![]() |
Image 1: React Native Custom Splash Screen |
![]() |
Image 2: Rive Homepage |
What Rive does is to simplify the process flow of creating animated assets. If you go by the Lottie route, you'd have to use Adobe After Effects to animated the layers, and export it to .json format. For RIVE, you design, animate and export the assets using just one tool. It's pretty convenient I suppose. I'm still fairly new to this, so my animation is very basic, as you can see.
![]() |
Image 3: Rive App Interface |
- Manually set a blank, single-color splash screen background on the native side;
- On iOS, set the background color of the React Native root view to that same color;
- As soon as React Native loads, add a View with the same color in React Native and fade in the app logo on it; and
- Once the app loads, fade out the splash screen.
1.0 - Initial Preparation
- Install and configure your React Native app. I'm using the bare React Native installation using
npx react-native init <projectName>
command on my terminal. Check out the official guide to setup proper development environment for React Native here. - Run
npx react-native start
. This will start the development server. - Run
npx react-native run-ios
andnpx react-native run-android
to boot up iOS simulator and Android emulator. - Choose a background color that suits the theme of your app. You can start with a hex color, and get its RGB value range. Use this tool to convert hex value to its equivalent RGB range. I'm using these values:
- HEX: #ff0b00
- RBG: 1.00000, 0.04314, and 0.00000
- Prepare your logo/ animated logo. You can go with a statc image .png here, or if it tickles your fancy, go on and explore the Rive tool and export the asset. Follow this tutorial to configure where to put the asset in your iOS and Android project folder.
2.0 - Setting a Blank Background on iOS
AppDelegate.m
, search for the line that sets rootView.backgroundColor
and change:LaunchScreen.storyboard
file, and change its structure to this:backgroundColor
values accordingly.3.0 - Setting a Blank Background on Android
4.0 - The Javascript Part
- At first, it shows only a blank View with the background color we picked. This is visible until the splash screen logo is loaded into memory;
- The logo appears;
- We wait in this state until the app is initialized and ready to run (this will be mocked by an
initialize()
function); - The whole splash screen fades out, revealing the app's first screen;
- Finally, the splash screen assets are cleaned up;
WithSplashScreen
component and once the app is initialized, set the isAppReady
prop to true
.Conclusion
January 13, 2023