Search icon
Cart icon
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Learning Hub
Free Learning
Arrow right icon
Over 7,000 tech titles at $9.99 each with AI-powered learning assistants on new releases
Getting Started with React Native
Getting Started with React Native

Getting Started with React Native: Learn to build modern native iOS and Android applications using JavaScript and the incredible power of React

$25.99 $9.99
Book Dec 2015 172 pages 1st Edition
$25.99 $9.99
$15.99 Monthly
$25.99 $9.99
$15.99 Monthly

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Buy Now
Table of content icon View table of contents Preview book icon Preview Book

Getting Started with React Native

Chapter 1. Exploring the Sample Application

React Native is beginning to change the game in the mobile development world. Using the skills you already have, as a web developer, you can get a set of familiar methods to build user interfaces for mobile devices. In this book, we'll walk you through many React Natives features while developing a note-taking application, which we call React Notes. While building the essential features, such as creating notes, saving notes to the device, viewing a list of saved notes, and navigating between screens, you'll learn the fundamental skills you need to develop an app of your own. You'll also have the opportunity to go beyond the basics by adding the ability to store images and geolocation data with notes. Functionality is only a part of what makes a great app — it has to be great looking as well, so we've made sure to equip you with a thorough understanding of layout and styles. By the end of the book, you will have developed a fully featured application from start to finish and have all the skills you need to share your React Native applications with the world!

In this chapter, we'll introduce you to React Notes, the sample application that you'll learn how to build. We'll even point you in the right direction if you're anxious to start tinkering with the sample app to see what happens.

This chapter will focus on the following:

  • Installing Xcode on Mac OS X

  • Running the sample application in the iOS simulator

  • Taking a look at the sample application features

  • Modifying the sample application

Installing Xcode

Getting the tools to run the sample application is simple in OS X. The easiest way to install Xcode is through the App Store. In the top right-hand bar, search for the term Xcode, and from the list of results navigate to the Xcode store page, as shown in the following screenshot:

Install or update to the latest version of Xcode by clicking on the button.


You will need to register for an Apple ID in order to download Xcode from the App Store.

You also require the command-line tools (CLT) for Xcode. A prompt will display when they need to be installed. You can also download the command-line tools directly from the Downloads for Apple developers at

Running the sample application

The source code contains the completed application that we will build throughout the book. We are going to start with running the application. The source code is already configured to run in the iOS simulator:

  1. Open the ReactNotes.xcodeproj in the ios/ folder in Xcode or from the command line:

    ReactNotes$ open ios/ReactNotes.xcodeproj/


    Downloading the example code

    You can download the example code files from your account at for all the Packt Publishing books you have purchased. If you purchased this book elsewhere, you can visit and register to have the files e-mailed directly to you.

  2. This book targets iPhone 6 for development; although it does work on other iOS versions, we recommend using this one. Make sure that the iPhone 6 is selected in the iOS simulator device drop-down menu. If you own an iPhone 6, you may select an iOS Device:

  3. Press the Run button (F5) to launch the iOS simulator:

A sneak peek at the sample application

The goal of this book is to introduce you to how quickly React Native can get you up and running to create user interfaces. No matter what type of mobile application you build, there are certain features that you're very likely to have. Your UI will probably have multiple screens, so you'll need the ability to navigate between them. In Chapter 3, Beginning with the Example Application we will start laying the foundation for navigation and the note screen:

Not long after you have seen a bare-bones application, you'll want to start making it look good. Let us dive deep into styles and layout in Chapter 4, Working with Styles and Layout, and carry those lessons throughout the rest of the book.

It's hard to imagine an application that doesn't have lists of data, and React Notes is no exception. We'll cover working with lists in Chapter 5, Displaying and Saving Data:

One of the capabilities that sets mobile applications apart from web applications is the ability to access GPS data. We present capturing geolocation data using maps in Chapter 6, Working with Geolocation and Maps:

It is very common to capture photos on mobile devices. The camera screen will allow users to attach photos to their notes and save them for viewing later. You will learn how to add camera support to your applications in Chapter 7, Using Native Modules:


Note that the camera screen will be black in the iOS simulator. This is also explained later in Chapter 7, Using Native Modules.

Experimenting with the sample application

If you are the adventurous type, then feel free to start playing around and modifying the sample application code. There are two steps to switch the iOS application into development mode:

  1. Open the AppDelegate.m file in Xcode and uncomment the jsCodeLocation assignment from OPTION 1 and comment out the statement in OPTION 2:

    NSURL *jsCodeLocation;
    * Loading JavaScript code - uncomment the one you want.
    * OPTION 1
    * Load from development server. Start the server from the repository root:
    * $ npm start
    * To run on device, change `localhost` to the IP address of your computer
    * (you can get this by typing `ifconfig` into the terminal and selecting the
    * `inet` value under `en0:`) and make sure your computer and iOS device are
    * on the same Wi-Fi network.
    jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios"];
    * OPTION 2
    * Load from pre-bundled file on disk. To re-generate the static bundle
    * from the root of your project directory, run
    * $ react-native bundle --minify
    * see
    //jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
  2. Then, navigate to Product | Scheme | Edit Scheme…. Select Run, and under the Info tab change Build Configuration from Release to Debug, as shown:

  3. Run (F5) from Xcode to start the application in development mode. Using the Shake gesture from the iOS simulator (Hardware | Shake |Gesture) will show the development menu. It may be necessary to run react-native start from the command line to load the JavaScript bundle.

That's it! From here you can freely modify any of the source code in index.ios.js or in the Components folder. Later we will explain how to quickly reload your code in the simulator without having to recompile from Xcode.


This chapter gave us a brief overview of the type of functionality and user interface we will introduce throughout the rest of the book. We will cover features such as navigation, lists, user inputs, and so on in depth. With Xcode already set up, you will be able to jump right in to iOS development, and for Android developers we begin the setup in Chapter 3, Beginning with the Example Application. Next, we will demonstrate the value that React Native offers in rapid mobile development using the skills you have learned as a web developer.

Let's get started!

Left arrow icon Right arrow icon

Key benefits

  • Learn to design and build a fully-featured application using the newest cutting-edge framework from Facebook
  • Leverage your JavaScript skills to become a native app developer
  • Develop custom UI components, implement smooth navigation, and access native features such as geolocation and local storage


React Native is a game-changing approach to hybrid mobile development. Web developers can leverage their existing skills to write mobile applications in JavaScript that are truly native without using cross-compilation or web views. These applications have all of the advantages of those written in Objective-C or Java, combined with the rapid development cycle that JavaScript developers are accustomed to. Web developers who want to develop native mobile applications face a high barrier to entry, because they are forced to learn platform-specific languages and frameworks. Numerous hybrid technologies have tried to simplify this process, but have failed to achieve the performance and appearance that users expect. This book will show you all the advantages of true native development that React Native has without the steep learning curve, leveraging the knowledge you already have. We do this by getting you up and running quickly with a sample application. Next, we’ll introduce you to the fundamentals of creating components and explain how React Native works under the hood. Once you have established a solid foundation, you will dive headfirst into developing a real-world application from start to finish. Along the way, we will demonstrate how to create multiple screens and navigate between them,use layout and style native UI components, and access native APIs such as local storage and geolocation. Finally, we tackle the advanced topic of Native modules, which demonstrates that there are truly no limits to what you can do with React Native.

What you will learn

[*]Set up the React Native environment on both devices and emulators [*]Gain an in-depth understanding of how React Native works behind the scenes [*]Write your own custom native UI components [*]Learn the ins and outs of screen navigation [*]Master the art of layout and styles [*]Work with device-exclusive data such as geolocation [*]Develop native modules in Objective-C and Java that interact with JavaScript [*]Test and deploy your application for a production-ready environment

Product Details

Country selected

Publication date : Dec 18, 2015
Length 172 pages
Edition : 1st Edition
Language : English
ISBN-13 : 9781785885181
Vendor :
Category :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Buy Now

Product Details

Publication date : Dec 18, 2015
Length 172 pages
Edition : 1st Edition
Language : English
ISBN-13 : 9781785885181
Vendor :
Category :

Table of Contents

15 Chapters
Getting Started with React Native Chevron down icon Chevron up icon
Credits Chevron down icon Chevron up icon
About the Authors Chevron down icon Chevron up icon
About the Reviewer Chevron down icon Chevron up icon Chevron down icon Chevron up icon
Preface Chevron down icon Chevron up icon
1. Exploring the Sample Application Chevron down icon Chevron up icon
2. Understanding React Native Fundamentals Chevron down icon Chevron up icon
3. Beginning with the Example Application Chevron down icon Chevron up icon
4. Working with Styles and Layout Chevron down icon Chevron up icon
5. Displaying and Saving Data Chevron down icon Chevron up icon
6. Working with Geolocation and Maps Chevron down icon Chevron up icon
7. Integrating Native Modules Chevron down icon Chevron up icon
8. Releasing the Application Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Empty star icon Empty star icon Empty star icon Empty star icon Empty star icon 0
(0 Ratings)
5 star 0%
4 star 0%
3 star 0%
2 star 0%
1 star 0%
Filter icon Filter
Top Reviews

Filter reviews by

No reviews found
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial


How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to
  • To contact us directly if a problem is not resolved, use
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.