Skip to content

Incorrect Back Behaviour in grouped routes with layout #38236

@dheerajneelam-sigfyn

Description

@dheerajneelam-sigfyn

Minimal reproducible example

https://github.com/dheerajneelam-sigfyn/expo-router-test-issue

Steps to reproduce

Incorrect.back.behaviour.with.layouts.mov

I have file structure like the one shown in Github repo. When I navigate like this:
(app,admin)/index.tsx -> (app,admin)/onboarding/route1.tsx -> (app,admin)/onboarding/networth/route2.tsx -> (app,admin)/360/asset/route3.tsx

And then click on back, I expect to go to (app,admin)/onboarding/networth/route2.tsx, but instead I go to (app,admin)/onboarding.

I used Slot component all around. I did not explicitly do any Stack or Tabs or Drawer. I expect the back button to work and the route history/state to be maintained.

Environment

expo-env-info 1.3.4 environment info:
    System:
      OS: macOS 15.5
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 22.2.0 - /usr/local/bin/node
      Yarn: 1.22.22 - /usr/local/bin/yarn
      npm: 10.7.0 - /usr/local/bin/npm
      Watchman: 2025.03.10.00 - /opt/homebrew/bin/watchman
    Managers:
      CocoaPods: 1.15.2 - /usr/local/bin/pod
    SDKs:
      iOS SDK:
        Platforms: DriverKit 24.5, iOS 18.5, macOS 15.5, tvOS 18.5, visionOS 2.5, watchOS 11.5
    IDEs:
      Android Studio: 2021.2 AI-212.5712.43.2112.8609683
      Xcode: 16.4/16F6 - /usr/bin/xcodebuild
    npmPackages:
      expo: ~53.0.20 => 53.0.20 
      expo-router: ~5.1.4 => 5.1.4 
      react: 19.0.0 => 19.0.0 
      react-dom: 19.0.0 => 19.0.0 
      react-native: 0.79.5 => 0.79.5 
      react-native-web: ~0.20.0 => 0.20.0 
    npmGlobalPackages:
      eas-cli: 16.11.0
      expo-cli: 6.3.10
    Expo Workflow: managed

Expo Doctor Diagnostics

15/15 checks passed. No issues detected!

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