Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
React Native Cookbook
React Native Cookbook

React Native Cookbook: Recipes for solving common React Native development problems , Second Edition

eBook
£15.99 £23.99
Paperback
£29.99
Subscription
Free Trial
Renews at £16.99p/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
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

React Native Cookbook

Creating a Simple React Native App

In this chapter, we'll cover the following recipes:

  • Adding styles to elements
  • Using images to mimic a video player
  • Creating a toggle button
  • Displaying a list of items
  • Using flexbox to create a layout
  • Setting up and using navigation

React Native is a fast-growing library. Over the last few years it has become very popular among the open source community. There's often a new release every other week that improves performance, adds new components, or provides access to new APIs on the device.

In this chapter, we'll learn about the most common components in the library. To step through all of the recipes in this chapter, we'll have to create a new application, so make sure you have your environment up and running.

Adding styles to elements

We have several components at our disposal, but containers and text are the most common and useful components to create layouts or other components. In this recipe, we'll see how to use containers and text, but most importantly we'll see how styles work in React Native.

Getting ready

Follow the instructions in the previous chapter in order to create a new application. We'll name this application fake-music-player.

When creating a new application with Expo, a small amount of boilerplate code will be added to the App.js file in the root folder. This will be the starting point of any React Native application you build. Feel free to remove all boilerplate at the beginning of each recipe...

Using images to mimic a video player

Images are an important part of any UI, whether we use them to display icons, avatars, or pictures. In this recipe, we'll use images to create a mock video player. We'll also display the icons from the local device and a large image from a remote server (hosted by Flickr).

Getting ready

In order to follow the steps in this recipe, let's create a new application. We're going to name it fake-video-player.

We're going to display a few images in our application to mimic a video player, so you'll need corresponding images for your application. I recommend using the icons I used by downloading them from the repository for this recipe on GitHub at https://github.com...

Creating a toggle button

Buttons are an essential UI component in every application. In this recipe, we'll create a toggle button, which will be unselected by default. When the user taps on it, we'll change the styles applied to the button to make it appear selected.

We'll learn how to detect the tap event, use an image as the UI, keep the state of the button, and add styles based on the component state.

Getting ready

Displaying a list of items

Lists are everywhere: a list of orders in the user's history, a list of available items in a store, a list of songs to play. Nearly any application will need to display some kind of information in a list.

For this recipe, we're going to display several items in a list component. We're going to define a JSON file with some data, then we're going to load this file using a simple require to finally render each item with a nice but simple layout.

Getting ready

Let's start by creating an empty app. We'll name this application list-items. We're going to need an icon to display on each item. The easiest way to get images is to download them from this recipe's repository...

Using flexbox to create a layout

In this recipe, we'll learn about flexbox. In the previous recipes in this chapter, we've been using flexbox to create layouts, but in this recipe, we'll focus on the properties we have at our disposal by recreating the layout from a random name generator application on the App Store called Nominazer (https://itunes.apple.com/us/app/nominazer/id765422087?mt=8).

Working in flexbox in React Native is essentially the same as working with flexbox in CSS. This means if you're comfortable developing websites with a flexbox layout, then you already know how to create layouts in React Native! This exercise will cover the basics of working with flexbox in React Native, but for a list of all of the layout props you can use, refer to the documentation on Layout Props (https://facebook.github.io/react-native/docs/layout-props.html).

...

Setting up and using navigation

For any application that has more than one view, a navigation system is of paramount importance. The need for navigation is so pervasive in application development that Expo provides two templates when you create a new application: Blank or Tab Navigation. This recipe is based on a very pared down version of the Tab Navigation app template provided by Expo. We'll still begin the recipe with a Blank app and build our basic Tab Navigation app from scratch to better understand all of the requisite parts. After completing this recipe, I encourage you to start a new app with the Tab Navigation template to see some of the more advanced features we'll be covering in later chapters, including push notifications and stack navigation.

Getting ready

...
Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Learn strategies and techniques to face React Native mobile development challenges head-on
  • Explore ways to use iOS and Android for React Native development to maximize code reuse and cohesion
  • Build engaging user experiences with React Native

Description

If you are a developer looking to create mobile applications with maximized code reusability and minimized cost, React Native is what you need. With this practical guide, you’ll be able to build attractive UIs, tackle common problems in mobile development, and achieve improved performance in mobile environments. This book starts by covering the common techniques for React Native customization and helps you set up your development platforms. Over the course of the book, you’ll work through a wide variety of recipes that help you create, style, and animate your apps with built-in React Native and custom third-party components. You’ll also develop real-world browser-based authentication, build a fully functional audio player, and integrate Google Maps in your apps. This book will help you explore different strategies for working with data, including leveraging the popular Redux library and optimizing your app’s dataflow. You’ll also learn how to write native device functionality for new and existing React Native projects and how app deployment works. By the end of this book, you'll be equipped with tips and tricks to write efficient code and have the skills to build full iOS and Android applications using React Native.

Who is this book for?

If you're a JavaScript developer looking for a practical guide for developing feature-rich mobile apps using React Native, this book is for you. Though not necessary, some experience of working with React will help you understand the React Native concepts covered in this book easily. While React Native development can be done on a Windows machine, certain aspects, such as running your apps on iOS devices and in the iOS simulator, or editing native code with Xcode, can only be done with a Mac.

What you will learn

  • Build UI features and components using React Native
  • Create advanced animations for UI components
  • Develop universal apps that run on phones and tablets
  • Leverage Redux to manage application flow and data
  • Expose both custom native UI components and application logic to React Native
  • Employ open source third-party plugins to create React Native apps

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Jan 31, 2019
Length: 592 pages
Edition : 2nd
Language : English
ISBN-13 : 9781788990431
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
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Jan 31, 2019
Length: 592 pages
Edition : 2nd
Language : English
ISBN-13 : 9781788990431
Category :
Languages :

Packt Subscriptions

See our plans and pricing
Modal Close icon
£16.99 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
£169.99 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 £5 each
Feature tick icon Exclusive print discounts
£234.99 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 £5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total £ 96.97
React Native Cookbook
£29.99
Hands-On Full-Stack Web Development with GraphQL and React
£36.99
React Projects
£29.99
Total £ 96.97 Stars icon

Table of Contents

16 Chapters
Setting Up Your Environment Chevron down icon Chevron up icon
Creating a Simple React Native App Chevron down icon Chevron up icon
Implementing Complex User Interfaces - Part I Chevron down icon Chevron up icon
Implementing Complex User Interfaces - Part II Chevron down icon Chevron up icon
Implementing Complex User Interfaces - Part III Chevron down icon Chevron up icon
Adding Basic Animations to Your App Chevron down icon Chevron up icon
Adding Advanced Animations to Your App Chevron down icon Chevron up icon
Working with Application Logic and Data Chevron down icon Chevron up icon
Implementing Redux Chevron down icon Chevron up icon
App Workflow and Third-Party Plugins Chevron down icon Chevron up icon
Adding Native Functionality - Part I Chevron down icon Chevron up icon
Adding Native Functionality - Part II Chevron down icon Chevron up icon
Integration with Native Applications Chevron down icon Chevron up icon
Deploying Your App Chevron down icon Chevron up icon
Optimizing the Performance of Your App Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Half star icon Empty star icon 3.2
(6 Ratings)
5 star 33.3%
4 star 0%
3 star 33.3%
2 star 16.7%
1 star 16.7%
Filter icon Filter
Top Reviews

Filter reviews by




MG Sep 30, 2020
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Informative
Amazon Verified review Amazon
Jordan Jun 04, 2019
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I purchased React Native in Action before this book and feel in just the first 2 chapters of this book it covered everything React Native in Action covered in the entire book.I finished React Native in Action and felt like I still had so much more to learn, this book has great depth and I really like that it uses expo to do a lot of its explanation as that's kind of standard at this time.
Amazon Verified review Amazon
MR M J REGAN Oct 21, 2020
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
I was quite enjoying working through the book, however the depreciated ListView component has rendered an example in the 2nd chapter unrunnable. Clearly I could research and fix this, but that is what I do normally. The book was to enable me to get through the work swiftly, at which it has failed. The downloaded online example from Git did not fix this. A question on the subject from July remains unanswered. So all in all, I'm feeling a little deflated. Happy to amend the rating once the issue is resolved in the download.
Amazon Verified review Amazon
PK Sep 23, 2019
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
My main concern with this book is that it uses outdated code. For example, ListView, React Navigation version 1 and componentWillMount are all deprecated, and the newer versions are substantially different. This is a pity, because these crop up throughout the text.The second issue is that the format is confusing. The code is described first once, as it's introduced, and then again, in a section explaining 'how it's done'. There is no obvious reason for this split. The format used in Manning books, in which the code is printed out in full, with annotations explaining each section, would be much more helpful.Third, as with all Packt books, the index is largely useless.On the plus side, this is one of the few Packt books written by someone with a good grasp of English. There are mistakes - such as wrong function names and the usual catalogue of grammatical and punctuation errors - which would have been caught if the proof-reader had done his job. However, unlike with most of Packt's books, this author is a native English speaker, so the quality of the writing is good enough that a few mistakes don't matter too much. One gets the feeling that he actually cares about the quality of his work, which is a refreshing change. Having said that, part of the job of a publisher is to edit and proof-read the text. For example, screenshots throughout the book are from the version of Genymotion limited to personal use, showing that the author hadn't bought a licence. This doesn't affect the book, but it does illustrate the total lack of editorial oversight.
Amazon Verified review Amazon
Anónimo Jun 05, 2023
Full star icon Full star icon Empty star icon Empty star icon Empty star icon 2
Demasiado código repetitivo sin centrarse en el tema que intenta explicar. Se podía haber escrito el contenido relevante con la mitad de las páginas.Las imágenes son en blanco y negro.No aborda librerías disponibles que enriquecen la APP final.
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.