We do a lot of mobile product development at Cantina, and a common question that’s asked both by our clients and by us at the beginning of new projects is: How should we approach building this?
With most mobile products, our clients want users on both major platforms - iOS and Android - to be able to use their application. Ideally, apps on both platforms should be at feature parity and available to users at the same time. In the past, Cantina has worked with clients launching new mobile products to target one platform first, then expand once the app gets market traction. But more and more, we’re seeing clients expect both platforms at launch.
React Native is not the first mobile app framework to promise write once, run anywhere. Xamarin, Cordova/PhoneGap and Ionic, among others, have been making that promise for years. At Cantina, we’ve researched them all, used many, and found that the end result often didn’t meet our expectations. The Newport Folk Festival app, a longtime Cantina client, is an good example. Developers built the original version of the app with PhoneGap. The following year, we rewrote it as two separate, native applications.
React Native is the first cross-platform framework that we believe delivers on the multi-platform promise without compromising user experience. We later rewrote the Newport Folk Festival app in React Native.
However, we still invest in and recommend native development in many projects. React Native is not a silver bullet, and it is not the right choice for many situations. Lately, a number of other tech companies have gone public with their experiences with React Native, both positive and negative. AirBnb recently shared their experience building with React Native, as well as the reasons they’re looking to move away from it.
I’d like to share some of the questions we like to ask to help us and our clients decide between native mobile development and React Native. I’m assuming here that you’ve already committed to building an app. The question now is how to deliver the best app experience, as fast as possible, with as little investment as possible.
ARE WE BUILDING A NEW APP, OR ARE WE BUILDING AN EXTENSION TO AN EXISTING APP?
React Native strength’s are most apparent when either starting a new project or completely rewriting an app. If you already have an app or apps and you’re considering integrating React Native into the existing system in order to build an additional feature, you’re introducing fragmentation in your project; you now have three platforms to support instead of two. The confusion for your team may not be worth the cost.
HOW MUCH EXTERNAL COMMUNICATION DOES THE APP REQUIRE, AND OVER WHAT MECHANISM? React Native was born by adding a native-code bridging mechanism to the React framework for building web apps. It shines when building apps that are mainly interfaces for cloud services. If your app needs to communicate with other devices over Bluetooth, Near-Field Communication (NFC), Bluetooth Low Energy (BLE), or a direct WiFi connection, React Native may not be the best choice as it puts an additional layer between the app and the communication layer. Android and iOS each handle Bluetooth communication slightly differently, and those differences mean that debugging is easiest in a native app.
That said, the native bridge is getting better all the time, and a lot of work is being put in to BLE communication into React Native apps.
WHAT DOES YOUR APP NEED TO STORE LOCALLY ON THE DEVICE?
React Native is plenty capable of storing data locally on the device, but as requirements for local data storage grow, or if complicated data structures are needed, the app will hit a point where doing it in native code is easier. React Native can struggle with complex persistence models.
HOW MUCH OF THE DESIGN OF YOUR APP CAN BE SHARED BETWEEN PLATFORMS?
The power of React Native is sharing code between two platforms. One view layer, one business logic layer, two platforms. However, how much of the design experience can actually be shared between the two platforms? Is your app heavily inspired by Material Design, and as a result feels wrong on iOS, or does your style make a Samsung look and feel like an iPhone? What types of navigation are you looking to implement in your app? If you want a UI that feels completely at home on its device, React Native’s singular experience may not be the right choice.
WHAT TYPE OF MOBILE DEVICES DOES YOUR APP NEED TO RUN ON OR WORK WITH?
Right now, React Native works on Android and iOS devices. But mobile products have many other systems available. Do you want to have a companion app for the Apple Watch or an Android Wear device? Could there be a Smart TV app? React Native does not support these platforms. When you start adding additional platforms, the “write once, run anywhere” promise immediately disappears, and you could start to consider other ways of code sharing.
ARE THERE ANY COMPLEX AUDIO, VIDEO OR GRAPHICS REQUIREMENTS FOR YOUR APP?
This is a growing concern with applications that feature machine learning, augmented reality, or virtual reality.
YOUR TEAM AND COMPANY
The requirements of the app shouldn’t be the only thing driving your decision. Your mobile product team is just as important as the tech.
WHAT TECHNICAL TALENTS DOES YOUR TEAM ALREADY HAVE, AND WHAT TECHNICAL TALENTS WOULD YOU LIKE TO GROW IN YOUR TEAM?
HOW IMPORTANT IS STABILITY, FRAGMENTATION, DOCUMENTATION, AND AVAILABILITY OF THIRD PARTY PARTY CODE?
Additionally, React Native itself is still an evolving project, and the teams working on it regularly introduce breaking changes in to the available APIs. There is no stable “1.0” version of React Native yet. Your team needs to be able to keep up with the changes as they come, in order to keep building your application.
React Native is getting better each day, with major companies, hundreds of developers, and thousands of projects using and growing it with success. Developers’ satisfaction with it is often high as well. It’s a great choice for writing multi-platform applications. But it’s not perfect, and you need to be careful when choosing to use it.
At Cantina, we’re working with our clients every day to help them make the right choice for their project. We’d love to hear your experiences using React Native, and what criteria you use to decide.
This post was originally published on the Cantina blog at https://cantina.co/decideing-between-react-native-and-native-code-for-your-next-project/.