Facebook Open Sources React Native For Android So Devs Can Reuse Code Across Web And iOS

Facebook built the React JavaScript library so its engineering team could build interfaces for iOS, Android, and web with the same code. Now it’s giving that development super power to everyone by open sourcing the final part of the React trilogy, React Native For Android.

Facebook open sourced React in 2013 and React Native at its F8 conference earlier this year, but the version for Android means engineers trained on React will be able to build for every major platform. That could allow startups and big tech companies alike to get by with fewer engineers or worry less about hiring ones specifically versed in iOS or Android — two very different codebases. That in turn could help teams develop new features faster, and reduce the lag time between iOS releases and their ports to Android.

Facebook made the announcement of it open sourcing React Native For Android  on GitHub today at its annual @Scale conference. 1,800 execs and engineers from Facebook, Twitter, Google, Box, Pinterest, Microsoft and more came together to collaborate on how to bolster their engineering and infrastructure. Combined, the companies in attendance have contributed to over 4500 open source projects.

Screen Shot 2015-09-14 at 10.38.58 AM

Why Open Source?

You might wonder why Facebook would give away such a powerful technology like React when it could keep it to itself and gain an engineering advantage over its social competitors. Facebook engineering manager Tom Occhino gave me three big reasons:

  1. Community Contributions – “We’ve gotten really meaningful contributions from the community, from features to bug hunting.”
  2. Recruiting –  “People are really interested to learn about the technology that powers something as big as Facebook. People are excited to join the teams that build that stuff.”
  3. Engineer Onboarding – “It gives every engineer that joins Facebook a headstart because they already understand our frameworks.”

Essentially, Facebook gets a lot more out of open sourcing than it gives up, and it’s also altruistic since it aligns with Facebook’s hope to connect the world. “Facebook can’t build all the software” Occhino says. “The best we can do is give [developers] the tools so they can further the mission.”

Learn Once, Write Everywhere

The holy grail of cross-platform development has long been “code once, run anywhere”, yet fundamental differences in web, iOS, and Android prevent that. But React layers a level of abstraction across the three platforms so that you only have to learn React once, and you can write apps anywhere.

11891388_485324161641793_834839352_nFor example, earlier this year, Facebook built a native Ads Manager app for iOS and Android in half the time expected thanks to React. Instead of 18 months, Facebook wrote the iOS app in 5 months, and then ported it to Android in just 3 more.

The technology also allows Facebook to get back to the Move Fast imperative it fostered when it was a web-only platform that constantly shipped code and tested new features. As it adapted to the age of mobile, Facebook had to fracture its engineering team to include separate experts for web, iOS, and Android.

Without React, Facebook engineering manager Olivia Bishop tells me “It’s hard to iterate quickly because every time you make a change, you have to recompile your app and put it on the device you’re testing.” But React shaves time off since code can be reused.

Once the community gets the hang of React Native, it could make lean startup methodology easier to execute. Rather than sacrifice cross-platform support or loathe trying to test the waters of a new operating system, all developers will be able to see what works, fast. And when they discover something wrong with React, they can fix it for Facebook too.

“I’d compare open sourcing to long term processes like evolution or erosion. It pays off over years, where our investment in open source makes sure the software stays relevant” concludes Facebook engineering director Adam Woff concludes. Keeping software inside a company can lead to dangerous stagnancy. “Over time that will destroy a propriatary software stack and hurt a company.”