Yes, we can. Cross-platform native mobile applications development

Alexander Pantyukhov
4 min readJan 28, 2016

--

I am the person who thinks that it is almost impossible to create well-polished, nice-looking and attractive cross-platform mobile applications. I’ve seen Phone Gap- and Xamarin-based apps, but I’ve cried till the end of the day after that.

It sounds incredibly cool — if you’re a manager, you don’t need to hire two developers (for iOS and Android); and if you’re a developer, you don’t need to learn two languages (Java and Objective C). This is what advertisement says. But the reality is not always brighty and shiny — all these cross-platform development techniques guarantee you rapid development, but the result won’t suit your needs, I promise. In most situations it will be just waste of time and money, and you will probably need to rewrite your apps.

But, god damn, it is 2016. Is it still true?

Yes, but…

Today I am going to tell you about one more way to build mobile UIs. It is called React Native, and it allows you to create native-looking cross-platform applications easily and faster than ever before. React developers want to create platform that will allow people to create apps indistinguishable from true native apps, and despite of the fact that React Native is not ready yet today’s version (0.18.1) proves that it is possible.

React Native is written in JavaScript, and it is obvious that you should use JavaScript to create your apps too. But, of course, it is crazy to use JS in the 21st century, that’s why we’re going to use something better, for example, ClojureScript.

How?

If you want to write apps using React Native, forget your Android or iOS knowledge and experience. You need to start from scratch. But, most probably, this adventure will be at least fun. You will find yourself thinking like “Oh, what am I doing? It is 5 min work and I am able to finish it easily using Java/Objective C”. And it is true. But you will be awarded by amazing feeling that you’re doing something really cool (because I know you’ve lost this feeling writing your Java/Python/whatever code on your job).

First of all, you don’t need to use these crazy adapters anymore. I know, adapters hurt, because nobody wants to write tons of classes to create list of whatever. And the good news is that you don’t need to!

React controls everything. Your React components can automatically maintain internal state data and redraw your list items.

This is how your code looks:

Simple, right?

Even if you don’t know Clojure or ClojureScript, this code is understandable — all we need to do is to subscribe to cities updates, and give React an ability to do everything else.

Actually, it is a basic concept of reactive programming, but look at this code! Looks like it came down from heaven. Compare it with your Java code and start crying.

We use a couple of React Native UI components here, and, of course, these components look absolutely different on iOS and Android. They are native. React, compared to any other cross-platform development framework, don’t draw your application inside WebView, and uses native components instead. Most probably, it is the exact reason why they call it React Native.

And this how your React Native development looks like

React Native uses its own layout tool, and this tool is one of the most amazing framework things. It is called Flexbox, and it allows to use one type of view to create any layouts and to build UI for the variety of different screen sizes and orientations easily and without knowledge of the specific platform. The CSS-like styling also allows you to reuse styles extremely easy.

It also supports Live Reload. Connect your iOS or Android device, make changes and see the result immediately. Yep, you don’t need to rebuild your app. Isn’t that cool?

Are there any problems?

Of course. Creating React Native apps is a big challenge, and you will face lots of difficulties. The biggest problem is that it is not always possible to find UI controls and you don’t have, for example, rock solid mobile database for your apps. But, I believe, these problems will be fixed soon, because the community is always growing.

All these problems also give you a possibility. Possibility to start creating open-source products. React Native community want you to work on components and make lives of other developers better.

I had never contributed anything to open-source until previous week. But now I have my own repository with demo app, and several contributions to some popular React Native libraries.

My first React Native application is called Luno (please, don’t ask me why), and, of course, you can download sources and start exploring the amazing new world.

Do it. Right now. Seriously. You will be impressed, I guarantee.

So native

Hope you will enjoy React Native development and help community to create better framework for mobile developers. And, more importantly, have fun!

Further reading

An iOS Developer on React Native by Marc Shilling
React Native in Production by @clayallsopp

--

--