Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.


    Target both iPhone and iPad with React Native

    react-nativeReact Native

    By default, React Native only targets iPhone - so if you run on an iPad, it will show up as a scaled app, and won't look like a native iPad app.

    To target both iPhone and iPad, you have to change the xcode project to build it as a universal app. Do that by finding the Deployment Info section of the General tab in the app target - and switch that from iPhone to Universal.

    Then, you can run your app in either the iPhone or iPad simulator, and change the styling based on the current device.



    Become a Member to view code

    You must be a Pro Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson
    orLog In




    Instructor: In a React native projects root folder, go into the iOS folder, and then open the Xcode project. Select your application target, and under the general tab, find the deployment info section.

    By default, React native projects only support iPhone. To support both iPhone and iPad, select the universal devices option, then select your supported device orientations for both iPhone and iPad.

    You can launch the app in the iPad simulator by switching the target device to iPad, and then pressing the play button. You can run the iPhone and the iPad simulator side by side, which is very convenient when doing development for multiple devices.

    Now that you're running on both iPhone and iPad, you can do things like change how you style or lay out a screen based on the device that you're running on. For example, here I'm making this scrolling list show two images side by side if the screen is wide enough.