React Native for Building Hybrid Mobile Apps

There are two approaches in the world of mobile app development - native and hybrid.  

Native app development

Native applications are those you see the very first time you use a device. Examples of native applications include a browser, an email client, an address book, an alarm clock, a calendar and other standard programs that are built in by default.

When a developer writes a mobile application using a programming language that is specific to a certain platform, e.g. Objective-C and Swift for iOS or Java for Android, that application is considered native. Native apps can access the operating system features of a phone such as the camera, microphone, geolocator, accelerometer, calendar, media files, notifications, etc. In a word, they grow roots and feel at home.

Cross platform approach (hybrid applications)

Imagine a mobile website that does not always need an internet connection, but which from a design standpoint is closer to mobile apps than to webpages! That is a rough description of cross-platform applications.

They are often written in a markup language and style (HTML, CSS and JavaScript) that is similar to mobile websites, which is borne out by the fact that all Internet content consists of HTML pages. Such applications are written for all platforms simultaneously and are adapted to most devices. A browser engine usually does most of the work.

Most professionals who create hybrid applications use Ionic, PhoneGap and Cordova frameworks, which allow the application to access hardware and software platform features. In addition, cross-platform development is available for Xamarin, Unity and other technologies, but they are not that popular for the development of web-based applications.

native apps

User experience

 The first thing a user expects from an application is responsiveness. This means instant feedback and smooth- flowing, uninterrupted page scrolling and animation. In this regard, cross-platform applications compare poorly to native ones and, quite honestly, they are slow. That is their main problem.

 In addition, each control element and icon will have a standard form and a standard position on the app screen. However, these standards will be different for different  platforms. Thus, if a cross-  platform application has been built according to iOS guidelines, it will be uncomfortable for Android users and vice versa.

The “back” button may be one of the best examples of this situation. It is a typical feature for Android, but there is no analogue for iOS. Therefore, when you create a cross-platform application, there are only two options – either the design is the same for both platforms and users of one are forced to adapt to it, or you create two different designs and take into account the peculiarities of each platform. In fact, in the latter case, two applications are created in the same cross-platform language and React Native is ideal for this.

React Native is a hybrid mobile app development tool from Facebook for iOS and Android, based on the ReactJS library and designed to interact with native API platforms.  

React Native does not use a browser or a WebView. Instead, it uses JavaScript API on top of native platform components only. As a result, it is an application with native elements and responsiveness.

hybrid mobile apps

Advantages of React Native apps:

  1. Portable. More than half of the entire code can be ported to another platform. All of the application’s logic, except for the view elements (information display templates on the screen), can be migrated.
  2. Greater scalability. There is extensive API interaction with native elements in React Native, as well as many ready-made modules of third-party developers and the possibility to write Native Modules of your own.

Many criticize React Native when speaking of JavaScript performance with respect to the "native" code. In fact, such technologies allow the best of both worlds — a sophisticated and concise JavaScript used to code the application logic, and a low-level code of c / c ++ / objective-c used for libraries and speed critical areas of logic. This approach allows the complexity of the application parts to be evenly spread, and avoids their accumulation in one place, which often leads to complications and unsupported code.

Of course, there are very specific reasons for the popularity of native applications:

  • Speed and responsiveness. As a rule, native applications are optimized for the platform on which they are launched in low-level languages.
  • Support of complex gestures and nontrivial animation.
  • Monotonous UI. Interfaces of various applications within the same operating system are designed approximately the same way. Of course, the components vary from application to application, but their operation principle is mostly the same. This means that if you learn the interface of one application, it will be easy to understand interfaces of other applications on the same OS.

Despite the popularity of native applications, there are reasons why it is hard to create them:

  • Different set of technologies. If you need to create a single application for both Android and iOS, you have to hire both Android and iOS developers. That is more expensive, of course.
  • No code reuse. If, for example, you need to send a REST API-request to the cloud server, it is necessary to write to the services of both Android and iOS. Then, you have to write the same UI, some functions, etc., twice.
  • A new build for every change. It takes a lot of time and slows down the speed of iterations.

Igor, Developer at Visual Craft