Configure status bar, splash screen and app icon

Edit this page

In this tutorial, learn the basics of how to configure a status bar, app icon, and splash screen.


In this chapter, we'll address some app details before deploying our app to an app store, such as theming the status bar, customizing the app icon, and splash screen.

Watch: Adding the finishing touches to your universal Expo app
Watch: Adding the finishing touches to your universal Expo app

1

Configure the status bar

expo-status-bar library comes pre-installed in every project created using create-expo-app. This library provides a StatusBar component to configure the app's status bar style.

Inside app/_layout.tsx:

  1. Import StatusBar from expo-status-bar.
  2. Group the StatusBar and existing Stack components with React's Fragment component.
app/_layout.tsx
import { Stack } from "expo-router";
import { StatusBar } from "expo-status-bar";

export default function RootLayout() {
  return (
    <>
      <Stack>
        <Stack.Screen name="(tabs)" options={{ headerShown: false }} />
        <Stack.Screen name="+not-found" />
      </Stack>
      <StatusBar style="light" />
    </>
  );
}

Let's take a look at our app now on Android, and iOS:

2

App icon

Inside the project, there's an icon.png file inside the assets/images directory. This is our app icon. It's a 1024px by 1024px image and looks as shown below:

Like the splash screen image, the "icon" property in the app.json file configures the app icon's path. By default, a new Expo project defines the correct path to "./assets/images/icon.png". We don't have to change anything.

Eventually, when you'll build your app for the app stores, Expo Application Services (EAS) will take this image and create optimized icon for every device.

You can see the icon in various places in Expo Go. Here is an example of the app icon displayed in the developer menu of Expo Go:

3

Splash screen

A splash screen is visible before the app's content is loaded. It uses a smaller image, such as an app's icon, which is centered. It hides once the app's content is ready to be displayed.

The expo-splash-screen plugin already comes pre-installed in every project created using create-expo-app. This library provides a config plugin to configure the splash screen.

In app.json, the expo-splash-screen plugin is already configured to use the app's icon as the splash screen image with the following snippet so we don't have to change anything. Let's take a look at our app now on Android and iOS:

Is the app loading too quickly for you to get a good look at the splash screen?

You can display the splash screen for longer intervals by using preventAutoHideAsync() method from expo-splash-screen library. This method delays hiding the splash screen until you call hideAsync().

Add the following code in app/_layout.tsx to delay hiding the splash screen for five seconds.

app/_layout.tsx
import * as SplashScreen from 'expo-splash-screen';

SplashScreen.preventAutoHideAsync();
setTimeout(SplashScreen.hideAsync, 5000);

Don't forget to remove this code when you are done testing your splash screen.

Summary

Chapter 9: Configure status bar, splash screen and app icon

Well done! We built an app that runs on Android, iOS, and the web from the same codebase.

The next section of the tutorial will guide you toward resources to learn more about concepts we've covered here and others we have mentioned briefly.

Next: Learning resources