All articles

Mobile8 min read

Expo SDK 58 upgrade: what broke in my React Native app

I upgraded a production React Native app to Expo SDK 58: stricter types, the expo-router tab bar, R8 on Android and Jest, with before and after code.

Also in Português, Español, Français

If you have a React Native app and haven't moved to Expo SDK 58 yet, the clock is already ticking: starting in April 2027, Apple only accepts App Store submissions built with the iOS 27 SDK. And SDK 58 is the one that brings it.

I upgraded one of my React Native apps, live on both stores, from SDK 56 to 58 in a single day. It wasn't a disaster, but it wasn't just running one command either. This post is the map of what broke and how I fixed it, so you don't find it all out the hard way.

TL;DR#

  • Stricter TypeScript: refs for View, ScrollView and TextInput now use ViewInstance, ScrollViewInstance and TextInputInstance. TextStyle is now read-only.
  • expo-router 58: the custom tab bar no longer receives navigation. It's emitter and navigateToTab now.
  • Android: R8 comes on in the release build. If any of your libraries use reflection, the app can open fine and only break in the store build.
  • Jest: the React Native preset is now a separate package, and reanimated needs its own resolver.
  • iOS 27: the app lifecycle becomes scene based (SceneDelegate). With prebuild, that's handled for you.

One version at a time#

Don't jump straight from 56 to 58. I moved to 57 first, committed, and only then went to 58. It looks like more work, but each version breaks different things, and mixing both in the same diff turns any error into a puzzle.

57 was smooth: React Native 0.86, no breaking changes over 0.85, and it even fixed a Hermes memory regression with reanimated that expo-doctor had been flagging since SDK 56.

58 is where the work is. It brings:

  • React Native 0.88
  • React 19.3
  • expo-router 58
  • reanimated 4.7 and worklets 0.13

The routine I follow on every upgrade:

npx expo install expo@^58.0.0
npx expo install --fix
npx expo-doctor
npm run typecheck
npm test

--fix aligns every dependency with the version the SDK expects. expo-doctor points out what's still off. And then the fun part begins.

The typecheck right after the upgrade: 57 errors in 22 files, all from the new React Native 0.88 types

1. The types got stricter#

React Native 0.88 rewrote a big chunk of its types. Nothing changes at runtime, but tsc starts complaining about things that used to pass.

Native component refs#

The ref type is no longer the component itself, it's now an "instance":

import { View, type ViewInstance } from "react-native";
 
function Panel() {
  const panelRef = useRef<ViewInstance>(null);
  return <View ref={panelRef} />;
}

The swap is mechanical: View becomes ViewInstance, ScrollView becomes ScrollViewInstance and TextInput becomes TextInputInstance. Same goes for forwardRef:

export const Scrollable = forwardRef<ScrollViewInstance, ScrollableProps>(...)

Tip: if you pass a ref to a screenshot function, like in react-native-view-shot, the RefObject type changes along with it.

TextStyle is now read-only#

This one got me in a text component that scales the font size. I used to build the style and keep adding properties to it:

const scaled: TextStyle = { fontSize: Math.round(base * scale) };
if (typeof flat.lineHeight === "number") {
  scaled.lineHeight = Math.round(flat.lineHeight * scale); // error on RN 0.88
}

With TextStyle read-only, the way out is to build the object all at once:

const scaled: TextStyle = {
  fontSize: Math.round(base * scale),
  ...(typeof flat.lineHeight === "number" && {
    lineHeight: Math.round(flat.lineHeight * scale),
  }),
};

It's actually more readable in the end.

The small ones#

Three one-line fixes that show up in almost every app:

  • ListFooterComponent no longer accepts null. Swap the : null in the ternary for : undefined.
  • AppState.currentState can be null. If you store that value in a type of your own, include null.
  • RefreshControl's onRefresh expects a function that returns nothing. If you pass React Query's refetch directly, it returns a Promise and TypeScript complains.
<RefreshControl onRefresh={() => void refetch()} refreshing={isRefetching} />

2. The expo-router tab bar#

If you use a custom tab bar, this is the error that shows up on screen, not just in tsc. expo-router 58 removed navigation from the tabBar props. In its place you get emitter and navigateToTab.

export function FloatingTabBar({ state, descriptors, emitter, navigateToTab }: BottomTabBarProps) {
  const goTo = (index: number) => {
    const route = state.routes[index];
 
    const event = emitter.emit({
      type: "tabPress",
      target: route.key,
      canPreventDefault: true,
    });
    if (event.defaultPrevented) return;
 
    navigateToTab(route.key);
  };
  // ...
}

Notice that navigateToTab takes the route key (route.key), not the name, the way navigation.navigate did.

The floating tab bar is back, now with emitter and navigateToTab

3. Android's R8 comes on by default#

This is the most dangerous one, because nothing breaks on your machine. SDK 58 now minifies the Android release build with R8 by default. R8 shortens names and strips code that looks unused.

The problem: libraries that use reflection look up classes by name at runtime. If R8 renamed or removed that class, the app opens and then breaks the moment you use the feature. And it only shows up in the release AAB, the one that goes to the store.

In my app, the list of suspects was long: the ads SDK, Google sign-in and in-app purchases. With no time to test every keep rule in a real release build, I chose to turn R8 off and treat it as a separate decision:

// app.config.ts
plugins: [
  // ...
  ["expo-build-properties", { android: { enableMinifyInReleaseBuilds: false } }],
],

It's not that R8 is bad. It makes the app smaller and faster. But turning R8 on calls for an end-to-end release test, and that doesn't fit in the middle of an SDK upgrade.

4. Jest#

If you run tests, go make some coffee. Two things changed.

The React Native preset is now a separate package: @react-native/jest-preset. jest-expo already points to it, but it ships its own resolver.

reanimated needs its own resolver too. Without it, the reanimated import crashes before the first test, because there's no native module under Jest:

Without the reanimated resolver, the test crashes before it runs

The problem is that the Jest config only accepts one resolver. The fix was to combine both in one file:

// jest.resolver.js
const jestExpoPreset = require("jest-expo/jest-preset");
const reanimatedResolver = require("react-native-reanimated/jest/resolver");
const presetResolver = require(jestExpoPreset.resolver);
 
module.exports = (request, options) =>
  reanimatedResolver(request, {
    ...options,
    defaultResolver: (req, opts) =>
      presetResolver(req, { ...opts, defaultResolver: options.defaultResolver }),
  });

The reanimated one decides which file to load (the JS version, not the native one). The preset one does the actual resolving. And in jest.config.js:

resolver: "<rootDir>/jest.resolver.js",

There was one more detail: expo-asset now calls a method on React Native's <Image> when it loads. In specs that swap <Image> for a test double, that method doesn't exist and the test crashes. I fixed it by pointing expo-asset to the version of the resolver that doesn't go through <Image>:

// jest.setup.ts
jest.mock("./node_modules/expo-asset/build/resolveAssetSource", () =>
  jest.requireActual("./node_modules/expo-asset/build/resolveAssetSource.js"),
);
The same test with the new resolver: 22 out of 22

What about iOS 27?#

Apps built with the iOS 27 SDK need to use the scene based lifecycle. In practice, that means a SceneDelegate.swift and a new entry in Info.plist.

If you use prebuild (the ios folder isn't in git and Expo generates it), npx expo prebuild already generates all of that. That's how it went with my app, and I didn't have to touch anything native.

If you keep the ios folder in the repository, that's on you: compare what prebuild generates in a fresh SDK 58 project with yours and bring the SceneDelegate and UIApplicationSceneManifest over.

Checklist for your upgrade#

  • Move one SDK version at a time, with one commit for each.
  • Run npx expo install --fix and npx expo-doctor until only what you chose to keep is left.
  • Switch refs to ViewInstance, ScrollViewInstance and TextInputInstance.
  • Look for styles built through mutation (style.something = ...) and rewrite them with spread.
  • Custom tab bar: swap navigation for emitter and navigateToTab(route.key).
  • Decide on R8 on purpose: either turn it off, or test a release build end to end.
  • Combine the Jest resolvers if you use reanimated.
  • Ship an iOS build with the new SDK before April 2027, not in April 2027.

expo-doctor doesn't need to hit zero#

I ran expo-doctor again two weeks after the migration, with the app already in production. Result: 17 out of 20.

Two weeks later: 17 out of 20, and every warning has a reason

The three warnings say very different things:

  • Two lock files. The project has package-lock.json and pnpm-lock.yaml. On a CI that guesses the package manager from the file, that's confusing. Here it's a deliberate choice, but if you don't have a reason, delete the one you don't use.
  • eas-cli inside the project. Expo prefers it to run with npx eas or installed globally. It's a hygiene warning, it doesn't break anything.
  • Patch versions. Expo ships SDK patches every week. This is the only one worth fixing right away: npx expo install --fix and a quick test.

The rule I follow: version warnings I fix; choice warnings I document. Getting the doctor to zero isn't the goal. Knowing why each warning is there is.

What I learned#

tsc is the best migration guide there is. Almost everything that broke in 58 showed up first as a type error. If your project still has a lot of any, every upgrade will hurt more.

What only breaks in release is what matters most. TypeScript and Jest yell right away. R8 stays quiet until the app is in someone's hands. That's why it earned its own decision, with a code comment explaining why.

An SDK upgrade is not a Friday afternoon task. One version at a time, one commit per version, and a release build before you ship to the store.

References#

  • Mobile
  • expo
  • react-native
  • ios
  • android
  • typescript
  • jest

Written by

Software engineer and designer. I write about what I run into while building apps, APIs and products.