Documentation

Hey friend! We are co-hosting a conference with Software Mansion, learn more.

Upgrading Expo SDK Walkthrough

If you are a couple of versions behind, upgrading your projects Expo SDK version can be difficult because of the amount of breaking changes and deprecations in each upgrade. Don't worry, here are all the breaking changes in each SDK version upgrade.
Expo only provides support for the last 6 versions since the latest version.

  • app.json, change sdkVersion to "31.0.0",
  • In package.json, change these dependencies:
{
  "react-native": "https://github.com/expo/react-native/archive/sdk-31.0.0.tar.gz",
  "expo": "^31.0.0",
  "react": "16.5.0"
}
  • Delete your project’s node_modules directory and run npm install again

  • There are several small breaking API changes with this release. See the changelog for the full list.

  • app.json, change sdkVersion to "30.0.0",
  • In package.json, change these dependencies:
{
  "react-native": "https://github.com/expo/react-native/archive/sdk-30.0.0.tar.gz",
  "expo": "^30.0.0",
  "react": "16.3.1"
}
  • Delete your project’s node_modules directory and run npm install again

  • Fingerprint has been renamed to LocalAuthentication

  • app.json, change sdkVersion to "29.0.0",
  • In package.json, change these dependencies:
{
  "react-native": "https://github.com/expo/react-native/archive/sdk-29.0.0.tar.gz",
  "expo": "^29.0.0",
  "react": "16.3.1"
}
  • Delete your project’s node_modules directory and run npm install again

  • Some field names in Contacts were changed. See the documentation for more information.

  • app.json, change sdkVersion to "28.0.0",
  • In package.json, change these dependencies:
{
  "react-native": "https://github.com/expo/react-native/archive/sdk-28.0.0.tar.gz",
  "expo": "^28.0.0",
  "react": "16.3.1"
}
  • Delete your project’s node_modules directory and run npm install again

  • Android apps on all SDK versions now require notification channels for push notifications. This may impact you even if you don’t yet use SDK 28. Read this blog post for all of the necessary information.
  • Android app icons are now coerced into adaptive icons. Be sure to test your app icon and supply an adaptive icon if needed. Read this blog post for all of the necessary information.
  • Print has been moved out of DangerZone; update your imports accordingly.

  • In app.json, change sdkVersion to "27.0.0"
  • In package.json, change these dependencies:
{
  "react-native": "https://github.com/expo/react-native/archive/sdk-27.0.0.tar.gz",
  "expo": "^27.0.0",
  "react": "16.3.1"
}
  • Delete your project’s node_modules directory and run npm install again

  • View.propTypes has been removed from React Native, so if your code (or any of your dependent libraries) uses it, that will break. Use ViewPropTypes instead. We strongly recommend running your app with the dev flag disabled to test whether it’s affected by this change.
  • We changed the format of Constants.linkingUri (see Linking changes above), so if your code makes assumptions about this, you should double check that.
  • Camera roll permissions are now required to use ImagePicker.launchCameraAsync() and ImagePicker.launchImageLibraryAsync(). You can ask for them by calling Permissions.askAsync(Permissions.CAMERA_ROLL).

  • In app.json, change sdkVersion to "26.0.0"
  • In package.json, change these dependencies:
{
  "react-native": "https://github.com/expo/react-native/archive/sdk-26.0.0.tar.gz",
  "expo": "^26.0.0",
  "react": "16.3.0-alpha.1"
}
  • Delete your project’s node_modules directory and run npm install again

  • Expo.Util is deprecated, functionality has been moved out to Expo.DangerZone.Localization and Expo.Updates.
  • ios.loadJSInBackgroundExperimental is now deprecated, use the new Updates API instead. The equivalent of this configuration is updates.fallbackToCacheTimeout: 0.
  • isRemoteJSEnabled is also deprecated, use updates.enabled instead.
  • React Native 0.54 depends on React 16.3.0-alpha.1. React 16.3 deprecates the usage of componentWillMount, componentWillReceiveProps, and componentWillUpdate. These have been replaced with static lifecycle methods: getDerivedStateFromProps and getSnapshotBeforeUpdate, but only getDerivedStateFromProps is available in 16.3.0-alpha.1.
  • On iOS, WebBrowser.dismissBrowser() promise now resolves with {type:'dismiss} rather than {type:'dismissed'} to match Android
  • AdMob method name changes. requestAd to requestAdAsync, showAd to showAdAsync, isReady to getIsReadyAsync.
  • On iOS, Contacts urls was renamed to urlAddresses to match Android. Related commit.
  • On iOS, calling Notifications.getExpoPushToken() will throw an error if you don’t have permission to send notifications. We recommend call Permissions.getAsync(Permissions.NOTIFICATIONS) and, if needed and you haven’t asked before, Permissions.askAsync(Permissions.NOTIFICATIONS) before getting push token.
  • React native 0.53.0 removed the TextInput autoGrow prop. Commit.

  • In app.json, change sdkVersion to "25.0.0"
  • In package.json, change these dependencies:
{
  "react-native": "https://github.com/expo/react-native/archive/sdk-25.0.0.tar.gz",
  "expo": "^25.0.0",
  "react": "16.2.0"
}
  • Delete your project’s node_modules directory and run npm install again

  • If you have any scripts in your project that depend on metro-bundler, you will need to change those to metro (related commit). A likely place for this is in rn-cli.config.js.
  • Although not technically part of the SDK, React Navigation is commonly used by Expo users, and it’s worth mentioning that on Android React Navigation now properly accounts for the translucent status bar. This may require you to remove code that you have to workaround that (maybe a paddingTop somewhere to avoid the content from rendering underneath the status bar). Read the React Navigation release notes for more information. Only applies to react-navigation@1.0.0-beta.26 and higher.

  • In app.json, change sdkVersion to "24.0.0"
  • In package.json, change these dependencies:
{
  "react-native": "https://github.com/expo/react-native/archive/sdk-24.0.0.tar.gz",
  "expo": "^24.0.0",
  "react": "16.0.0"
}
  • Delete your project’s node_modules directory and run npm install again

The following APIs have been removed after being deprecated for a minimum of 2 releases:
  • Expo.LegacyAsyncStorage
  • Expo.Font.style
  • Passing an object into Expo.SQLite.openDatabase() instead of separate arguments is no longer supported.

  • In app.json, change sdkVersion to "23.0.0"
  • In package.json, change these dependencies:
{
  "react-native": "https://github.com/expo/react-native/archive/sdk-23.0.0.tar.gz",
  "expo": "^23.0.0",
  "react": "16.0.0"
}
  • Delete your project’s node_modules directory and run npm install again

  • React Native no longer supports nesting components inside of <Image> — some developers used this to use an image as a background behind other views. To fix this in your app, replace the Image component anywhere where you are nesting views inside of it with the ImageBackground component. See a Snack example here.
  • React Native now defaults enableBabelRCLookup (recursive) to false in Metro bundler (the packager used by React Native / Expo). This is unlikely to cause any problems for your application — in our case, this lets us remove a script to delete nested .babelrc files from node_modules in our postinstall. If you run into transform errors when updating your app, read this commit message for more information and to see how to opt-in to the old behavior.

  • In app.json, change sdkVersion to "22.0.0"
  • In package.json, change these dependencies:
{
  "react-native": "https://github.com/expo/react-native/archive/sdk-22.0.1.tar.gz",
  "expo": "^22.0.0",
  "react": "16.0.0-beta.5"
}
  • Delete your project’s node_modules directory and run npm install again

Metro Bundler (the React Native packager) now errors (instead of silently ignoring) dynamic requires. In particular this breaks an older version of moment.js if you were using that (or indirectly depending on it).
Several deprecated APIs have been removed. All of these APIs printed warning messages in previous releases:
  • Expo.Notifications.getExponentPushToken is now Expo.Notifications.getExpoPushToken.
  • Expo.AdMob.AdMobInterstitials.tryShowNewInterstitial has been removed in favor of requestAd and showAd.
  • Expo.Segment.initializeAndroid and initializeIOS have been removed in favor of Expo.Segment.initialize.
  • The tintEffect prop of Expo.BlurView has been removed in favor of the tint prop.
  • Expo.SecureStore.setValueWithKeyAsync, getValueWithKeyAsync, and deleteValueWithKeyAsync are now setItemAsync, getItemAsync, and deleteItemAsync. The order of arguments to setValueWithKeyAsync changed from (value, key) to (key, value).
  • The callback prop of Expo.Video and Expo.Audio is now onPlaybackStatusUpdate. This is not a breaking change yet but we plan to remove LegacyAsyncStorage in SDK 24. If you, or any libraries that you use. use View.propTypes.style you will need to change that to ViewPropTypes.style.
If you have not yet updated your imports of PropTypes as warned in deprecation warnings in previous releases, you will need to do this now. Install the prop-types package and import PropTypes from 'prop-types'; instead of import { PropTypes } from React;! Similarly, if you depend on React.createClass, you will need to install the create-react-class package and import createReactClass from 'create-react-class'; as described in the React documentation.

  • In app.json, change sdkVersion to "21.0.0"
  • In package.json, change these dependencies:
{
  "react-native": "https://github.com/expo/react-native/archive/sdk-21.0.2.tar.gz",
  "expo": "^21.0.0",
  "react": "16.0.0-alpha.12"
}
  • Delete your project’s node_modules directory and run npm install again

Camera
  • The takePicture function is now called takePictureAsync and now returns an object with many keys, instead of just returning the URI. The URI is available under the uri key of the returned object.
  • Previously this function would return a value like: "file://path/to/your/file.jpg"
  • And will now return an object like: { "uri": "file://path/to/your/file.jpg" }
Secure Store
  • setValueWithKeyAsyncsetItemAsync: The order of the arguments has been reversed to match typical key-value store APIs. This function used to expect (value, key) and now expects (key, value).
  • getValueWithKeyAsyncgetItemAsync: Trying to retrieve an entry that doesn’t exist returns null instead of throwing an error.
  • deleteValueWithKeyAsyncdeleteItemAsync
Payments
  • We’d previously announced Stripe support on iOS as part of our experimental DangerZone APIs. The Payments API was using the Stripe SDK on iOS. We learned that Apple sometimes rejects apps which contain the Stripe SDK but don’t offer anything for sale. To help your App Review process go more smoothly, we’ve decided to remove the Stripe SDK and experimental Payments API from apps built with the Expo standalone builder. We’re still excited to give developers a way to let users pay for goods when they need to and we’ll announce more ways to do so shortly.