Shopify goes all in on React Native for mobile development 3 years after Airbnb dropped it like 3rd-grade French

Commerce platform should have a better time, right?

React Native is gaining increasing attention for cross-platform mobile development
React Native is gaining increasing attention for cross-platform mobile development

Shopify, a commerce platform that claims over a million businesses as customers, is going "full steam ahead" in shifting all its mobile development to React Native.

In a detailed post, Shopify engineering veep Farhan Thawar explained why the team is changing from its present policy of native mobile development to use a cross-platform framework and React Native in particular.

He sees this as an "early technology bet" that parallels other choices the company has made, such as Ruby on Rails for its web application and Google Cloud for its IT infrastructure.

React Native is based on the React JavaScript library developed by Facebook to build web user interfaces. React Native compiles to native code, rather than wrapping a mobile browser engine, enabling cross-platform development for mobile and desktop applications. The framework was open-sourced in 2015, at which time, we are told, the Shopify team "saw its promise" but felt that both performance and first-class Android support was lacking.

In November 2018, Shopify acquired the online marketplace Tictail, whose developers already used React Native. This, along with improvements in the framework, motivated Shopify to follow suit. The team analysed other options including Google's Flutter and continuing with native development. However, Thawar said that Shopify native apps will not necessarily be rewritten – "that's a decision each app team makes independently" – and that it will continue to use native code for custom platform-specific components and contributing back to the project. In addition, there will be instances where native development is preferred, such as for intensive processing or low-end hardware.

One project that did get rewritten is an order-tracking application called Arrive. Originally there was no Android version, only iOS. The rewrite shares 95 per cent code between Android and iOS, is more stable on iOS than the old native version, and "the team felt that they were twice as productive than using native development," claimed Thawar.

In 2016, Airbnb "took a big bet on React Native", said Gabriel Peal, who was a senior software engineer there at the time. It did not work out, and in 2018 Peal announced that "we will be sunsetting React Native".

What went wrong? While performance was good, the "initialization and first-render time" was poor, he explained. The framework's immaturity meant maintaining a fork with their own patches, which "makes the process of upgrading React extremely painful". The team did not like the lack of type safety in JavaScript. Refactoring (such as renaming a React element called a Prop) was difficult because of multiple layers in the framework. Debugging was painful at times and they suffered "a few very bizarre crashes that are hard to fix". Accessibility was hard to implement because of "holes in the accessibility APIs". The fact that React compiles to native code was not all good, since subtle differences between platforms made it hard to create a "consistently high quality experience".

This was three years ago and React Native is more mature today. In addition, some of Airbnb's issues were organisational rather than technical. Peal said that the opinions of team members about React Native were polarised. TypeScript is well supported in React Native, overcoming the type safety issue. The experience at Airbnb is no reason to presume that it will work out badly at Shopify, though it does illustrate that using a cross-platform framework always has costs as well as benefits.

Microsoft is also a React Native enthusiast, at least in the Windows and Office teams, though the company also offers Xamarin for cross-platform mobile with .NET, and is now experimenting with Blazor, another JavaScript framework, so it cannot be described as wholehearted. ®

Sponsored: Webcast: Build the next generation of your business in the public cloud

SUBSCRIBE TO OUR WEEKLY TECH NEWSLETTER


Biting the hand that feeds IT © 1998–2020