Breaking Down React Native v0.60

Author

Spencer Carli

Developer, cat dad, and devout pizza lover. Teaching at React Native School and building apps with Handlebar Labs.

Last Updated: July 24, 2019

At the beginning of the month the fantastic maintainers of React Native released the latest version of the framework, 0.60. Read the full announcement post.

It's a big deal! I think it's going to make things easier for people to get started by removing some surface area (deprecated APIs), providing new tools, and some new defaults that will set us all up for success.

I want to give you a quick run down for folks like me - people who already have React Native projects they're actively building and are weighing whether or not to spend a few hours to upgrade to 0.60 now or later.

New Defaults

First, the new defaults starting in 0.60. We've got changes on both the Android and iOS fronts - because of this make sure you thoroughly test both platforms!

AndroidX

I'll be the first to admit I'm not the best at keeping up with news, especially when it comes to Android...

A few weeks ago the Android version of all of my apps randomly stopped working - nothing installed, nothing built, nothing worked. What had happened was a breaking change in Android versioning/packaging. It was well documented but I, and it seems many library maintainers, promptly ignored the impending changes.

The result was that we were all trying to pull in the latest version of a package on Android, because of the way we specified our versions, but that the newest version was incompatible with the actual native code we had in place.

Ouch.

This all came back to AndroidX and now that React Native 0.60+ supports AndroidX by default it's an issue we don't have to worry about it.

Kind of...

The reality is that many React Native packages that bridge into native Android code haven't yet been updated. That means you can face problems when updating. To fix this:

  1. Make sure you're using the latest version of the package
  2. Use a tool called jettifier to patch the packages in your node_modules/.

CocoaPods

Since the beginning of React Native there have been two ways to run your project - without Cocoapods and with it. That meant two versions of installation instructions for iOS. That meant two separate failure points in installing a package. That meant 10x the number of issues for the library maintainers & React Native.

Starting in v0.60 of React Native there's just one way of managing a React Native project's native iOS dependencies and that's with Cocoapods. Many React Native developers are intimidated by Cocoapods, I was as well, but having one solution will vastly simplify everything and you'll get comfortable in no time. It's also a major benefit that our default behavior now aligns with the behavior the purely native iOS developers have been following for years.

You can learn more about what changes you'll have to make to your app to make sure everything works correctly here.

Linking

Somewhat in part to having just one option for how to install native dependencies on iOS, we now no longer have to worry about running react-native link after installing a package with native dependencies. The CLI, starting in 0.60, will automatically link the project for us.

One less thing to worry about for us.

Two things to note with this change though:

  1. On iOS, you'll often/always need to run pod install in the ios/ directory after adding a project
  2. After upgrading to 0.60 make sure to react-native unlink so that the React Native CLI can set everything up for you.

API Changes

Since version 0.59, and maybe even before, a few APIs have been throwing warnings in development that the API is deprecated, has been moved to a third-party package, and will be removed from core in a future version.

Well that day is here! If you haven't already, fortunately it's a really easy upgrade.

Lean Core Removals

Upgrading

Finally, is the upgrade process in general. There's been some churn in this area the last few months but I think things are settling down. It's been a tough question to answer lately but I'm really happy about a new tool that was released...

React Native Upgrade Helper

It's a beautiful website that will show you exactly what you need to change to upgrade the core React Native version. Select the version of React Native you're currently on and the version you're upgrading to and it will tell you everything required for that upgrade!

It'll still take time but now you've got a definitive tool to help you along the way.

Those are the biggest take aways from 0.60 for me!


As always, thank you so much to every person who dedicates some of their time to helping build, manage, and maintain React Native!

React Native by Example Logo

React Native by Example

Become an expert with React Native by building 10 completely unique apps. Nothing beats learning by doing.

Join the email list to be notified of all new lessons and classes!