Developers will be happy to hear that Facebook has released open source React Native for Android, six months after it released an iPhone version on GitHub.

React Native is the next generation of React - a Javascript code library developed by Facebook and Instagram, which was released on Github in 2013. Native app creation means writing apps for a specific operating system.

©iStock/

React Native helps developers reuse code across the web and on mobile. Engineers won't have to build the same app for iOS and for Android from scratch - reusing the code across each operating system.

Android and iOS have very different codebases and startups and businesses often struggle to hire - or afford- engineers for both. Now just one developer can write across different mobile operating systems.

Facebook opened up React in 2013 and has been using its proprietary React Native code for iOS app development for over a year.

Why open source?

"If we work together in the open, we can advance the state of technology together," Facebook said in a blog post yesterday evening. 

Altruism aside, opting to open source code is a tricky decision. Keeping a businesses infrastructure under-wraps has commercial advantages, especially when your technology is your business model.

But the developer community is loyal to those who open up. Web engineers across the world are quick to point out a bug in the code for free. 

Developing open source projects helps keep Facebook one of the most coveted companies to work for. Developers want a challenge, and a sense of giving back - and Facebook wants a large pool of talented engineers to pick its employees from.

Plus, it saves on training. If every engineer Facebook hires already knows how to write in React Native, they have a running start.

Facebook has a culture of maturing its development. Over ten years’ it has scaled to serve one billion users, thousands of developers and three major platforms - iOS, Android and Web.

It's a considerable development from when the fledgling startup copied Facebook code on Harvard University's server for releases and, "poke on it to see if it was still working every day at 10am," mobile engineering manager Bryan O'Sullivan joked earlier this year

Yesterday’s announcement cements Facebook's existence for another ten years if it continues to innovate this way.

How did Facebook write React Native for Android?

The first cross-platform React Native app - ads manager - was developed by the London-based dev team, who were in the US to announce the Android release yesterday evening. Ads manager lets businesses that advertise on the social network manage their accounts and create new adverts.

React Native has only recently been proven in production and building a new app based on the framework carried some risk.

Three product engineers familiar with React set about to create an app for Android and predicted problems with the logic necessary to understand differing time zones, date formats, currencies and ad formats across the world.

This business logic was already written in JavaScript, and the team knew it wouldn’t be efficient to build it all again in Objective-C to do it again in Java for Android. 

Now this project has been released on Github, developers can use a single workflow to develop for iOS and Android. This means you can use the same editor and propagate it to both the iOS simulator and Android emulator at the same time. 

Pictured: Text editor and iPhone and Android simulators ©Facebook

Airbnb, Box, Facebook, GitHub, Google, Instagram, LinkedIn, Microsoft, Pinterest, Pixar Animation Studios, Twitter, Uber, and WhatsApp all use React code.

Challenges with React Native

Working across separate iOS and Android codebases is challenging.

“When we were building the app, Facebook used this model, and all our build automation and developer processes were set up around it. However, it doesn't work well for a product that, for the most part, has a single shared JavaScript codebase,” wrote Daniel Witte and Philipp von Weitershausen, engineers at Facebook in a blog yesterday.

Developers who often struggle to figure out where the master code exists and whether bugs have been fixed in all platforms may want to hold out for when Facebook opens up its unified repository. It is moving all of its code from Git to Mercurial, and will be one of the largest codebases of its kind.

Google is another web giant that understands the power of open source, recently committing to OpenStack and creating an enitrely open source container management project, Kubernetes. The project seems at odds with its own Google cloud business, but again, it knows that the benefits outweigh any loss of Google cloud customers.

Find your next job with techworld jobs