react-native-bottom-sheet
react-native-bottom-sheet copied to clipboard
[v4] Bottom sheet close method does nothing after sheet is interrupted while closing
Bug
Hi, I have a problem with bottom sheet's close method. When you try to close the bottom sheet with a button and then you interrupt it with your finger. It looks like it's stuck in some state and close method does absolutely nothing after that. However I can still close the bottom sheet by swiping it down. Or fix "the state" by resizing it manually a bit but that's not a solution for me as I want to close the bottom sheet with a button. Look at the provided video and snack example. I am using Expo SDK 42.
Environment info
| Library | Version |
|---|---|
| @gorhom/bottom-sheet | 4.1.1 |
| react-native | 0.63.53 |
| react-native-reanimated | 2.2.2 |
| react-native-gesture-handler | 1.10.3 |
Steps To Reproduce
- Open the bottom sheet using the expand() method or use animateOnMount={true}
- Press the close button which calls close()
- Bottom sheet starts it's closing animation
- While the bottom sheet closing animation is in progress, interrupt it with your finger and hold it in the position
- Lift your finger without swiping
- Press the close button again multiple times
- Nothing happens
Describe what you expected to happen:
- I expect the bottom sheet to close when the close button is pressed again after interrupting it.
Reproducible sample code
https://snack.expo.dev/fUYBOczk2
Video
https://user-images.githubusercontent.com/84575256/136959007-a4b794f0-7b64-4679-ae4b-1893dc5afa22.mp4
Logs
Maybe some logs will help you
[BottomSheet::handleClose]
[BottomSheet::animateToPosition] velocity:0 position:725 currentPosition:525
[BottomSheet::handleOnAnimate] toIndex:-1 fromIndex:0
[BottomSheet::handleClose]
[BottomSheet::handleClose]
[BottomSheet::handleClose]
[BottomSheet::handleClose]
this related #632 which i am working on a fix that hopefully will land this week 👍
@gorhom If it helps you I stared to face with interaction issue right after updating react native and reanimated to the latest versions( two days ago ). Before this everything worked perfectly

this related #632 which i am working on a fix that hopefully will land this week 👍
Hi Gorhom, is it fixed ?
+1
+1
+1
+1
+1
+1
It is closed you can use forceClose() instead of close()
sheetRef.current()?.forceClose()
It is closed you can use
forceClose()instead ofclose()sheetRef.current()?.forceClose()
Thanks bro it works with me.
It is closed you can use
forceClose()instead ofclose()sheetRef.current()?.forceClose()Thanks bro it works with me. It's not working