nx icon indicating copy to clipboard operation
nx copied to clipboard

feat(expo): upgrade Expo to v53 and React Native to 0.79

Open hassankhan opened this issue 5 months ago • 6 comments

Upgrades both @nx/expo and @nx/react-native to use the latest versions of Expo and React Native. Expo iOS and Android builds work perfectly.

[!WARNING] This PR explicitly does not modify @nx/detox; see comment here on a discussion about why Nx should consider using Maestro instead.

Tasks

  • [x] Fix @nx/expo E2E tests
  • [x] Verify Android and iOS builds
  • [x] Fix @nx/expo legacy tests (see comment here)
  • [x] Fix Android builds with @nx/expo
  • [x] Remove react-test-renderer from @nx/expo
  • [x] Add migration to remove dependencies from @nx/expo
    • [x] @testing-library/jest-native
    • [x] react-test-renderer
  • [ ] Fix @nx/react-native E2E tests (see comment here)
  • [x] Verify Android and iOS builds (see comment here)
  • [x] Add migrations to update deps for @nx/react-native
  • [x] Add migration to remove dependencies from @nx/react-native
    • [x] @testing-library/jest-native
    • [x] jest-react-native
    • [x] react-test-renderer
  • [x] Remove react-test-renderer from @nx/react-native

Changes

  • Upgrade Expo to v53 and update project templates
  • Upgrade React Native to v0.79 and update project templates
  • Upgrade React to v19.0
  • Upgrade metro-config and metro-resolver to v0.82.4 (fixes #30557)
  • Remove react-test-renderer
  • Remove jest-react-native
  • Remove @testing-library/jest-native
  • Fix bug in @nx/expo and @nx/react-native application generators where the generated package.json was being overwritten (fixes #31416)

Links

  • https://github.com/facebook/react/tree/main/packages/react-test-renderer#react-native-testing
  • https://callstack.github.io/react-native-testing-library/docs/migration/jest-matchers
  • https://react.dev/blog/2024/04/25/react-19-upgrade-guide#deprecated-react-test-renderer

Current Behavior

Nx generates an Expo project using SDK v52, and React Native projects using RN 0.76

Expected Behavior

Nx should generate an Expo project using SDK v53, and React Native projects using RN 0.79

Related Issue(s)

Fixes #31498, #30557, #31416

hassankhan avatar Jun 09 '25 00:06 hassankhan

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Project Deployment Preview Updated (UTC)
nx-dev Ready Preview Aug 12, 2025 11:08pm

vercel[bot] avatar Jun 09 '25 00:06 vercel[bot]

View your CI Pipeline Execution ↗ for commit 13b53c615873872558f99cb1bf2a1d5321d01a93

Command Status Duration Result
nx affected --targets=lint,test,build,e2e,e2e-c... ✅ Succeeded 5m 1s View ↗
nx run-many -t check-imports check-commit check... ✅ Succeeded 2m 9s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 2s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 8s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded 5s View ↗
nx documentation ✅ Succeeded 2m 47s View ↗
nx affected -t e2e-macos-local --parallel=1 --b... ✅ Succeeded 52s View ↗

☁️ Nx Cloud last updated this comment at 2025-08-13 10:30:59 UTC

nx-cloud[bot] avatar Jun 09 '25 00:06 nx-cloud[bot]

@xiongemi I've managed to get all but one legacy Expo E2E passing; I'm not sure why that test is failing but will look into it. Separately, React Native projects generated by Nx seem to have issues which have prevented me from testing it properly.

hassankhan avatar Jun 11 '25 01:06 hassankhan

@hassankhan You're probably already on top of these — but since I also ran into them — I thought I'd chime in, in case it's useful


● @nx/expo (legacy) › should export

We ran into this issue too — there's a new (somewhat frustrating) @expo/cli (aka expo-cli aka expo/cli) restriction on output-dir where it has to be within the project level — no more workspace level dist folder (except maybe as secondary mv step)

    CommandError: --output-dir must be a subdirectory of the project directory. Generating outside of the project directory is not supported.

EDIT: Related: PR + Issue EDIT2: Opened issue on expo repo

TypeError: expect(...).toHaveTextContent is not a function

This is related to the jest matcher changes


You rock — LMK if I can be of any assistance!

leggomuhgreggo avatar Jun 11 '25 02:06 leggomuhgreggo

@xiongemi @FrozenPandaz Could we set up npm publishing for this branch please? It would make testing the migrations a lot easier.

@leggomuhgreggo Thanks for the kind words, and the pointers in your last comment 😀 I'm hoping someone from the Nx team can publish this branch; then we can try upgrading + migrating our own repos to see if any further problems crop up.

hassankhan avatar Jun 11 '25 17:06 hassankhan

The React Native E2E tests fail because of a React dependency mismatch (@nx/remix still uses React 18, and when added to the E2E-generated Nx project causes dependency conflicts which prevent tests from passing)

hassankhan avatar Jun 12 '25 01:06 hassankhan

Was looking at the Remix repo, looks like they're still using React v18 as a dev/peer dep [code]. Also seeing a number of "React 19" Discussions threads on their repo — appears that there are some kinks, but also sounds like it should work with React v19.

Curious if there's a standard move for situations like this, where two Nx plugins have conflicting dependency version specifications?

leggomuhgreggo avatar Jun 17 '25 21:06 leggomuhgreggo

I am not sure why nx is using specific version of metro modules. Isn't it possible for nx to not rely on specific version of metro?

@leggomuhgreggo When do you think we can have this merged?

matinzd avatar Jun 25 '25 13:06 matinzd

Indeed, any reason to force metro's version? We need to update to Expo 53 to fix some bugs and take advantage of some new features from both Expo and RN. @FrozenPandaz Any idea when it will be merged? Just to organize ourselves here.

I'm not sure if the bug here is due to that (I think so), but after I've upgraded to Expo 53 + all libraries, it compiles without issue, but metro server is not able to find my app:

image

Thank you!

vendramini avatar Jun 27 '25 17:06 vendramini

I added the following overrides for Metro dependencies to my package.json after updating Expo to 53:

"overrides": {
    "metro": "^0.82.0",
    "metro-config": "^0.82.0",
    "metro-resolver": "^0.82.0",
}

KoenCa avatar Jul 01 '25 07:07 KoenCa

thanks for the pull request. I will try to make unit test and e2e test pass.

xiongemi avatar Jul 06 '25 03:07 xiongemi

i don't have permission to push to your repo. also, i could not create a pull request release from a forked repo. so i create a new pull request https://github.com/nrwl/nx/pull/31840/files and create a pull request release https://github.com/nrwl/nx/actions/runs/16094783018/job/45416342141. the version is 0.0.0-pr-31840-b906464.

for now, maybe you could use "@nx/react-native": "0.0.0-pr-31840-b906464" or "@nx/expo": "0.0.0-pr-31840-b906464"

xiongemi avatar Jul 06 '25 04:07 xiongemi

I am not sure why nx is using specific version of metro modules. Isn't it possible for nx to not rely on specific version of metro?

@leggomuhgreggo When do you think we can have this merged?

currently metro bundles are at dependencies because current we use some utils functions from metro. how about i move the metro packages to peer dependencies, so if the version conflicts in future, you can run something like npm install --legacy-peer-deps to ignore the conflicts

xiongemi avatar Jul 06 '25 04:07 xiongemi

@xiongemi @FrozenPandaz Could we set up npm publishing for this branch please? It would make testing the migrations a lot easier.

@leggomuhgreggo Thanks for the kind words, and the pointers in your last comment 😀 I'm hoping someone from the Nx team can publish this branch; then we can try upgrading + migrating our own repos to see if any further problems crop up.

I just published a pr release 0.0.0-pr-31840-b906464.

xiongemi avatar Jul 06 '25 04:07 xiongemi

@hassankhan Do you want to request a review again?

matinzd avatar Jul 24 '25 13:07 matinzd

Hello, any update on this PR? our teams are waiting for expo 53 in NX for our new projects 😅

dionrussell avatar Aug 11 '25 07:08 dionrussell

Same here, waiting for this to proceed with the upgrade

t0ma5h avatar Aug 11 '25 10:08 t0ma5h

@hassankhan can you please resolve the conflicts against the master branch?

meeroslav avatar Aug 11 '25 14:08 meeroslav

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

github-actions[bot] avatar Aug 20 '25 00:08 github-actions[bot]