Book Image

React Native Cookbook

By : Crysfel Villa, Stan Bershadskiy
Book Image

React Native Cookbook

By: Crysfel Villa, Stan Bershadskiy

Overview of this book

<p>React has taken the web development world by storm, and it is only natural that the unique architecture and its ecosystem of third-party support be applied to native application development. This book will take you through the basics of React Native development all the way through to some more advanced components.</p> <p>This book covers topics in React Native ranging from adding basic UI components to successfully deploying for multiple target platforms. The book follows a top-down approach beginning with building rich user interfaces. These UIs will be created with both built-in and custom components that you will create, style, and animate.</p> <p>You will then learn about different strategies for working with data, including leveraging the popular Redux library and optimizing the performance of the application. Then, you will step further into exposing native device functionality. Finally, we will discuss how to put your application into production and maintain its reliability.</p>
Table of Contents (19 chapters)
React Native Cookbook
Credits
Foreword
About the Authors
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface

Building a complex layout for tablets using flexbox


Flexbox is really convenient when it comes to creating responsive layouts. React Native uses flexbox as a layout system, and if you are already familiar with these concepts it will be really easy for you to start creating layout of any kind.

In this recipe, we will create a layout to display a list of blog posts. Each post will be a small card with an image, an excerpt, and a button to read more. We will use flexbox to arrange the posts on the main container based on the screen size; this will allow us to handle the screen rotation by properly aligning the cards as landscape or portrait.

Getting ready

In order to follow the steps in this recipe, it is necessary to create an empty app using the React Native CLI. We are going to name the new app ComplexLayout.

How to do it...

Let's start by creating all the files and folders we will need for this recipe:

  1. First, we need a src folder where we will write all our code; inside that folder we need a...