We all know how painful react-native upgrades can be. At BAM, we made a handful of them. We have made some mistakes, and we’ve learnt our lessons from the past. So we’d like to share our guide and some advice to upgrade the react-native version of your app, for non-expo users.
Two resources to check out before you begin your upgrade :
Here are the steps to upgrade your app:
Here are some advices and lessons we’ve learnt with the upgrades we’ve made over time.
When facing an error, apart from googling it, these two resources can help you:
If you have several majors you planned on upgrading, our advice here is to upgrade each major one by one, and not all of them at one time.
Here are the reasons why:
One of the reasons why I was skeptical of this method, is that I was scared to do some rework (building several times, over and over again), and that I would spend some time correcting an error that would be fixed in a later version anyway. But from our experience, that didn’t happen a lot.
Weeeell, it depends. There are two kinds of diffs in the .pbxproj:
This change is an index, changed by Xcode. Xcode will make those changes itself, as a consequence of other modifications. So this change shouldn’t be applied.
Our advice here is to go through all of the diffs in the react-native upgrade helper, and ask yourself wether the change is automatic or not. Apply them if they don’t seem to be automatic, like indexes. And once you’ve ran ++code>pod install++/code>, compare your diffs to the upgrade helper’s diffs, to make sure they’re all there.
In either case, never change the ++code>.pbxproj++/code> file directly!
Every change you make has to be made inside Xcode, in the corresponding section. For exemple, if you need to change the iPhone deployment target, you can go into the ++code>Build Settings++/code> section, inside your project and your targets settings.
The last subject we wanted to talk about is estimations. It is very hard to estimate a react-native upgrade, as the problems you’ll encounter and the changes you’ll need to make are directly related to your codebase.
But to have an idea of how much time a react-native upgrade may require, especially if you’ve never done any, we wanted to share the ones we use from our experience.
For each major from the version 0.65, we count between 1 and 2 man-day, except for the 0.68 that introduces the new architecture, for which we count between 3 and 4 man-day.
Keep in mind that this is very project-dependent. For example, you should increase these estimations if you’ve written some native code. Also, the bigger your codebase is, and the bigger your list of dependencies is, the bigger should your estimations be.
The main idea here is don’t underestimate, and give some visibility to your team and project managers that your estimations are not precise at all and this really may take longer.
Thanks for reading this guide! We sincerely hope that this will help!
We’d love to know about your own experience with react-native upgrades. If we all agree on some steps to upgrade, we’d be happy to make a PR to add this information to the official documentation.