React Native in Action
Developing iOS and Android apps with JavaScript
Nader Dabit
  • March 2019
  • ISBN 9781617294051
  • 320 pages
  • printed in black & white

Learn how to utilize your existing JavaScript skills to create rich cross-platform mobile apps.

Ian Lovell, Parmenion Capital Partners

React Native in Action gives iOS, Android, and web developers the knowledge and confidence they need to begin building high-quality iOS and Android apps using the React Native framework.

About the Technology

React Native gives mobile and web developers the power of "and." Write your app once and easily deploy it to iOS and Android and the web. React Native apps compile into platform-specific code, reducing development time, effort, and cost! And because you're using JavaScript and the React framework, you benefit from a huge ecosystem of tools, expertise, and support.

About the book

React Native in Action teaches you to build high-quality cross-platform mobile and web apps. In this hands-on guide, you'll jump right into building a complete app with the help of clear, easy-to-follow instructions. As you build your skills, you'll drill down to more-advanced topics like styling, APIs, animations, data architecture, and more! You'll also learn how to maximize code reuse without sacrificing native platform look-and-feel.

Table of Contents detailed table of contents

Part 1: Getting started with React Native

1 Getting started with React Native

1.1 Introducing React and React Native

1.1.1 A basic React class

1.1.2 React lifecycle

1.2 What you’ll learn

1.3 What you should know

1.4 Understanding how React Native works

1.4.1 JSX

1.4.2 Threading

1.4.3 React

1.4.4 Unidirectional data flow

1.4.5 Diffing

1.4.6 Thinking in components

1.5 Acknowledging React Native’s strengths

1.5.1 Developer availability

1.5.2 Developer productivity

1.5.3 Performance

1.5.4 One-way data flow

1.5.5 Developer experience

1.5.6 Transpilation

1.5.7 Productivity and efficiency

1.5.8 Community

1.5.9 Open source

1.5.10 Immediate updates

1.5.11 Other solutions for building cross-platform mobile applications

1.6 React Native’s drawbacks

1.7 Creating and using basic components

1.7.1 An overview of components

1.7.2 Native components

1.7.3 Component composition

1.7.4 Exportable components

1.7.5 Combining components

1.8 Creating a starter project

1.8.1 Create React Native App CLI

1.8.2 React Native CLI


2 Understanding React

2.1 Managing component data using state

2.1.1 Correctly manipulating component state

2.2 Managing component data using props

2.3 React component specifications

2.3.1 Using the render method to create a UI

2.3.2 Using property initializers and constructors

2.4 React lifecycle methods

2.4.1 The static getDerivedStateFromProps method

2.4.2 The componentDidMount lifecycle method

2.4.3 The shouldComponentUpdate lifecycle method

2.4.4 The componentDidUpdate lifecycle method

2.4.4 The componentDidUpdate lifecycle method


3 Building your first React Native app

3.1 Laying out the Todo app

3.2 Coding the todo app

3.3 Opening the developer menu

3.3.1 Opening the developer menu in the iOS simulator

3.3.2 Opening the developer menu in the Android emulator

3.3.3 Using the developer menu

3.4 Continuing building the todo app


Part 2: Developing applications in React Native

4 Introduction to styling

4.1 Applying and organizing styles in React Native

4.1.1 Applying styles in applications

4.1.2 Organizing styles

4.1.3 Styles are code

4.2 Styling view components

4.2.1 Setting the background color

4.2.2 Setting border properties

4.2.3 Specifying margins and padding

4.2.4 Using position to place components

4.2.5 Profile Card positioning

4.3 Styling Text components

4.3.1 Text components vs. View components

4.3.2 Font styles

4.3.3 Using decorative text styles


5 Styling in depth

5.1 Platform-specific sizes and styles

5.1.1 Pixels, points, and DPs

5.1.2 Creating drop shadows with ShadowPropTypesIOS and Elevation

5.1.3 Putting it into practice: drop shadows in the ProfileCard

5.2 Using transformations to move, rotate, scale, and skew components

5.2.1 3D effects with perspective

5.2.2 Moving elements along the x- and y-axes with translateX and translateY

5.2.3 Rotating elements with rotateX, rotateY, and rotateZ (rotate)

5.2.4 Setting visibility when rotating an element more than 90°

5.2.5 Scaling objects on the screen with scale, scaleX, and scaleY

5.2.6 Using the scale transform to create a thumbnail of the ProfileCard

5.2.7 Skewing elements along the x- and y-axes with skewX and skewY

5.2.8 Transformation key points

5.3 Using flexbox to lay out components

5.3.1 Altering a component’s dimensions with flex

5.3.2 Specifying the direction of the flex with flexDirection

5.3.3 Defining how space is used around a component with justifyContent

5.3.4 Aligning children in a container with alignItems

5.3.5 Overriding the parent container’s alignment with alignSelf

5.3.6 Preventing clipped items with flexWrap


6 Navigation

6.1 React Native navigation vs. web navigation

6.2 Building a navigation-based app

6.3 Persisting data

6.4 Using DrawerNavigator to create drawer-based navigation


7 Animations

7.1 Introducing the Animated API

7.2 Animating a form input to expand on focus

7.3 Creating a custom loading animation using interpolation

7.4 Creating multiple parallel animations

7.5 Creating an animated sequence

7.6 Using Animated.stagger to stagger animation start times

7.7 Other useful tips for using the Animated library


8 Using the Redux data architecture library

8.1 What is Redux?

8.2 Using context to create and manage global state in a React application

8.3 Implementing Redux with a React Native app

8.4 Creating Redux reducers to hold Redux state

8.5 Adding the provider and creating the store

8.6 Accessing data using the connect function

8.7 Adding actions

8.8 Deleting items from a Redux store in a reducer


Part 3: API reference

9 Implementing

9.1 Using the Alert API to create cross-platform notifications

9.1.1 Use cases for alerts

9.1.2 Example of using alerts

9.2 Using the AppState API to detect the current application state

9.2.1 Use cases for AppState

9.2.2 Example of using AppState

9.3 Using the AsyncStorage API to persist data

9.3.1 Use cases for AsyncStorage

9.3.2 Example of using AsyncStorage

9.4 Using the Clipboard API to copy text into the user’s clipboard

9.4.1 Use cases for Clipboard

9.4.2 Example of using Clipboard

9.5 Using the Dimensions API to get the user’s screen information

9.5.1 Use cases for the Dimensions API

9.5.2 Example of using the Dimensions API

9.6 Using the Geolocation API to get the user’s current location information

9.6.1 Use cases for the Geolocation API

9.6.2 Example of using Geolocation

9.7 Using the Keyboard API to control the location and functionality of the native keyboard

9.7.1 Use cases for the Keyboard API

9.7.2 Example of using the Keyboard API

9.8 Using NetInfo to get the user’s current online/offline status

9.8.1 Use cases for NetInfo

9.8.2 Example of using NetInfo

9.9 Getting information about touch and gesture events with PanResponder

9.9.1 Use cases for the PanResponder API

9.9.2 Example of using PanResponder


10 Implementing iOS-specific components and APIs

10.1 Targeting platform-specific code

10.1.1 iOS and Android file extensions

10.1.2 Detecting the platform using the Platform API

10.2 DatePickerIOS

10.3 Using PickerIOS to work with lists of values

10.3.1 Example of using PickerIOS

10.4 Using ProgressViewIOS to show loading indicators

10.4.1 Use cases for ProgressViewIOS

10.4.2 Example of using ProgressViewIOS

10.5 Using SegmentedControlIOS to create horizontal tab bars

10.5.1 Use cases for SegmentedControlIOS

10.5.2 Example of using SegmentedControlIOS

10.6 Using TabBarIOS to render tabs at the bottom of the UI

10.6.1 Use cases for TabBarIOS

10.6.2 Example of using TabBarIOS

10.7 Using ActionSheetIOS to show action or share sheets

10.7.1 Use cases for ActionSheetIOS

10.7.2 Example of using ActionSheetIOS


11 Implementing Android-specific components and APIs

11.1 Creating a menu using DrawerLayoutAndroid

11.2 Creating a toolbar with ToolbarAndroid

11.3 Implementing scrollable paging with ViewPagerAndroid

11.4 Using the DatePickerAndroid API to show a native date picker

11.5 Creating a time picker with TimePickerAndroid

11.6 Implementing Android Toasts using ToastAndroid


Part 4: Bringing it all together

12 Building a Star Wars app using cross-platform components

12.1 Creating the app and installing dependencies

12.1.1 Importing the People component and creating the Container component

12.1.2 Creating the navigation component and registering routes

12.1.3 Creating the main class for the initial view

12.2 Creating the People component using FlatList, Modal, and Picker

12.2.1 Creating the state and setting up a fetch call to retrieve data

12.2.2 Adding the remaining class methods

12.2.3 Implementing the render method

12.3 Creating the HomeWorld component

12.3.1 Creating the HomeWorld class and initializing state

12.3.2 Fetching data from the API using the url prop

12.3.3 Wrapping up the HomeWorld component



Appendix A: Installing and running React Native

A.1 Developing for iOS devices

A.1.1 Getting started

A.1.2 Testing the installation on iOS

A.2 Developing for Android devices

A.2.1 Mac and Android

A.2.2 Windows and Android

A.2.3 Linux and Android

A.2.4 Creating a new project (Mac/Windows/Linux)

A.2.5 Running a project (Mac/Windows/Linux)

What's inside

  • Building cross-platform mobile and web apps
  • Routing, Redux, and animations
  • Cross-network data requests
  • Storing and retrieving data locally
  • Managing data and state

About the reader

Written for beginner-to-intermediate web, Android, and iOS developers.

About the author

Nader Dabit is a developer advocate at AWS Mobile, where he works on tools and services to allow developers to build full-stack web and mobile applications using their existing skillset. He is also the founder of React Native Training and the host of the "React Native Radio" podcast.

placing your order...

Don't refresh or navigate away from the page.
print book $29.99 $49.99 pBook + eBook + liveBook
Additional shipping charges may apply
React Native in Action (print book) added to cart
continue shopping
go to cart

eBook $31.99 $39.99 3 formats + liveBook
React Native in Action (eBook) added to cart
continue shopping
go to cart

Prices displayed in rupees will be charged in USD when you check out.
customers also reading

This book 1-hop 2-hops 3-hops

FREE domestic shipping on three or more pBooks