React Native – Business solution for Mobile App Development

With just one tap of figure, we can do much of the daily routine work like ordering food, book a cab and many more with the help of mobile. Mobile app business is predicted to generate $188.9 billion in global revenue by 2020 as compared to $88.3 billion in 2016 according to Statista. In this fastest growing mobile industry native android and iOS development is too much time consuming as we have to write the same app twice and we have to spend more money on developers too.

React native is an open source JavaScript framework for writing real and natively rendering mobile applications for iOS and Android platform. We have to code just once and can develop app for iOS and Android both platform which helps in reducing development time and money too as we don’t require to hire two separate developers for both platform. So this is more like a business solution by Facebook. React native is backed by developers at Facebook and there are huge amount of libraries available at GitHub. We also don’t have to learn multiple languages for both the platforms as we can build apps with the help of JavaScript only in react native.

Advantages of React Native

Cross Platform Support
We can build react native app both in iOS and Android with native UI elements. There are some instances where we have to write platform specific functionality like different UI for iOS and Android. React native provides modules that can detect the supporting OS at runtime and run platform specific implementation.

Initially there were some other frameworks also available for hybrid app development but most of them were run inside web-view and known for poor performance. React native compile the JavaScript code into native code, that’s why it runs the app without any performance issue. You even cannot identify the difference between react native and natively written app by just using the app.

Hot Reload
While developing native iOS and Android in XCode and Android Studio respectively, if we want to apply the changes then we have to re run the whole app which more time consuming. But in react native hot reload functionality is available which can apply your changes faster than native any other tool available for app development.

Easy to learn
You can learn react native using online tool called expo which is created by Facebook. If you just want to learn react native quickly and don’t want to setup your machine for react native then expo is the best tool for you to start with. You just need Node.js and Expo CLI installed and you can start building application. But for Building projects with native code you will have to set up the react native properly in your machine. So we will quickly go through the set up process.

How to Set up Development Environment

Installing dependencies
You will need Node, Python2, JDK, React native command line interface and android studio for Android and Xcode for iOS. To build application for iOS you will require Mac machine. You can install node, python and JDK by using following command using Chocolatey.

Open Administrator command Prompt by right clicking Command Prompt and select “Run as Administrator” and past the following command. If you have already installed node in you system then you will have to make sure that it is Node 8.3 or newer. Also if you have already installed JDK in your machine then also you will have to make sure that it is version 8 or newer.

  • Choco install –y nodejs.install python2 jdk8

You will have to install Node, Watchman and Homebrew if you are using Mac. You can install Node and Watchman using following commands.

  • brew install node
  • brew install watchman

Install React Native Command Line Interface
Paste and run the following command in Command Prompt or shell:

  • npm install –g react-native-cli

Setup Android Studio and SDK
Download and install Android Studio from this site (Download). While installing android studio choose “custom” as installation.

Here you will require installing the Android 8.1(Oreo) SDK in particular as of now so make sure to install SDK from SDK manager. You can go to SDK manager as bellow. Click on “Configure” drop-down on welcome screen of Android Studio. 

Installing Xcode and Command Line tools
Install the Xcode via Mac app store. If you have already installed it then make sure it is version 9.4 or newer. Now you will have to install command line tools by following this path.

  • Xcode -> Preferences -> Locations

Now select the most recent version of command line tools and install it.

That’s it and you are good to go with creating project.

Creating a new Project
You can create new project using just one command. Go to the location where you want to create a project from command lines and past the following command and replace the ProjectName with you project’s name.

  • react-native init ProjectName 

Run Application
Past and run the following command to run the project in Android device.

  • cd ProjectName
  • react-native run-android

Past and run the following command to run the project in iOS device.

  • react-native run-ios

That’s it. It is so easy to create and start development in react native. Now we will look at some dis-advantage of the framework.

The documentation is not that up to mark that we can easy get something out of it. Framework is still in the growing stage so we will have to give it time to get mature. There are some features on iOS and Android still aren’t supported so we have to create our own modules for that. React native create another layer on top of you native project so there are some debugging issues.

Final Words
React native is continuously growing and improving framework to develop iOS and Android application. There are hundreds of built in third party libraries for react native which you can use to faster development of your app. There are also changes for the TV app development support also in near future. If you have knowledge about JavaScript then you can jump directly into mobile app development using react native. I consider it as more of as business solution rather than development solution because it reduces the development time and money in this competitive world.