AirBnB Clone with React Native Part 10: Implementing a splash screen [iOS]
Tags: heartbeat, ios, mobiledevelopment, reactnative
Published: 2020-01-28 16:13:03

---
title: AirBnB Clone with React Native Part 10: Implementing a splash screen [iOS]
published: true
date: 2019-12-30 16:11:01 UTC
tags: heartbeat,ios,mobile-development,react-native
canonical_url: https://heartbeat.fritz.ai/airbnb-clone-with-react-native-part-10-implementing-a-splash-screen-ios-f391aee742d3
cover_image: https://cdn-images-1.medium.com/max/1024/1*iIEhgq6z5aE3Ipn7Ejz8GQ.jpeg
---


This tutorial is the tenth chapter of our implementation of an [AirBnB clone in React Native](https://www.instamobile.io/). In the previous chapter, we successfully implemented a persistent login state and logout with Firebase before adding a drawer navigator.

If you missed any of the previous tutorials, we recommend that you follow them first by going through the following links:

- [AirBnB Clone with React Native Part 1: Home Screen UI](https://heartbeat.fritz.ai/airbnb-clone-with-react-native-part-1-home-screen-ui-b5ed1c9278ae)
- [AirBnB Clone with React Native Part 2: Login Screen UI](https://heartbeat.fritz.ai/airbnb-clone-with-react-native-part-2-login-screen-ui-999773e860e4)
- [AirBnB Clone with React Native Part 3: Email Authentication with Firebase](https://heartbeat.fritz.ai/airbnb-clone-with-react-native-part-3-email-authentication-with-firebase-2153a00175ab)
- [AirBnB Clone with React Native Part 4: Login error notifications](https://heartbeat.fritz.ai/airbnb-clone-with-react-native-part-4-login-error-notifications-580beb4fc03c)
- [AirBnB Clone with React Native Part 5: Loading Modal Implementation](https://heartbeat.fritz.ai/airbnb-clone-with-react-native-part-5-loading-modal-implementation-8a399154ac02)
- [AirBnB Clone with React Native Part 6: Animated Checkmarks](https://heartbeat.fritz.ai/airbnb-clone-with-react-native-part-6-animated-checkmarks-5917e4972702)
- [AirBnB Clone with React Native Part 7: “Forgot Password?” with Firebase](https://heartbeat.fritz.ai/airbnb-clone-with-react-native-part-7-forgot-password-with-firebase-14ccbf6afa21)
- [AirBnB Clone with React Native Part 8: Firebase Facebook Login (iOS)](https://heartbeat.fritz.ai/airbnb-clone-with-react-native-part-8-firebase-facebook-login-ios-f2cd4b73fe7d)
- [AirBnB Clone with React Native Part 9: Persistent login, drawer navigation, and logout](https://heartbeat.fritz.ai/airbnb-clone-with-react-native-part-9-persistent-login-drawer-navigation-and-logout-7a6f08a8ec56)

In this chapter, we’ll continue developing our AirBnB clone in React Native by adding a splash screen. A splash screen is a screen that displays an app’s logo upon opening and before continuing to the main screen. The task of adding a splash screen is rather simple, even though the process involves several steps. This chapter will only focus on adding a splash screen for an iOS app.

Let’s begin!

![](https://cdn-images-1.medium.com/max/363/1*voXgeP9GsFfBdgRap_ZRhw.gif)<figcaption>Airbnb splashscreen</figcaption>

If you pay attention to the original AirBnB splash screen, which you see in the short video above, you’ll notice the simple screen that shows only the AirBnB logo for a second or two before continuing to the main screen.

## Download the AirBnB Logo

You can download the Airbnb logo [here.](https://www.cleanpng.com/png-airbnb-logo-coupon-privately-held-company-airbnb-l-2956132/download-png.html)

![](https://cdn-images-1.medium.com/max/260/1*PSAMnq35yFzdUF6H5f1Muw.jpeg)

### Design the Splash Screen in Xcode

Open our AirBnB clone project in Xcode and select the file airbnbclone.xcworkspace

![](https://cdn-images-1.medium.com/max/1024/1*qAyUXtgm8CROrHEAGingHw.png)

Then select the folder **Images.xcassets** and click on the option “New Image Set”.

![](https://cdn-images-1.medium.com/max/762/1*WfSkDvFFZMoKJf01GlDUbQ.png)

Name the new image set as “splash screen” and add the previously downloaded AirBnB logo to the image set.

![](https://cdn-images-1.medium.com/max/907/1*GBQ7kz8q0FsqZ4ANaGdlMw.png)

Next, open the file named **LunchScreen.xib.**

![](https://cdn-images-1.medium.com/max/1024/1*a8_qIk9OKGlzGixzKTmMTQ.png)

Remove the default text from the file and choose the option to add a new image view.

![](https://cdn-images-1.medium.com/max/962/1*2UGRicRSADy_PAsWU11JQQ.png)

Pick the previously created splash screen image set as the image source.

![](https://cdn-images-1.medium.com/max/1024/1*8_Ln0JjlPyy-WqToKVyrQQ.png)

You can select the ruler icon on top of the sidebar to allow auto-resizing.

![](https://cdn-images-1.medium.com/max/255/1*LxnOUbee1vylCNJYIqkyUg.png)

Now we have a fully-designed splash screen. That’s all it took!

> Looking for new ways to elevate your mobile app’s user experience? [With Fritz AI, you can teach your apps to see, hear, sense, and think. Learn how and start building with a free account.](https://www.fritz.ai/product/standard.html?utm_campaign=buildapps9&utm_source=heartbeat)

## Install React Native’s Splash Screen Package

The splash screen package in React Native makes it easier to handle the app’s splash screen. We can install this package, [react-native-splash-screen](https://github.com/crazycodeboy/react-native-splash-screen), by running the following command with Yarn.

```
yarn add react-native-splash-screen
```

For iOS, we need to install the pod dependency by running the following command:

```
cd ios ; pod install
```

## Activate the Splash Screen Using Xcode

After successfully installing the package, we can add it to the Xcode project by selecting **Add File to “airbnbclone”** under the **File**  menu.

![](https://cdn-images-1.medium.com/max/312/1*xD4xie59C_dSzUaV1AUH9A.png)

Following the path **node\_modules** ➜ **react-native-splash-screen** ➜ ios

![](https://cdn-images-1.medium.com/max/1024/1*eWHpKb73s-eJwsyval1fsQ.png)

Then, add the file SplashScreen.xcodeproj to the project, as shown in the image below.

![](https://cdn-images-1.medium.com/max/268/1*paBwXpEjsatVS_HQEbsN1w.png)

Go to the path Build Settings → Search Paths → Header Search Paths and add the following path, as shown in the image below.

**$(SRCROOT)/../node\_modules/react-native-splash-screen/ios**

![](https://cdn-images-1.medium.com/max/907/1*qxcoenvM0zyYHxUv-3E3CA.png)

Now we can activate the splash screen in the **AppDelegate.m** file. Here, the package is imported as **RNSplashScreen.h.** To activate the package, we need to add [RNSplashScreen show], as shown in the example below.

![](https://cdn-images-1.medium.com/max/776/1*xYtPyH5EON5hH4k-PiYmjQ.png)

This concludes the activation of the splash screen.

> The next revolution in mobile development? Machine learning. Don’t miss out on the latest from this emerging intersection. [Sign up for weekly updates from our crew of mobile devs and machine learners.](https://www.fritz.ai/newsletter?utm_campaign=heartbeat-newsletter-fomo2&utm_source=heartbeat)

## Hide the Splash Screen After Displaying

After a couple of seconds, when the app starts up and brings the user to the Home screen, we’ll want to hide the splash screen. To adopt this behavior, first, import react-native-splash-screen and call the hide() function provided in the package inside the ComponentDidMount method.

{% gist https://gist.github.com/krissnawat/38d17984ea4b34b025599997c2b08692 %}

Next, we need to call the hide() function provided by the SplashScreen module inside the componentDidMount function, as shown in the code snippet below:

{% gist https://gist.github.com/krissnawat/072c8ba7b1d9b6c332d0c7d6838e9cbb %}

The addition of a fully-functioning splash screen to our AirBnB clone app is now complete!

![](https://cdn-images-1.medium.com/max/338/1*han2-uPV6Y2jj7YtYiqa2g.gif)

### Summary

In this chapter, we learned how to set up a splash screen in an iOS mobile app on Xcode. We also learned how to alter this screen using the react-native-splash-screen package. Finally, we learned how to hide the splash screen once the app itself has loaded.

_Editor’s Note:_ **_Heartbeat_** _is a contributor-driven online publication and community dedicated to exploring the emerging intersection of mobile app development and machine learning. We’re committed to supporting and inspiring developers and engineers from all walks of life._

_Editorially independent, Heartbeat is sponsored and published by_[**_Fritz AI_**](http://fritz.ai/)_, the machine learning platform that helps developers teach devices to see, hear, sense, and think. We pay our contributors, and we don’t sell ads._

_If you’d like to contribute, head on over to our_[**_call for contributors_**](https://heartbeat.fritz.ai/call-for-contributors-october-2018-update-fee7f5b80f3e)_. You can also sign up to receive our weekly newsletters (_[**_Deep Learning Weekly_**](https://www.deeplearningweekly.com/) _and_[**_Heartbeat_**](https://www.fritz.ai/newsletter)_), join us on_[](https://join.slack.com/t/fritz-ai-community/shared_invite/enQtNTY5NDM2MTQwMTgwLWU4ZDEwNTAxYWE2YjIxZDllMTcxMWE4MGFhNDk5Y2QwNTcxYzEyNWZmZWEwMzE4NTFkOWY2NTM0OGQwYjM5Y2U)[**_Slack_**](http://fritz.ai/slack)_, and follow Fritz AI on_[**_Twitter_**](https://twitter.com/fritzlabs) _for all the latest in mobile machine learning._

* * *