Karolina Samorek

May 25, 2017 - 

3 min read  - 

Why every mobile dev should try React Native

React Native – the framework that allows you to write one code for both platforms. Sounds familiar? You’ve probably heard this before. The idea is tempting, but eventually, we end up with limitations: lack of native components, bad performance, etc… This was what I’d been thinking about for a long time. So when I heard about React Native for a hundredth time, I thought there must be something to it.

There is a number of tutorials and articles on how to build an app in React Native and how it works. In this post I am going to describe my recent adventure with this framework and to try to answer the question I have been asking myself: what makes React Native different from other frameworks?

Warm-up

What hit me right away was a huge community. Thousands of people contributing to React Native source code, multiple libraries and components, lots of tutorials and sample apps. You have got to admit, it’s quite impressive.

Javascript used to scare me the most. I only had few occasions to write JS code. It was a long time ago and for the type and object-oriented developer, like myself, that was something understandable. However, JS has changed a lot since then. Obviously it still is a dynamically typed language, but it looks more object-oriented now. It also has a fantastic solution for asynchronous code: async await, the one I have badly missed from C#.

I needed only a few minutes to start playing with React Native. After reading a tutorial and experiments, I decided to build the proof of concept app. The one with a practical case that would allow me to face problems no one had talked about.

As I was new at the company I asked people about the internal apps that needed new modules/features or an idea for an app that I could develop. Answers came quickly. Most of my colleagues mentioned we had an awesome tool for tracking the availability of team members (who is working remotely, who is on vacation, sick leave etc.). The only problem was that the tool was extremely difficult to use on a mobile phone. So I found my case.

Initial problems

I looked through API, initialized a project and started to code. The first problem, that was not mentioned in any article or tutorial I had read, occurred when I wanted to implement Google Sign-In authentication. From native iOS perspective it was not a big deal as Google has libraries that cover integration. It was not the case then 🙂 Google doesn’t provide a library for React Native. Is it possible that so many people have been using React Native and no one ever needed it? Obviously, they did. Someone had created a library which adopts iOS and Android Google API to React Native one.

The setup needed a separate configuration for each platform and included changes in the native code base. As you can see, not everything is shareable ;]

The next challenge was to provide navigation to pass data and display the next screen. I searched for something like UINavigationController. Choosing from many available options was not so easy though:

  • React has a component called NavigatorIOS but, I wanted something universal for both platforms.
  • The Navigator component is well-tested in a production environment but is a bit old.
  • NavigationExperimental is re-implementation of Navigator. It gives nice and smooth animations covered by Animated library. However, it requires lots of boilerplate code because it contains only view components.
  • React Navigation is an interesting solution. It’ a standalone library created by the community. It’s worth mentioning that the library uses native components. You can use the Animated library, it is easy to start with and allows for many customizations.

I opted for the last option and the outcome was great. Within a few days I created an app that allowed users to login via google account, validate on the server side, display all users list and see other users details and their remote status. Plus, the app didn’t look too bad. React Native uses Flexbox to build layout for various screen sizes. It is user-friendly and allows many customizations. I can honestly say that creating iOS views has never been simpler.

What next?

I will never abandon native iOS development. I enjoy working with Swift and I’m really happy that I could discover pros and cons of React Native on my own. It has given me out-of-the-box perspective on the whole mobile development and it has shown that iOS has some limitations too, yet we are used to them. The most valuable thing I have found in React Native is the power of fully reactive programming. 

I still think that the experiment hasn’t given me the full answer… I would definitely like to write a production app in React Native. I believe it is possible to write fully professional and mature apps based on React Native and it is only a matter of time until more developers understand that.

If you are still not convinced to try React Native, please refer to article about performance. And if you are more interested in how it works under the surface, read post about bridging to native iOS code. I hope it dispels your doubts.

There are no comments

Join the conversation

Your email address will not be published.

Similar posts

Maciek Prostak

Nov 17, 2017 - 

5 min read  - 

Karolina Samorek

Oct 6, 2017 - 

5 min read  - 
Deep neural network swift

Jeremi Kaczmarczyk

Sep 29, 2017 - 

6 min read  - 

We Build Products

Startups, Data Science / AI, Web Development, Mobile Development and Product Design.

Contact us