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

Loading animation


In this recipe, we will continue working with the LayoutAnimation class. Here we will create a button when the user presses the button we will show a loading indicator and animate the styles.

Getting ready

Before we start, we need to create an empty app. We are going to call it ButtonLoading, feel free to use any other name, just make sure to use the correct name when registering the bootstrap component.

In addition, we need to create the src/MainApp.js and src/Button/index.js files.

How to do it...

  1. Open the index.ios.js file, remove the current code and add the following. Make sure to use the name of the app, in this case, ButtonLoading:

            import React from 'react'; 
            import { AppRegistry } from 'react-native'; 
            import MainApp from './src/MainApp'; 
     
            AppRegistry.registerComponent('ButtonLoading', () => MainApp); 
    
  2. Open the index.android.js file, remove the existing code and add the following. The code is a little bit different...