[Bug]: Multiple BottomSheets conflict on iOS device (left reopens after right close)
Version
v5
Reanimated Version
v3
Gesture Handler Version
v2
Platforms
iOS
What happened?
When using two bottom sheets with refs, after opening & closing the left sheet and then opening & closing the right sheet, the left sheet automatically reopens without any button press.
Reproduction steps
- Tap the left button → left bottom sheet opens.
- Close the left bottom sheet.
- Tap the right button → right bottom sheet opens.
- Close the right bottom sheet.
- Unexpected behavior: the left bottom sheet reopens automatically.
- Note: This cannot be reproduced in Snack because it only occurs on a real iOS device, not on Simulator.
Reproduction sample
https://github.com/daeuk1011/gorhom-bottom-sheet-bug-repro
Relevant log output
https://github.com/user-attachments/assets/69f22f80-242a-46b5-9d3c-b446f6a68e9d
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
Had a similar issue to this, I resolved it with calling dissmiss on the ref to keep it closed.
In your BottomSheetBackdrop can you add an onPress where it calls ref.current.dismiss() or forceClose ? You'll have to figure out which one to close though.
Seems like this has something to do with stackBehavior='switch' which is the default` which restores the first sheet if you display the second one shortly after the dismiss.
I also assumed that forceClose would solve it but it didn't work with modal bottom sheet, imo the sheet shouldn't be restored if it was dismissed regradless if the animation finished or no.
As a temporary fix, you can try stackBehavior='push'.
I have also noticed that you can quickly interrupt the forceClose animation with your finger to open the sheet again even though forceClose was called, which seems to be related to this.
I have also noticed that closing the sheet quickly as it is still opening will cause the sheet to stay open instead of closing, feels like all those issues are related
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
I'm also seeing this issue.
I resolved this issue by adding stackBehavior="replace" to each Bottom Sheet Modal because, in my case, I use the modal a lot and use the useBottomSheetModal() hook to dismiss each modal with a unique name.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.