Upgrading React Native App

Since August 2019, all android apps are required to support 64-bit architecture. While upgrading a react app seems a bit daunting at first, it isn’t that hard.

Upgrade the React Native version

You can follow the official React Native upgrade method to update your React Native application https://facebook.github.io/react-native/docs/upgrading or you can do it manually comparing and changing each and every file. I prefer the second approach.

To do so visit any of the following links:
https://react-native-community.github.io/upgrade-helper/?from=0.56.0&to=0.59.4
Or
https://github.com/pvinis/rn-diff-purge/compare/version/0.56.0..version/0.59.4

Select the base version(current version) and the version to which you want to upgrade. Once you select those, you will be presented with the file difference between those versions.

Manually make those changes and run npm install.
Add below code to gradle.properties file in the android root folder:

android.useAndroidX=true

android.enableJetifier=true

Upgrading the plugins

Check out the plugins that you are using in your package.json file and update it accordingly. Some packages don’t support old version of React Native. Also, the new version of packages might be updated keeping in mind 64-bit architecture and AndroidX.
But there is still a chance that you want to use some package that hasn’t been upgraded yet.

Use Jetifier

Jetifier will convert all your support dependencies to AndroidX. You need to run the following commands in order:

npm i jetify
npx run jetify

Now everytime you install any old package, run “npx run jetify” command. You can even create a post-install script for the same.

Leave a comment

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