Skip to content

[Bug]: stackBehavior="switch" unmounts the minimized modal and closes child modals immediately in v5.2.14 reanimated v4 #2685

Description

@mo-elnady

Version

v5

Reanimated Version

v4

Gesture Handler Version

v2

Platforms

Android

What happened?

When using stackBehavior="switch" (the default stack behavior) on stacked bottom sheets, presenting a nested child bottom sheet (rendered inside the React tree of the parent sheet) causes the parent sheet to completely unmount/dismiss instead of minimizing.

Because the parent sheet is unmounted, its React subtree is destroyed, causing the newly opened child sheet to unmount and close immediately.

Reproduction steps

  1. Render a parent BottomSheetModal (Modal A).
  2. Inside the children of Modal A, render a child BottomSheetModal (Modal B).
  3. Present Modal A.
  4. Trigger Modal B to present.
  5. Modal B will briefly mount/appear and then immediately disappear because Modal A gets unmounted/dismissed entirely.

Reproduction sample

https://snack.expo.dev/@gorhom/bottom-sheet---issue-reproduction-template

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