Developing in React Native is very different to writing Native source code. Life can be fun and here is a my experience learning the balance between the two.

My initial months at Coroma were spent maintaining legacy Objective-C applications, helping when needed with some Swift projects. In January, I was lucky to be placed on a project prototyping an application using React Native. This allowed for a self learning opportunity to add to my skill set. Developing in React Native is a completely different paradigm and it’s popularity within the industry is extremely hi, so I was really lucky to jump onto this project team. You may be interested in what I’ve learnt jumping back and forth between the two. 

React NativeTechnically, the biggest difference between the two is how each platform separates the view from the business logic. React Native relies heavily upon State Management, with it’s origins from JSX and is based heavily on HTML and CSS which is used to layout UI components. When the state of the application changes, all the components re-render. Even more interesting is with Redux, or any other predictable state container, changes delivered by another component or asynchronous request can be consumed in a global context.

By comparison, UI elements in a Native iOS application are constructed using an extensive framework called UIKit. Elements can be easily displayed on the view in a wysiwyg editor or programatically via the objects properties. Androids XML properties for UI elements are closely related to React Native, giving Android developers a slight advantage.

You may ask which one do I adopt. From my perspective as a developer, React Native is easier to learn especially you have web development and existing Javascript experience. It’s is a flexible language, easy to write, but potentially harder to debug/locate errors when they occur as apposed to strictly typed languages. Although I have found some great utilities such as Flow to restrict implicit types in React Native. I still recommend learning at least one, strongly typed object oriented language, either Native iOS (Swift or Objective-c) or Android needs to be learned for the following reasons:

Popularity

Javascript Use

Each year Github aggregates data to determine language popularity. In 2017, Github [note]madnight.github.io/githut/#/pull_requests/2018/1 [/note] reports that Javascript continues to rate as the number one favourited language amongst developers. This makes learning React Native a to easier due to the amount of information and knowledge out there. According to Stack Overflows 2018 Developer Survey  Javascript is used by 68% of developers, and if you narrow that fo only Professional Developers, the percentage climbs to 71.5%

Supported Feature

As React Native is not officially supported by either Apple or Google, not all native features are supported in by React Native. For example, implementing a simple keyboard accessory in React Native is virtually impossible. Support to customise that view is missing. The projects themselves require significant configuration to support React Native where hardware of the device is accessed. Having native definitely expedited app setup. Apple required the user accept access to hardware and Google maps for instance is not native to the iOS platform, so knowledge of including external dependencies is a definite help. 

Complex Design

Design patterns of Android and iOS are quite different. Heavy testing is required to determine which platform is being used in order to execute the correct code. Developing a unified UI for both platforms is not the goal of React Native, building platform-oriented interfaces with minimal programming effort is the real purpose. Knowledge of user interface design abilities in both platforms in indispensable.

Maintenance

Javascript introduces regular new features, and React Native is constantly implementing these updates through continuous development. Add to this, Javascript itself has many versions and to  make it compatible with many browsers, Babel or Webpack (external compilers) are required to build applications too support JSX syntax and type annotations. With React Native and external dependencies React Nativeconstantly updating future maintainability of React Native apps is expensive as opposed to native development. 

This is a risk in choosing React Native. For example, the last Salesforce React-Native SDK still depends on RN 0.50.4 (released last November), and applications requiring it as a dependency will need to be downgraded to support that version. The current Salesforce SDK depends on RN 0.53.3, we have to upgrade all the other dependencies and configure changes. 

Testing

React Native has a very immature testing framework, we will discuss this in more depth in our next article. Regardless of some concerns above, React Native is a great technology worth learning. React Native is a cost effective alternative favoured amongst the community because it is so friendly. At worst, where it lacks interaction with native frameworks, there is the opportunity to build native solutions to fill these void. For example, where Javascript is missing multi-threading functionality, we can build native multi-threaded solutions to improve efficiency and integrate them.

Conclusion

I hope I have presented some good evidence of pros and cons of React Native development. This is a very complex issue amongst mobile developers and each developer has their own opinion. Please feel free to share your opinions and discussions by commenting below. If React Native interests you may gain a lot of knowledge reading our other blog

– Hector

Leave a Reply

Your email address will not be published. Required fields are marked *