Sometimes people want to downgrade to a lower SDK version. For example, if you are using SDK 19 and you decide you want to use SDK 17.
In general, I don’t advise this. Each successive SDK adds more features, bug fixes, and performance improvements. But occasionally, you may want to downgrade to match the version of React Native in another project, or because there is a bug introduced in a new version of the SDK/React Native that you want to avoid, or for some other reason where you are sure you know what you are doing.
The steps you need to take for this are:
(1) Update the version of "react-native"
listed in your package.json
file.
It’s the line that looks like this:
"react-native": "https://github.com/expo/react-native/archive/sdk-19.0.0.tar.gz",
},
You can find a complete list of the releases of react-native for Expo SDKs here:
You’ll want to choose one that starts with sdk-
, typically the most recent release of the SDK version that you are interested in. For example, if you want to use SDK 18, then you would look through the list of releases and see that sdk-18.0.3
is the most recent release.
Once you pick a release from that page, right click the “tar.gz” link and copy the URL for it so you get something like
https://github.com/expo/react-native/archive/sdk-18.0.3.tar.gz
Set the "react-native"
version in your package.json
to this URL.
So your package.json
would look something like this:
"dependencies": {
"@expo/samples": "^2.0.2",
"expo": "^19.0.0",
"react": "16.0.0-alpha.12",
"react-native": "https://github.com/expo/react-native/archive/sdk-18.0.3.tar.gz",
"react-navigation": "^1.0.0-beta.12"
},
You’ll also need to update the "expo"
and "react"
versions.
(1b) For "expo"
, run
npm show expo versions
from the shell, and find the most recent one that corresponds to the SDK version you are interested in. In this example (SDK18), it would be '18.0.9',
(1c) For react
, we have to (i) figure out what version of React Native is used by the SDK version we are interested in, and then figure out what version of React that version of React Native corresponds to.
The easiest way to figure out what version of RN is used in an Expo SDK version is to check the release notes.
So, if you go look at the Expo blog at https://blog.expo.io/ and scroll back through the list of posts until you find the release notes for the version you’re looking for. For SDK 18, it’s this post:
Expo SDK v18.0.0 is now available | by Brent Vatne | Exposition
… which mentions
Expo SDK 18.0.0 is based off the recently released React Native 0.45, “May”.
Then if you follow the links to the source code for that release on Github, you’ll see that it has a peer dependency for "react"
of 16.0.0-alpha.12
. (I got that from react-native/package.json at v0.45.1 · facebook/react-native · GitHub )
(1d) Now that we’ve updated package.json
, either yarn
again or npm install
(depending on which tool you use). To be safe, you might want to rm -rf node_modules
before.
(2) Now we edit app.json
(or exp.json
if that’s what your project uses). Update the "sdkVersion"
key to the one you want. So, something like
"sdkVersion": "18.0.3",
(3) Then close the project in XDE (or CRNA or exp
) and restart it. And it should work!
Though there’s a decent chance you’ll have to update some application code if you’re going back very far in versions or using certain kinds of libraries.
(4) If you’ve published projects using Expo publishing, our code delivery system currently assumes that you want to use the latest version published against the most recent SDK you’ve used (this lets you push bug fixes to people who are on an old version of the binary of your app in a sane way).
So for some use cases, you may need to clear out the versions of your published project that run against the newer SDK. We don’t have an interface for doing that yet, so e-mail support with the information about what version you are downgrading to and which project and which user you are and any other relevant information to support@expo.io and we can fix that for you.
We hope to make an interface for this soon.
Again, in general, I don’t advise doing this, but if you know you what you are doing and are sure you want to do this, hopefully this guide is helpful.
Also, note that this was written in August 2017 and may become out of date.