“Write once, run everywhere” has been the “holy grail” for application development since the beginning. Using a single framework and programming language for development of both iOS and Android apps makes everybody happy. Programmers like the advantage of focussing on one technology and product managers and startup founders like the faster time-to-market for new products and features. The trend started with hybrid apps using Ionic and Apache Cordova frameworks. The recent popular choice is React Native, an open source framework from Facebook. React Native enables you to write native-rendered apps for iOS and Android using the same React web component model. This is great in that as a developer, you can apply your knowledge of a framework across multiple platforms.
So when it is time to developing a new mobile app, the natural question that everybody is asking — “Should I build it in React Native?”. As usual, there are pros and cons. Having developed a large number of native iOS, Android apps, Hybrid apps, Progressive Web Apps (PWA) and now React Native apps, below is my observations and a recommendation.
Look and feel
Both native and React Native apps have the same look and feel. The react-native core framework is still evolving and not all components are available in the core framework. To fill the gap, community developers are continuously releasing plugins. These plugins are also evolving and sometimes buggy. They may work only on one platform correctly and need to be modified for the other. If no plugin is available, we can embed custom native code directly in the React Native app. React Native combines smoothly with components written in Objective-C, Java, or Swift. It’s simple to drop down to native code if you need to optimize a few aspects of your application. It’s also easy to build part of your app in React Native, and part of your app using native code directly. Of course this compromises the platform portability.
Using third-party plugins for UI comes its own challenges. The high-level UI plugins come with their custom look-and-feel which may not always be suitable for your application. A new version of plugin might come with bug fixes and enhancements but also UI look-and-feel changes. Integrating it with your app may inadvertently change the UI of subsequent version of your app.
When it comes to the performance, native app is definitely a winner. A native app is faster and more reliable by its very design. React Native app compile to the native code so are faster than the hybrid apps but they still add an overhead of framework in terms of processing and size.
The app size for React Native app is also typically larger than a native app. This needs to be considered if developing for low-end devices.
Time to market
The portable framework and programming across multiple platforms is the main benefit of React Native. Though the benefit in terms of cost of development may be less than 50%. Some functionality may not be available and hence need to be written in native code, Android and iOS code need to be configured separately and sometimes manually. Debugging of framework and libraries add an additional layer of complexity.
React Native framework is relatively new and still evolving. This presents its own challenge in development. New third-party libraries are springing up everyday and some of them are being replaced by functionality in the core framework.
There can be instances where mix of React Native core, third-party plugins, proprietary custom modules and embedded native code may result in a complex code structure which is hard to manage. This is one of the reasons, AirBnB moved from native to React Native and back to native application development recently.
So, what’s the answer?
We recently rewrote a social media messaging applications from native to one React Native application. We also decided to build a WhatsApp like messaging application in React Native with scratchpad drawing support. Both these applications were developed much faster than time it would taken to build two separate native apps for iOS and Android. It is also much faster to add new features to a single code base for new releases. We have developed native logistic vehicle tracking apps with heavy use of maps and real-time tracking requiring computation-heavy operations for sticking to road etc. The flexibility of providing native look-and-feel as per the platform and heavy calculation along with the need for real time response make them perfect candidates for native development.
So choose React Native app when you
- need to develop a low complexity application
- have a lot reusable components available in React Native or external plugins
- need quick time to market with faster iterations
and choose native app when you
- need custom look-and-feel
- need to integrate with a lot of third-party SDKs
- need real-time response with optimization control
- have computation heavy and resource hungry processing like custom 3-D animations
Did you need to choose between native and React Native recently? What did you choose and why?