Skip to content
This repository was archived by the owner on Mar 17, 2025. It is now read-only.
This repository was archived by the owner on Mar 17, 2025. It is now read-only.

IOS Back gesture navigation - Stack #151

@Remeic

Description

@Remeic

Summary

Hello! First of all thank you for all the work you do, it's amazing!

I've never developed an app with Expo and React Navigation or Expo Router, I might have made some mistakes, sorry if that's the case.

I was trying to create a shared layout between subcategory pages.
The bug occurs when from the third and last page I try to swipe back, sometimes instead of taking me to the previous screen it takes me directly to the initial one.
I am attaching a demonstration video and a codesanbox, I haven't been able to replicate the problem on the web, but I hope it will still be useful.

I don't know if I'm doing things right, I would mainly like all the screens to have the Stack as a navigator, so that I can take advantage of the gestures and then the header.
Any advice is welcome, even on any errors that don't directly affect the bug

Project structure:
image

RPReplay_Final1670153687.MP4

I hope I have provided all the necessary information

Minimal reproducible example

https://codesandbox.io/s/issue-ios-back-gesture-skvp1y

// app/_layout.tsx

import { Stack, RootContainer } from 'expo-router'
import { DarkTheme } from '@react-navigation/native'
import { FC } from 'react'

export const Layout: FC = () => {
  return <>
      {/* These props will be applied to the parent NavigationContainer. */}
      <RootContainer theme={DarkTheme} />
      <Stack screenOptions={{ headerShown: false, contentStyle: { paddingTop: 24, paddingBottom: 24, paddingLeft: 8, paddingRight: 8 } }} />
  </>
}
export default Layout
// app/sub/_layout.tsx

import React, { FC } from 'react'
import { Stack } from 'expo-router'

export const CustomLayout: FC = () => {
  return (<>
      <Stack screenOptions={{
        headerShown: false,
        contentStyle:
        {
          paddingTop: 24,
          paddingBottom: 24,
          paddingLeft: 8,
          paddingRight: 8
        }
      }} />
  </>)
}

export default CustomLayout

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions