Best way to build native applications with JavaScript?

Michael Kisilenko picture Michael Kisilenko · Nov 12, 2013 · Viewed 16.1k times · Source

I've been playing for a while with phonegap, did some tests on my Android...

It's pretty nice.

My questions are:
What is the best (your favorite) framework to develop native mobile applications with web client side (HTML / JavaScript / CSS)?

How easy is to build and maintain those applications in multiplatforms (iOS / Android / BlackBerry) parallel? Does it has many exceptions between different platforms (iOS / Android / BlackBerry)?

What are the requirements to develop my app for iOS? Should I need a special IDE with special SDK? Must I have a Mac?

Answer

Jacob Turner picture Jacob Turner · Jul 28, 2015

We're currently building a native iOS application using React Native. It would be a shame if it wasn't included here.

Pros:

  • React treats the DOM as an implementation detail. This made the transition over to native UI very natural. It also removes the need for HTML/CSS when writing a native app. All you need is native components, written in JavaScript.
  • Native components! The fundamental native components have already been bridged over to JavaScript, and there is a community busy at work bringing everything else over. The thing is, if you know or are willing to learn some Objective C or Java, there is an easy process to add any native module (or third-party module) to React Native.
  • Quick iteration. There have been over 2600 commits to the master branch since it was open-sourced in March.
  • You get all of the benefits of normal React: a virtual view layer, diffing, declarative UI creation, fantastic developer experience, and a stellar community.
  • You can build for multiple platforms from the same repository, reusing much of the same codebase (application logic, mostly).

Cons:

  • It's still young. There are a few features that require jimmy-rigging, a third-party library, or custom Objective-C/Java to get working.
  • Some great third-party libraries that are tied to the DOM or Browser API still don't work on React Native, including React Router.
  • The biggest pains have had to do with XCode and Apple's developer program, but there's no way to get around that.

How easy is to build and maintain those applications in multi-platforms?

React Native for Android was open-sourced on September 14th, 2015. I haven't used it yet, but here's what I've been able to learn so far. Update 10/21/16: React Native for the Windows Universal Platform was announced earlier this year. That means you can now use React Native to build apps for Windows desktop, Windows phones, and even Xbox!

React Native is not intended to be a write once, run anywhere mentality. They adopt a learn once, write anywhere paradigm instead. iOS is a very different platform than Android, so sincere effort needs to be put into the design for either platform. The native APIs will also be different.

So, you will end up re-writing code for native components and APIs. However, much of your application logic can be re-used. In fact, React-Native is organized so that you can keep both your Android and iOS applications in the same repository, so that you can re-use the same code when possible. I think it's brilliant, but only time will tell. According to them, it works well so far.

By the way, a team at Facebook built an iOS app using React Native, then turned around and built the Android version in three months using 87% of the same code base.

What are the requirements to develop my app for iOS?

Currently, you need a Mac and XCode in order to deploy. Currently there are very few ways around this. According to this issue and from conversations on Slack, once deployed, you can actually develop from a Windows or Linux machine. Facebook is also working on open-sourcing all of their Nuclide packages, which, according to their presentation at F8, will include tools to package and build without XCode.

Overall, React Native has been a stellar experience. It is, in my opinion, head and shoulders above anything else currently out there. The feeling within the community is also very positive. I can only assume it will get better with time.