Two years with React Native and why its no longer the future
When I started with React Native, coming from a Cordova background with a bit of Xamarin thrown in for good measure, React Native was a breath of fresh air.
I was able to write interfaces quickly, that did what I expected with a minimum of hacky code. I was able to test and perform code coverage with jest, and even able to test the UI without bloated and fickle solutions like Appium.
Sure, state management was a challenge for newcomers, but MobX solved that for me in a number of ways and eased the transition. Even though I ultimately stayed away from Redux as I felt the boilerplate code was so bloated it would lead to small errors, I took a lot away from that architecture. All was good.
At first, upgrades, even though a little cumbersome were fairly linear, even those with breaking changes, you knew where to look. However as time has gone along, breaking changes have become more serious and harder to solve.
Why? In my opinion there are a few reasons.
React-native link is now broken to the point where I don’t even bother anymore.
A number of RN iOS libraries now use CocoaPods as their preferred method of linking with react native. Firebase is a particular offender, and at this point is where I end up with a half CocoaPods, half react native library. Its manageable, and I actually quite like CocoaPods, but try a full migration to CocoaPods and you are up for a day of effort and then you will likely go back.
That said, I actually quite like iOS linking when it is going well, because…
Android and react native sucks. OMG it sucks so hard.
Sure you are about to say, you had me until this point. But until you have spent an entire day in Android dependency hell, with mismatching google play and support library versions, and nothing is building, you just don’t understand.
“But these are both native system problems, don’t blame React Native for things it can’t control!”
Conventional wisdom says I am wrong about assigning blame to React Native, but the problem with React Native, and ultimately the point of the manifesto, is that it tries to do too little.
The other day I setup a new, very simple project in React Native. I did this after giving flutter a try, got cold feet, and decided I needed to go back into safer harbours. So I went about scaffolding a new project.
The experience went like this:
- Create react app
All good at this stage
- Setup MobX
Oh look, need to install a later version of the android engine… broke hot reloading.
- Setup “react-native-navigation”
Now i need to update Gradle to the latest version, and all the dependencies need a version bump too
- Live in dependency hell for the rest of the day
- Develop app now that we have it building
Its a pretty small app, 4 screens in total, just displaying information
- Go and “see how its going on iOS”
Oh look, “react-native-navigation” isn’t compatible with react v0.55, do a version bump to v0.56
- Great now nothing works… Babel is broken?
No detailed migration guide, I spent a day trying to work through it and ultimately discovered that metro is only compatible with an interum version of Babel, hooray, I solved a long git issue for all the other poor souls who found themselves here.
- Oh, big changes on Android side as well?
Looks like Android might be finally solving some of its dependency problems with a centralised versioning
- I can now build and deploy!
I would say 70% of my effort to produce this app was spent scaffolding React Native, instead of doing any actual coding. And this isn’t my first RN app.
So what do we need for React Native to be great again?
An actual framework. Something that covers the 90% use case of mobile apps from the outset without additional plugins. Its great that we can use “anything we like” but not having any sort of navigation bundled into it. C’mon. And if you aren’t going to bundle things into the framework, its time to clean up the linking, dependency resolution and upgrade process.
I know its pre-release, but there doesn’t seem to be any movement towards fixing these problems. When they suggested that their navigation solution was dead, and that we should move over to a barely documented project called “react-navigation” that just uses plain JS, thats the moment it all started to go wrong.
What am I going to do in the meantime? Well I have some big projects on React Native that aren’t going away any time soon, but I am going to start investing more time in Flutter until I flip the table there too.
Ryan Knell runs Snappy Appps, an app developer servicing Brisbane in Queensland Australia