Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
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

eBook
R$49.99 R$147.99
Paperback
R$183.99
Subscription
Free Trial
Renews at R$50p/m

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
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

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:

Installing Xcode

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

Note

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 https://developer.apple.com/downloads/.

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/
    
    Running the sample application

    Tip

    Downloading the example code

    You can download the example code files from your account at http://www.packtpub.com for all the Packt Publishing books you have purchased. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support 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:
    Running the sample application
  3. Press the Run button (F5) to launch the iOS simulator:
    Running the sample application

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:

A sneak peek at the sample application

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:

A sneak peek at the sample application

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:

A sneak peek at the sample application

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:

A sneak peek at the sample application

Note

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 http://facebook.github.io/react-native/docs/runningondevice.html
    */
    
    //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:
    Experimenting with the sample application
  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.

Summary

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

Description

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.

Who is this book for?

This book is for web developers who want to learn to build fast, good-looking, native mobile applications using the skills they already have. If you already have some JavaScript knowledge or are using React on the web, then you will be able to quickly get up and running with React Native for iOS and Android.

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, Length, Edition, Language, ISBN-13
Publication date : Dec 18, 2015
Length: 172 pages
Edition : 1st
Language : English
ISBN-13 : 9781785886232
Vendor :
Facebook
Category :
Languages :

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
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

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

Packt Subscriptions

See our plans and pricing
Modal Close icon
R$50 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
R$500 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just R$25 each
Feature tick icon Exclusive print discounts
R$800 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just R$25 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total R$ 640.97
Getting Started with React Native
R$183.99
React.js Essentials
R$183.99
ReactJS by Example - Building Modern Web Applications with React
R$272.99
Total R$ 640.97 Stars icon
Banner background image

Table of Contents

9 Chapters
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

Rating distribution
Full star icon Full star icon Full star icon Full star icon Full star icon 5
(1 Ratings)
5 star 100%
4 star 0%
3 star 0%
2 star 0%
1 star 0%
CrescendoLife Sep 22, 2016
Full star icon Full star icon Full star icon Full star icon Full star icon 5
The star rating is provisional--I wanted to post a timely answer/reply to those struggling to get book code functioning as previously noted. A solution was found for the issue I noted on the following url: [note: Amazon blocks all non-Amazon urls so looking for possible way to link the essential info to get code working] (title of page: RCTRootView.h' file not found #1) Steps are outlined on resolving issue. Sample code ran after this fix.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

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 www.packtpub.com/support 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 www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
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.