How to Upgrade from React Native 0.57 to 0.59 | Part 1: Upgrading to 0.58

Juliette Rapala
Jul 23 · 6 min read

Hey you! You need to upgrade to 0.59! 📢

If you haven’t already heard, all React Native apps will need to be upgraded to 0.59 by August 01, 2019 if you wish to submit updates to the Google Play store. This is due to a new 64-bit requirement set forth by Google Play. They're pretty serious about it:

By August 1, 2019, all apps that use native code must provide a 64-bit version in addition to the 32-bit version in order to publish an update. This past January, we reiterated that this is required in order to make way for innovation and in anticipation of future Android devices that only support 64-bit code.

Lucky for us, React Native has introduced 64-bits builds in their 0.59 release. The problem, though, is that it can be a little tricky to update. That’s why I created this tutorial. Follow along if you want to get your app up the speed and future-proofed for upcoming releases as well.

About This Tutorial

In my situation, I needed to upgrade a project from 0.57.4 to 0.59.8 (Note: A newer 0.59.10 has since been released). I also required both an Android and an iOS build.

When bumping a project up by two minor versions, I highly suggest upgrading one minor version at a time. (e.g. 0.57 to 0.58, then 0.58 to 0.59). It eases troubleshooting if something goes wrong.

So if you need to climb up from 0.57 like I did, I present to you Part 1 of 2: Upgrading to 0.58!

Part 1: Upgrading to React Native 0.58 ⬆️

🔑 Key Changes

  • The iOS JavaScriptCore framework now needs to be linked to our app.
  • Android’s target 27 SDK is now supported.

Step 1: Update your package.json ⬆️

Open up your package.json and update the following dependencies:

Then, delete your node_modules and reinstall a fresh batch with npm i.

Step 2: Modernize Babel 🗣

See that Babel upgrade above? Version 7 introduced a new type of Babel config file that is now much preferred, and even required by many libraries that you may use.

To update:

1. Create a new babel.config.js file.

2. Port over any configs you may have in your current .babelrc file. These presets will now need to be exported, like in the example below.

3. Once done, delete your old .babelrc file.

Step 3: Update Flow ⬆️

Here’s an easy one. Open .flowconfig and update the flow dependency:

If you use Flow and run into errors after this update, head over to their changelog to diagnose any issues.

Step 4: Link the JavaScriptCore Framework 🔗

1. Open up your XCode project.

2. Select your project:

3. Select your project’s main target settings:

4. Navigate into the Build Phases screen:

5. Under Link Binary With Libraries, add the JavaScriptCore.framework

Be aware that you may need to clean your XCode caches after this change. Here’s an article that can help with that.

Step 5: Update android/build.gradle ⬆️

Update android/build.gradle to support some new libraries/SDKs. Don’t delete anything, just update the following version numbers:

Step 6: Update Gradle ⬆️

Using the new Gradle version of 4.7 (updated in the previous step) will require you to update android/gradle/wrapper/gradle-wrapper.properties

Step 7: Update android/app/build.gradle ⬆️

In 0.58, React Native started to introduce 64-bit Android builds. To add this build type:

1. First, remove the ndk section. It will no longer be used:

2. Add the “arm64-v8a” architecture to the following lists:

3. Finally, since we are only upgrading to React Native 0.58.6, we must specify the React Native dependency that Android should use:

Step 8: Change Up Android Build Scripts 🚧

For those that use Buck, the build scripts have changed a bit:

1. In android/app/BUCK, replace the for jarfile/for aarfile loops with the following:

2. Now, create a new android/app/build_defs.bzl file:

Step 9: Check Your Refs 👀

<ScrollView>, <CameraRollView>, and <SwipeableRow> all got some updates that may cause you trouble if you use any refs in these components.

This wasn’t an issue in my project, but if it is for you, using createRef() for these components should get you on your way. More info can be found here.

Step 10: New Round Android Icons! 👏

Last but not least, round Android icons are now supported! Here’s a great article on how to create these. Once you’ve created these files, add them to your android/app/src/main/AndroidManifest.xml file:

Step 11: Test, Test, Test 🧪

Build your apps. Make sure to run them on actual iOS and Android devices. See any new deprecation warnings? Best to nip them in the bud right now. Some of these warnings may be coming from your dependencies. See if there are any updates out there. If not, you may need to patch things yourself.

Patching Packages 🚑

Need to patch a package? My favorite way to do this is with patch-package. This is a library that diffs changes you made to a node_modules package, saves those changes, and applies those changes every time you run npm i. Here’s a quick tutorial:

1. Run npm i patch-package

2. Add this post-install script to your package.json:

3. Head into your node_modules and make whatever changes you need to your target dependency.

4. Once done, run npx patch-package package-name. This will create a patch file for that particular package. You should commit these files to your project.

5. Now, anytime you delete your node_modules, your patch(es) will get added after you run npm i. 🙌

Next Steps

Got 0.58 working for your project? Congrats! 🎉 You’re halfway there!

Stayed tuned for Part 2: Upgrading to React Native 0.59!


👋 Hi! I’m Juliette. I work at Eventric as a Software Developer. Come follow me on Twitter at @Juliette.

Juliette Rapala

Written by

React & React Native Developer. Building awesome things @Eventric.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade