10680b787SAman Mittal---
20680b787SAman Mittaltitle: Splash screen
30680b787SAman Mittaldescription: Learn how to create a splash screen for your Expo project and other best practices.
40680b787SAman Mittal---
50680b787SAman Mittal
60680b787SAman Mittalimport ImageSpotlight from '~/components/plugins/ImageSpotlight';
70680b787SAman Mittalimport Video from '~/components/plugins/Video';
80680b787SAman Mittalimport { Terminal } from '~/ui/components/Snippet';
90680b787SAman Mittalimport { Collapsible } from '~/ui/components/Collapsible';
100680b787SAman Mittalimport { BoxLink } from '~/ui/components/BoxLink';
11*fa939da8SAman Mittalimport { BookOpen02Icon } from '@expo/styleguide-icons';
120680b787SAman Mittal
130680b787SAman MittalA 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](/versions/latest/sdk/splash-screen).
140680b787SAman Mittal
150680b787SAman Mittal## Configure the splash screen for your app
160680b787SAman Mittal
170680b787SAman MittalThe default splash screen is a blank white screen. It can be customized using the `splash` key in the project's [**app.json**](/workflow/configuration).
180680b787SAman Mittal
190680b787SAman Mittal## Make a splash image
200680b787SAman Mittal
210680b787SAman MittalTo create a splash image, you can use this [Figma template](https://www.figma.com/community/file/1155362909441341285). It provides a bare minimum design for an icon and splash images for Android and iOS.
220680b787SAman Mittal
230680b787SAman MittalFor an in-detail walkthrough, see the video below:
240680b787SAman Mittal
250680b787SAman Mittal<Video url="https://youtu.be/QSNkU7v0MPc" />
260680b787SAman Mittal
270680b787SAman Mittal### Android
280680b787SAman Mittal
290680b787SAman MittalAndroid screen sizes vary greatly with the massive variety of devices on the market. One strategy to deal with this is to look at the most common resolutions and design around that &mdash; [you can see a list of devices and their resolutions here](https://material.io/resources/devices/). Given that you can resize and crop our splash image automatically, you can stick with our dimensions as long as you don't depend on the splash image fitting the screen exactly. This is convenient because you can use one splash image for Android and iOS &mdash; less for you to read in this guide and less work for you to do.
300680b787SAman Mittal
310680b787SAman Mittal### iOS
320680b787SAman Mittal
330680b787SAman MittalThe [iOS Human Interface Guidelines](https://developer.apple.com/design/human-interface-guidelines/foundations/layout#specifications) list the device's screen sizes. In the video example, we use `1242` pixels wide (the width of the widest iPhone at the moment of writing) and `2436` pixels tall (the height of the tallest iPhone at the moment of writing). Expo will resize the image for you depending on the size of the device's size, and you can specify the strategy used to resize the image with [`splash.resizeMode`](/versions/latest/config/app/#resizemode).
340680b787SAman Mittal
350680b787SAman Mittal## Export the splash image as a .png
360680b787SAman Mittal
370680b787SAman MittalAfter creating your splash screen, export it as a **.png** and save it in the **assets** directory. **Currently, only .png images are supported**. If you use another image format, making a production build of your app will fail.
380680b787SAman Mittal
390680b787SAman Mittal### Using `splash.image`
400680b787SAman Mittal
410680b787SAman MittalOpen the **app.json** and add the path as the value of `splash.image` to point to your new splash image. If you haven't renamed the default file name, it should be `./assets/splash.png`.
420680b787SAman Mittal
430680b787SAman Mittal```json app.json
440680b787SAman Mittal{
450680b787SAman Mittal  "expo": {
460680b787SAman Mittal    "splash": {
470680b787SAman Mittal      "image": "./assets/splash.png"
480680b787SAman Mittal    }
490680b787SAman Mittal  }
500680b787SAman Mittal}
510680b787SAman Mittal```
520680b787SAman Mittal
530680b787SAman MittalReopen the Expo Go and launch your project. You should see your new splash screen. However, there may be a delay before it appears in Expo Go. This doesn't happen in development builds or standalone apps. For more information, see [Differences between environments](#differences-between-environments-on-ios).
540680b787SAman Mittal
550680b787SAman Mittal> On Android, you must press the notification drawer's refresh button. On iOS, it's required to close and re-open the Expo Go to see changes to the splash screen from the **app.json**.
560680b787SAman Mittal
570680b787SAman Mittal### `splash.backgroundColor`
580680b787SAman Mittal
590680b787SAman MittalIf 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`.
600680b787SAman Mittal
610680b787SAman MittalTo resolve it, set the `splash.backgroundColor` to be the same as our splash image background color, as shown in the example below:
620680b787SAman Mittal
630680b787SAman Mittal```json app.json
640680b787SAman Mittal{
650680b787SAman Mittal  "expo": {
660680b787SAman Mittal    "splash": {
670680b787SAman Mittal      "image": "./assets/splash.png",
680680b787SAman Mittal      "backgroundColor": "#FEF9B0"
690680b787SAman Mittal    }
700680b787SAman Mittal  }
710680b787SAman Mittal}
720680b787SAman Mittal```
730680b787SAman Mittal
740680b787SAman Mittal<ImageSpotlight
750680b787SAman Mittal  alt="Splash screen with background color"
768a78d98eSAman Mittal  src="/static/images/splash-screen/backgroundColor-noodles.png"
770680b787SAman Mittal/>
780680b787SAman Mittal
790680b787SAman Mittal### `splash.resizeMode`
800680b787SAman Mittal
810680b787SAman MittalAny splash image you provide gets resized to maintain its aspect ratio and fit the resolution of the user's device.
820680b787SAman Mittal
830680b787SAman MittalYou can use two strategies for resizing: `contain` (default) and `cover`. In both cases, the splash image is within the splash screen. These work similar to the [`resizeMode`](https://reactnative.dev/docs/image/#resizemode) in React Native `<Image>`, as demonstrated below:
840680b787SAman Mittal
858a78d98eSAman Mittal<ImageSpotlight alt="Splash screen resize mode" src="/static/images/splash-screen/resizeMode.png" />
860680b787SAman Mittal
870680b787SAman MittalApplying this to an example and remove the `backgroundColor`:
880680b787SAman Mittal
890680b787SAman Mittal```json app.json
900680b787SAman Mittal{
910680b787SAman Mittal  "expo": {
920680b787SAman Mittal    "splash": {
930680b787SAman Mittal      "image": "./assets/splash.png",
940680b787SAman Mittal      "resizeMode": "cover"
950680b787SAman Mittal    }
960680b787SAman Mittal  }
970680b787SAman Mittal}
980680b787SAman Mittal```
990680b787SAman Mittal
1000680b787SAman MittalHere is the result:
1010680b787SAman Mittal
1020680b787SAman Mittal<ImageSpotlight
1030680b787SAman Mittal  alt="Splash screen resize mode with logo"
1048a78d98eSAman Mittal  src="/static/images/splash-screen/resizeMode-noodles.png"
1050680b787SAman Mittal/>
1060680b787SAman Mittal
1070680b787SAman MittalIn the above example, the image is stretched to fill the entire width while maintaining the aspect ratio. This is why the logo on the splash image ends up being larger than when `resizeMode` is set to `contain`.
1080680b787SAman Mittal
1090680b787SAman MittalTo learn the difference between `contain` and `cover` in-depth, see [blog post](http://blog.vjeux.com/2013/image/css-container-and-cover.html).
1100680b787SAman Mittal
1110680b787SAman Mittal## Custom configuration for Android and iOS
1120680b787SAman Mittal
1130680b787SAman MittalAny of the splash options can be configured on a platform basis by nesting the configuration under the `android` or `ios` in **app.json** (the same as how you would customize an icon for either platform). In addition, certain configuration options are only available on each platform:
1140680b787SAman Mittal
1150680b787SAman Mittal- On Android, you can set splash images for [different device DPIs](/versions/latest/config/app/#mdpi) from `mdpi` to `xxxhdpi`.
1160680b787SAman Mittal
1170680b787SAman Mittal- On iOS, you can set [`ios.splash.tabletImage`](/versions/latest/config/app/#tabletimage) to have a different splash image on iPads.
1180680b787SAman Mittal
1190680b787SAman Mittal<Collapsible summary="Using bare workflow?">
1200680b787SAman Mittal
1210680b787SAman MittalIf your app does not use [Expo Prebuild](/workflow/prebuild) (formerly the _managed workflow_) to generate the native `android` and `iOS` directories, then changes in the **app.json** will have no effect. For more information, see [how you can customize the configuration manually](https://github.com/expo/expo/tree/main/packages/expo-splash-screen#-installation-in-bare-react-native-projects).
1220680b787SAman Mittal
1230680b787SAman Mittal</Collapsible>
1240680b787SAman Mittal
1250680b787SAman Mittal### Splash screen API limitations on Android
1260680b787SAman Mittal
1270680b787SAman MittalOn Android, the splash screen behaves in most cases the same as on the iOS. There is a slight difference when it comes down to **standalone Android applications**.
1280680b787SAman MittalIn this scenario, extra attention should be paid to [`android.splash`](/versions/latest/config/app/#splash-2) section configuration inside **app.json**.
1290680b787SAman Mittal
1300680b787SAman MittalDepending on the `resizeMode` you will get the following behavior on Android:
1310680b787SAman Mittal
1320680b787SAman Mittal- **contain** - The splash screen API is unable to stretch or scale the splash image. As a result, the `contain` mode will initially display only the background color, and when the initial view hierarchy is mounted then `splash.image` will be displayed.
1330680b787SAman Mittal- **cover** - This mode has the limitations as **contain** for the same reasons.
1340680b787SAman Mittal- **native** - In this mode, your app will be leveraging Android's ability to present a static bitmap while the application is starting up. Android (unlike iOS) does not support stretching the provided image, so the application will present the given image centered on the screen. By default `splash.image` would be used as the `xxxdpi` resource. It's up to you to provide graphics that meet your expectations and fit the screen dimension. To achieve this, use different resolutions for [different device DPIs](/versions/latest/config/app/#mdpi) such as from `mdpi` to `xxxhdpi`.
1350680b787SAman Mittal
1360680b787SAman Mittal### Differences between environments on iOS
1370680b787SAman Mittal
1380680b787SAman MittalYour app can be opened from the Expo Go or in a standalone app, and it can be either published or in development. There are slight differences in the splash screen behavior between these environments.
1390680b787SAman Mittal
1400680b787SAman Mittal<ImageSpotlight
1410680b787SAman Mittal  alt="iOS splash screen behavior"
1420680b787SAman Mittal  src="https://media.giphy.com/media/l378l98EI0VQdwRzy/giphy.gif"
1430680b787SAman Mittal/>
1440680b787SAman Mittal
1450680b787SAman Mittal{/* TODO: (@aman) Remove the second item in the list below. The published app in Expo Go is deprecated. Instead, replace it with development builds using expo-dev-client. */}
1460680b787SAman Mittal
1470680b787SAman Mittal- **On the left**, the Expo Go loads the project currently in development. Notice that on the bottom of the splash screen, you see an information bar that shows information relevant to preparing the JavaScript and downloading it to the device. We see an orange screen before the splash image appears because the background color is set immediately. However, the image needs to be downloaded.
1480680b787SAman Mittal- **In the middle**, Expo Go loads a published app. Notice that again the splash image does not appear immediately.
1490680b787SAman Mittal- **On the right** is a standalone app. Notice that the splash image appears immediately.
1500680b787SAman Mittal
1510680b787SAman Mittal### iOS caching
1520680b787SAman Mittal
1530680b787SAman MittalIn custom iOS builds, launch screens can sometimes remain cached between builds, making it harder to test new images. Apple recommends clearing the _derived data_ folder before rebuilding, this can be done with Expo CLI by running:
1540680b787SAman Mittal
1550680b787SAman Mittal<Terminal cmd={['$ npx expo run:ios --no-build-cache']} />
1560680b787SAman Mittal
1570680b787SAman MittalSee [Apple's guide on testing launch screens](https://developer.apple.com/documentation/technotes/tn3118-debugging-your-apps-launch-screen) for more information.
1580680b787SAman Mittal
1590680b787SAman Mittal## Next step
1600680b787SAman Mittal
1610680b787SAman Mittal<BoxLink
1620680b787SAman Mittal  title="App icons"
1630680b787SAman Mittal  description="An app's icon is what your app users see on their device's home screen and app stores. Learn about how to customize your app's icon and what are the different requirements for Android and iOS."
1640680b787SAman Mittal  href="/develop/user-interface/app-icons"
165*fa939da8SAman Mittal  Icon={BookOpen02Icon}
1660680b787SAman Mittal/>
167