The first time we saw that we could use React, our go-to front-end library, for building native applications, we were thrilled.
The promise of learning React’s paradigm and writing applications for the most common platforms was so exciting that we decided to give React Native a shot.
Indeed, React Native creates a wide spectrum of new possibilities in building performant iOS, Android or even Windows applications. However, you should also be aware of the restrictions that it might have. In this article, we want to present our perspective on React Native which we have gained from the Netguru’s projects.
It uses the same design as React, letting you compose a rich UI from declarative components. It allows developers to reuse code across different mobile platforms.
There is also the possibility to share your application code between mobile and web by properly separating the logic from the UI. Some ways of sharing the entire codebase between platforms are starting to appear, but it’s too early to depend on them. You can read more about that on the Expo Blog. On top of that, thanks to instant reloading instead of recompiling, you can build apps much faster.
React Native creates a declarative, high-level API for building native applications. Each React Native UI component corresponds to a native UI component of the target platform. There is a strong possibility that you will be able to reuse most of your code between platforms and many parts will ‘just work’.
At the beginning React Native was a solution for iOS only, but now it's available for different operating systems.
At Netguru, we saw great potential in that and started developing apps with this framework in late 2017.
At first, we started with simple apps for fetching data and displaying it on a screen. Then we worked on more demanding projects with unconventional functionalities.
While building whym we delivered online calls between users and interpreters. We implemented a full-featured chat within Hive. Integrating an audio player was probably the biggest challenge in the Shine project.
The efforts have paid off because Shine is appreciated all over the world. It was featured as the App Store’s “Best of 2018” and has been nominated to Google Play Awards in the Standout Well-Being App category.
React Native may not seem easy at the beginning. There are a few things that you should consider before rolling with it.
What if the functionality that you need is not available in React Native? What if you need to use a library that was made for development on a specific platform?
React Native gives you an awesome tool – Native Modules – as a response to these issues. In many cases, there is an npm package waiting for you to solve your problems. The React Native community is constantly growing, and so is the number of npm packages. There are plenty of solutions to the most common problems. If a particular use case is not covered (which is very rare), a module can be built from scratch.
Exposing a native API is quite simple, but these APIs are changing all the time. Thanks to the growing community, React Native is relatively up to date and the number of available modules is increasing. Exposing the whole library may be a bit tricky. There will be cases in which Google will not help you, and the assistance of a native developer will be required.
Let's say that you want to implement an efficient custom view displaying real-time data and reacting to user input. In such a scenario, you'll need to go back to native implementations. Depending on the functionality that you need to export, bridging them through React Native might have a negative impact on performance and end-user experience.
What's more, you will have to do that for every platform you want to support, which will decrease the reusability of code between platforms. We've faced this problem in one of our apps.
Our client had a working iOS version where most of the codebase was custom iOS modules written in Objective-C. Therefore, creating the Android version wasn't easy at all and required a high level of involvement of the Android team in the process. Instead of simplifying, React Native slowed down the development and even complicated the Java-side code due to limitations of the React Native bridge.
React Native isn't just a way for web developers to dip their feet into native applications. It's a powerful tool that is constantly evolving and maintained by a great community.
It's been battle-tested by many apps on the market and it requires less and less support from native developers as it evolves. Although it's not a perfect solution for every app idea and there's still a lot of room to improve, React Native is a great choice if you want to build an app with a native feel while saving resources.
This article was first published on Mar 30, 2017