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

Keeping our animations running at 60 FPS


An important aspect of our application is the fluidity of our user interface. Animations are used to give a sense of this rich user experience. We can employ animations for all sorts of interactions, from changing entire views, to reacting to a user's touch interaction on a component. The most important factor after having a visually appealing animation is to make sure it does not stop the JavaScript thread. In order to keep our animations fluid and not interrupt the UI interactions, our render loop has to render each frame in 16.67 ms.

In this recipe, we will take a look at several techniques for improving the performance of our animations. These techniques focus on preventing JavaScript execution interrupting the main thread.

Getting ready

For this recipe, we assume you have a React Native application that has some animations defined.

How to do it...

  1. First and foremost, when debugging animation performance in React Native, we should enable the performance...