Skip to content

SDK 52 - Expo Router not navigating correctly to Stacks when using navigate/push #32927

Closed
@gusthavosouza

Description

@gusthavosouza

Minimal reproducible example

https://github.com/gusthavosouza/SRTParser

Which package manager are you using? (Yarn is recommended)

npm

If the issue is web-related, please select the bundler (web.bundler in the app.json)

metro

Summary

Hi team,

After upgrading our App to expo SDK 52, the router has been acting strange.

E.g when navigating from Screen A to B and B to A a new Stack is created instead of navigating back to the previous one as mentioned on the docs from React navigation on: https://reactnavigation.org/docs/upgrading-from-6.x#the-navigate-method-no-longer-goes-back-use-popto-instead

The behaviour is completely different from the SDK 51, where when going from A to B and B to A it would just go back to previous screen.

"To avoid this confusion, we have removed the going back behavior from navigate and added a new method popTo to explicitly go back to a specific screen in the stack"

Is there a way to avoid this using expo router? is there any new method that supports the pop with Params?

I am not sharing any reproducible repo as this started happening after the upgrade.

Thanks

Environment

expo-env-info 1.2.1 environment info:
    System:
      OS: macOS 14.7.1
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 21.6.2 - /usr/local/bin/node
      Yarn: 1.22.22 - ~/Library/pnpm/yarn
      npm: 6.14.17 - ~/.local/state/fnm_multishells/79590_1731621644470/bin/npm
      Watchman: 2024.10.07.00 - /opt/homebrew/bin/watchman
    Managers:
      CocoaPods: 1.15.2 - /opt/homebrew/bin/pod
    SDKs:
      iOS SDK:
        Platforms: DriverKit 24.0, iOS 18.0, macOS 15.0, tvOS 18.0, visionOS 2.0, watchOS 11.0
    IDEs:
      Android Studio: 2024.2 AI-242.23339.11.2421.12483815
      Xcode: 16.0/16A242d - /usr/bin/xcodebuild
    npmPackages:
      expo: ^52.0.6 => 52.0.6 
      expo-router: ~4.0.5 => 4.0.5 
      react: 18.3.1 => 18.3.1 
      react-dom: 18.3.1 => 18.3.1 
      react-native: 0.76.1 => 0.76.1 
      react-native-web: ^0.19.13 => 0.19.13 
    npmGlobalPackages:
      eas-cli: 12.5.1
    Expo Workflow: bare

Metadata

Metadata

Assignees

Labels

Routerexpo-routerneeds reviewIssue is ready to be reviewed by a maintainer

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions