I have spent 2 weeks using React Native for an existing iOS app, building a new feature that could be summed up as - providing a list of images which can be tapped on.
It is an easy task that I could do in a day with the beautiful Swift and familiar
UIKit framework. But things gets hairy with React Native..
React Native is changing rapidly, so what I mention here could only be relevant as of Jan 2017.
What I Like
Let’s start with what I like because that will be short.
My first impression with it is awesome. It is refreshing. Going through the Hello World example and more is enlightening.
Then there is code push. No more waiting for app review.
So I went on to write a basic guide and about CodePush.
Mixing React Native with True Native
By True Native, I am referring to all the frameworks provided by iOS:
It could be just me, because I have an existing code base that uses True Native. If you start a project from scratch using pure React Native, most likely you will not have the problem.
But if you are like me, you have to deal with extra problems.
The first is communication between the 2 platforms. Quoted:
But, when we mix React Native and native components, we need some special, cross-language mechanisms that would allow us to pass information between them.
And this cross-language (or cross-platform) mechanism is very messy.
They provided a few ways, but none is beautiful.
You will get your hands dirty with Objective-C because React Native require macro to expose a module or function.
It is written poorly, and lacking for some classes such as emitters.
I encountered this issue where they deprecate a method
sendAppEventWithName, and recommended to use a subclass of
Yet, their documentation is still using the deprecated method.
Being a good developer, I use the new way. But alas! The new way didn’t work. It could be either one the reason: I do not know how to use because there is no documentation, or it has a bug.
I believe there is a bug.
There are lots of bugs.
I filed an issue that is to do with a
Touchable being fired when it’s parent (a
UIScrollView) is being scrolled.
Somehow I believe my issue will be of a lesser priority because I am mixing a true native
UIScrollView with react native component.
As an early-user of a piece of programming platform, you will use much of your time to help the community. Good if you have the time.
Otherwise, you will be wasting precious time.