Expo SDK v31.0.0 is now available

Eric Samelson
Exposition
Published in
7 min readNov 2, 2018

--

Expo SDK v31.0.0 is based on the recently released React Native 0.57 “September 2018”. The previous SDK release, v30.0.0, was based on React Native 0.55, “March 2018”.

This is the first release as part of our Expo for Professionals push, and many of the changes in this release are geared towards better supporting skilled professionals using Expo as part of a business. If you haven’t read about this new push and our other exciting upcoming changes, be sure to take a look!

Support for Babel 7

With React Native 0.57 comes support for Babel 7. Babel 7 is faster, more configurable, and more modern than its predecessor and comes with lots of nice extras like TypeScript support, JS configs and more.

To accommodate this change, we’ve released babel-preset-expo@5 which will ship with SDK 31. If you’re upgrading from a previous SDK version and have no custom babel settings, you shouldn’t need to make any changes; otherwise, make sure to update to this new version in order to take advantage of Babel 7.

JavaScriptCore upgraded on Android

We’ve upgraded the version of JSC, the JS virtual machine used by Expo apps, to r224109 on Android. This version is close to iOS 11’s JSC and includes support for nearly all ES2015, ES2016, and ES2017 features such as Symbols, for-of loops, and generators. The previous version was from 2014 and meant that Babel compilation or runtime libraries were needed to use features like these. These features are now supported natively, paving the way for smaller JS bundles and faster transpilation.

Build your own standalone apps with Turtle CLI

For many Expo developers, Expo’s standalone app builders are a convenient way to build IPA and APK binaries for distribution. However, the builder service is shared and sometimes there are wait times or builders go down. We’re continuing to address these issues, but to give developers more agency over their builds, we’ve also recently released Turtle CLI, a version of our standalone app builder that you can run on your computer, server, or CI service. See this guide in our docs for how to set up and run Turtle CLI.

Standalone APK built on CircleCI using Turtle CLI

Smaller standalone app builds

We’ve been working hard to slim down the size of these final IPA and APK files. Previously, Expo app binaries included the native code for the seven most recent SDK versions. With SDK 30, we launched single-SDK builds for iOS, and we’ve recently launched single-SDK builds for Android as well. These builds contain only the SDK version the app uses when built and are both faster and slimmer — the size of a basic Android APK dropped from 27 to 17 MB.

Additionally, we noticed that many people run expo build for the same app repeatedly. As a reminder, for many types of updates you can run expo publish to publish an over-the-air update to your existing app, which your users will download next time they open your app. If your changes are JS-only, you can avoid creating a new build, and instead send out updates using only expo publish. Read about limitations for OTA updates here.

Dropping SDK 24, will drop SDK 25 next release

We routinely drop SDK versions that have low usage in order to reduce the number of versions that we need to support. This release sees the end of life for SDK 24. As usual, your standalone apps built with SDK 24 will continue to work; however, SDK 24 projects will no longer work within the latest version of Expo Client. If you want to re-run expo build, then you’ll need to upgrade from SDK 24, preferably to SDK 31 so you won’t need to update again for a while (and also because each Expo version is better than the last!).

Dropping support for iOS 9 and Android 4.4

In order to keep up with the fast-moving world of mobile development, we periodically drop support for older operating systems nearing their end of life. iOS 12 is here, and most users are on iOS 10+ according to Apple. Dropping Android 4.4 was a prerequisite for the JSC upgrade; additionally, it paves the way for 64-bit support, which will be required for all apps in the Google Play Store by August 2019.

With single-SDK builds, older SDK versions will continue to support all operating systems they did before. This means that if maintaining support for iOS 9 or Android 4.4 for a bit longer is particularly important for you, you can stay on an older SDK version until you’re ready to drop these systems.

Snack improvements and additions

Autosaved drafts

Never lose your work again! Once you sign in, Snack will now automatically save your work.

Markdown support

View and edit markdown files in Snacks or imported GitHub projects.

API improvements and additions

Revamped Localization module

Our Localization module has been completely rewritten to work better with community libraries like i18n-js. We now expose most information synchronously so that your app can localize immediately instead of waiting for an asynchronous bridge call. Check out the updated docs.

Base64 encoding support for FileSystem module

Our FileSystem API now supports reading and writing in Base64 encoding. This allows you to interact directly with more types of files on the device’s file system and means that ImageStore can now be supported on Android.

Other fixes & improvements

Here are a few other notable changes and bugfixes we’ve made in this release. For a more detailed list, see our changelog.

  • Branch: Fixed links not working when app is first opened on iOS. (Related PR.) Thanks AdamPD!
  • Camera: Add support for video stabilization on iOS. (Related PR.) Thanks n8!
  • Camera: Fix QR code scanning not working on Pixel 2 devices. (Related PR.) Thanks alexshikov!
  • Constants: Add support for new iOS device types. (Related PR.)
  • Linking: Fixed getInitialURL() resolving with the incorrect URL when using intent filters. (Related PR.) Thanks schneidmaster!
  • Facebook: Updated underlying native libraries to version 4.37. (Related PR.)
  • Segment: Added getEnabledAsync and setEnabledAsync methods to allow opting in/out at runtime. (Related PR.)
  • Standalone apps built with expo build:ios and expo build:android no longer send any Expo analytics to Amplitude. Any analytics you set up with the Amplitude module are unaffected. (Related commit.)

A special thanks to our open source contributors who made commits as part of this release! We’ve been working hard to make it easier to contribute to Expo, and our client repo is now open-source first — check it out if you’d like to fix a bug or add a new feature.

Library updates

  • Updated react-native-gesture-handler from 1.0.6 to 1.0.8
  • Updated react-native-reanimated from 1.0.0-alpha.6 to 1.0.0-alpha.10
  • Updated react-native-screens from 1.0.0-alpha.5 to 1.0.0-alpha.15
  • Updated react-native-maps from 0.21.0 to 0.22.0
  • Updated react-native-svg from 6.2.2 to 8.0.8
  • Updated react-native-view-shot to 2.5.0

Breaking Changes

  • The default export from the expo package is deprecated in favor of named exports to pave the way for static analysis tools. Starting with SDK 31, you’ll see a warning if you use the import Expo from 'expo'; syntax; in a future version, support for this syntax will be removed entirely. Instead, we recommend you use destructured imports (import { ... } from 'expo';) and import only the modules you need. If you’d like to import all modules, use import * as Expo from 'expo';.
  • Flow types have been removed as we begin to migrate to TypeScript over the next few SDK releases.
  • @expo/vector-icons has been updated to 8.0.0, adding support for AntDesign icons and updating other icons sets. We recommend you do a pass over your icons to make sure none of the names changed. The source code for the latest version can be found here.
  • Several AR enum types have been renamed: BlendShapesBlendShape, FaceAnchorPropsFaceAnchorProp, PlaneDetectionTypesPlaneDetection, WorldAlignmentTypesWorldAlignment, EventTypesEventType, AnchorTypesAnchorType, AnchorEventTypesAnchorEventType, FrameAttributesFrameAttribute, TrackingStatesTrackingState, TrackingStateReasonsTrackingStateReason, TrackingConfigurationsTrackingConfiguration
  • FacebookAds.TriggerableView has been renamed to FacebookAds.AdTriggerView.
  • FacebookAds.MediaView has been renamed to FacebookAds.AdMediaView.
  • The translation field in the ad object returned by FacebookAds.NativeAdView was renamed to adTranslation.
  • The user_friends permission has been removed as a default when authenticating with the Facebook module. If you want to request this permission, you’ll now need to specify it explicitly.
  • Several Haptic enum types have been renamed: NotificationTypesNotificationFeedbackType, ImpactStylesImpactFeedbackStyle
  • Sound.create is now Sound.createAsync
  • The ScreenOrientation.allow method has been renamed to allowAsync and now returns a promise to properly handle unsupported screen orientations, such as upside down on the iPhone X.
  • The Speech API’s onError function is passed an Error object instead of a string.
  • If you use a custom babel configuration, you’ll need to update it to support Babel 7. Additionally, if you depend on babel-preset-expo, you’ll need to install version 5.0.0 or later.
  • If you use a custom rn-cli.config.js, there are breaking changes to the format of this file with this release. We recommend reading the React Native 0.57 source code to figure out what changes to make.

Upgrading Your App

Here’s how to upgrade your app to Expo SDK 31.0.0 from 30.0.0:

  • Close your Expo CLI server
  • In app.json, change sdkVersion to "31.0.0"
  • In package.json, change these dependencies:
    - react-native to "https://github.com/expo/react-native/archive/sdk-31.0.1.tar.gz"
    - expo to "^31.0.4"
    - react to "16.5.0" —( this exact version)
    - react-navigation to "^2.18.2" (if you use it — this is also optional, you don’t have to update it to use the newest SDK. If you choose to, before you make this change make sure you read the changelog for breaking changes)
    - jest-expo to "^31.0.0" (if you use it)
    - sentry-expo to "~1.9.0" (if you use it)
  • Delete your project’s node_modules directory and run npm install again (or use Yarn, we love Yarn)
  • Run expo start -c
  • Update the Expo app on your phones from the App Store / Google Play. expo-cli will automatically update your apps in simulators.
  • Make sure to check the breaking changes section of this post!
  • If you built a standalone app previously, remember that you will need to create a new build in order to update the SDK version. Run expo build:iosand/or expo build:android when you are ready to do a new build for submission to stores.
  • If you are planning to submit your iOS app to the App Store, you must upgrade to Xcode 10 in order to do so.

Updating ExpoKit to SDK 31

  • Follow the usual instructions given in the docs.
  • On iOS, add the following lines to your Podfile, after the rest of the universal modules:
pod 'EXLocalization',
:path => "../node_modules/expo-localization/ios"

--

--