Skip to content

iOS Modal dismiss causes strange navigation stack pop #2668

@Jpoliachik

Description

@Jpoliachik

Description

Showing a Modal, then updating state to set visible: false at the same time as we use expo-router to navigate to a new screen, we see a slight pause and noticeable glitch, then the screen where the modal was shown gets popped off the navigation stack when it should not.

See app/child/index.tsx in the repro:

setModalVisible(false);
router.navigate("/child/secondchild");

Which causes this issue:

ios-modalbug.mov

This only happens on iOS, and it only happens when dismissing a Modal at the same time as navigating to a new route.

The only workaround I found for now is to use FullWindowOverlay on iOS instead of Modal.

Steps to reproduce

Minimal repro from a fresh create-expo-app can be found here, with a video showing the issue:

https://github.com/Jpoliachik/RNModalNavigateBug

Snack or a link to a repository

https://github.com/Jpoliachik/RNModalNavigateBug

Screens version

4.4.0

React Native version

0.76.6

Platforms

iOS

JavaScript runtime

None

Workflow

Expo managed workflow

Architecture

None

Build type

None

Device

iOS simulator

Device model

No response

Acknowledgements

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    Platform: iOSThis issue is specific to iOSRepro providedA reproduction with a snack or repo is provided

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions