this is title 2

Date Published

A splash screen, also known as a launch screen, is the first screen a user sees when they open your app. It stays visible while the app is loading. You can also control the behavior of when a splash screen disappears by using the native SplashScreen API.

The default splash screen in an Expo project is a blank white screen. It can be customized using the splash property in the project's app config using the steps below.

1

Create a splash screen

To create a splash image, you can use this Figma template. It provides a bare minimum design for an icon and splash images for Android and iOS.

Dealing with various screen sizes for Android and iOS



2

Export the splash image as a .png

After creating a splash screen, export it as a .png and save it in the assets/images directory. By default, Expo uses splash.png as the file name. If you decide to change the name of your splash screen file, make sure to use that in the next step.

Note: Currently, only .png images are supported to use as a splash screen in an Expo project. If you use another image format, making a production build of your app will fail.

3

Add the splash screen in app config

Open the app config and add the local path as the value of splash.image property to point to your new splash image.

app.json

{
"splash": {
"image": "./assets/images/splash.png"
}
}

You can test your new splash image by starting the development server with npx expo start and using a development build or Expo Go to preview it.

Note: In development mode, when you test your new splash screen, you will notice an information bar at the bottom of the screen. It displays the information about how much of the JavaScript code is downloaded on the device when preparing your app. It doesn't appear in production apps.

4

Change the background color

If you set a background color other than white for your splash image, you may see a white border around it. This is due to the splash.backgroundColor property that has a default value of #ffffff.

You can update this property's value to match your splash image's background color. For example:

app.json

{
"splash": {
"image": "./assets/images/splash.png",
"backgroundColor": "#FEF9B0"
}
}

5

Resize a splash screen (optional)

Any splash image you provide gets resized to maintain its aspect ratio and fit the resolution of the user's device.

You can use two properties for resizing: contain (default) and cover. These properties work similar to the resizeMode in React Native <Image>, as demonstrated below:

Applying this to an example:

app.json

{
"splash": {
"image": "./assets/images/splash.png",
"resizeMode": "cover"
"backgroundColor": "#FFFFFF"
}
}

Related Posts