Skip to content

[Bug]: BottomSheetModal getting presented again on the next screen #2173

Open
@yolpsoftware

Description

@yolpsoftware

Version

v5

Reanimated Version

v3

Gesture Handler Version

v2

Platforms

iOS

What happened?

We have two screens, and a modal on screen 1 has a button that when pressed, dismisses the modal and navigates to screen 2.

However, the modal of screen 1 gets presented again on screen 2, without any ref.current?.present() being called:

Image

It has to do with a useState hook that gets called too in the modal, so it might be related to a re-render operation of screen 1.

Note: the provided Snack does not run for some reason that I don't understand but have already reported. Just paste the whole App.tsx into a local project and run it from there.

Note that the problem disappears if you enable the setTimeout on line 57.

Reproduction steps

Reproduction sample

https://snack.expo.dev/@yolpsoftware/bottomsheetmodal-getting-presented-again-on-the-next-screen

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions