Introduction

React Native is an open-source JavaScript library created by Facebook. It helps us to build an attractive Android, IOS, and Windows application with a native look and feel. It also uses a mobile application framework that makes the hierarchy of UI components to build JavaScript code.
Prerequisites
These are the things that we need to do:
  1. Install NodeJs & NPM
  2. Install react-native CLI
  3. Install JDK
  4. Setup Android Device (Android SDK and Android Virtual Device)
  5. Choose best code editor
  6. Create Project
  7. Run the App

Install NodeJs & NPM


Update device
  • $ sudo apt update && sudo apt upgrade
Add NodeJs repository
  • $ curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
Install NodeJs
install NPM
Check version

Install React-native CLI globally

Check version

Install Wtachamn

Watchman is an open-source tool used to watch for changes to our source across multiple files.

SetUp android development

Here, I will provide some important info for Android development.
Install JDK
Install android studio
Configure the ANDROID_HOME environment variable
Let’s export some paths in the profile file for making an android environment.
Open the terminal and run below comments.
In the profile file copy the below code >> add >> save
Configure SDK
Make sure your configured Android SDK is configured.
React Native Application

Choose best code editor

In my case, I am familiar with VS code Editor, so I will show you how we configure on that for running react-native effectively.
Here, we need two important plugins that help us build and debug the React-Native app on Android.
>> search Android and install an Android debug extension, as shown in the below screenshot.
React Native Application

Creating a sample application

Now, the time to create a new react-native app by doing the below instructions.
Open terminal >> Navigate your project folder >> run below command.
After, running the above command, you will get React-Native project files. As shown below:
React Native Application

Run the App

There are two ways for running our React-native application, such as Physical device or Android virtual device (AVD).

Here, we can choose the physical device that has separate Ram, which provides better performance rather than AVD.

Note
Before running your app on the physical device, you need to make sure your device under the Developer mode (enable USB debugging).

Open the terminal with your convenient IDE and keep the follow the instructions. Given below
Recommended: If you are a beginner, use the below command to avoid some typical issues.
React Native Application

After successfully executing/installing our app on Android, you will see the Default react-native welcome screen. Shown below:

React Native Application

Let’s edit the app.js file and add/change some code. Given below

After adding some codes in app.js, click on File >> save all

React Native Application

After saving the file, the packager will be automatically updated and refreshing the app on Android.

React Native Application

Conclusion

In this article, we learned how we set up react-native, android studio environments, and a react-native simple demo app, that works well on our Android device. I hope you understood. If you have any issues with your demo, feel free to comment below and stay tuned for more articles.