Book Image

React Native By Example

By : Richard Kho
Book Image

React Native By Example

By: Richard Kho

Overview of this book

React Native's ability to build performant mobile applications with JavaScript has resulted in its popularity amongst developers. Developers now have the luxury to create incredible mobile experiences that look and feel native to their platforms with the comfort of a well-known language and the popular React.js library. This book will show you how to build your own native mobile applications for the iOS and Android platforms while leveraging the finesse and simplicity of JavaScript and React. Throughout the book you will build three projects, each of increasing complexity. You will also link up with the third-party Facebook SDK, convert an app to support the Redux architecture, and learn the process involved in making your apps available for sale on the iOS App Store and Google Play. At the end of this book, you will have learned and implemented a wide breadth of core APIs and components found in the React Native framework that are necessary in creating great mobile experiences.
Table of Contents (17 chapters)
Title Page
About the Author
About the Reviewer
Customer Feedback


One thing you might have noted in our StyleSheet is a property called flex. This pertains to Flexbox, a CSS layout system that provides consistency in your layout across different screen sizes. Flexbox in React Native works similar to its CSS specification, with only a couple of differences. The most important differences to be noted are that the default flex direction has been flipped to column on React Native, as opposed to row on the Web, aligning items, by default, to the stretch property for React Native instead of flex-start in the browser, and the flex parameter only supports a single number as its value in React Native.

We will pick up a lot on Flexbox as we go through these projects; we'll start by taking a look at just the basics.


The flex property of your layout works a bit differently from how it operates in CSS. In React Native, it accepts a single digit number. If its number is a positive number (meaning greater than 0), the component that has this property will become flexible.


Your layout also accepts a property called flexDirection. There are four options for this: row, row-reverse, column, and column-reverse. These options dictate the direction that the children of your flex container will be laid out in.