-
-
Notifications
You must be signed in to change notification settings - Fork 908
Description
Bug
When a resize event occurs such as a screen rotation (in native) or a window resize (in web) the bottom sheet index can change suddenly. This seems to be due to animatedContainerHeight being used in the calculation of animatedIndex.
Environment info
| Library | Version |
|---|---|
| @gorhom/bottom-sheet | 4.4.7 |
| react-native | 0.71.6 |
| react-native-reanimated | ^2.6.0 |
| react-native-gesture-handler | ^2.4.2 |
Steps To Reproduce
Web
- Open the bottom sheet.
- Resize the window.
Mobile
I haven't tested this on mobile but theoretically it should happen there too.
- Open the bottom sheet.
- Rotate the device (triggering a change in the screen dimensions)
Describe what you expected to happen:
A window/screen resize should not result in a change in the animatedIndex
Reproducible sample code
N/A
Notes
I've done a little exploration on fixing this but I'm not super happy with any of my approaches or results. I've effectively tried to set a property in the component when a resize reaction takes place and then adding a conditional to check if a resize event is the responsible for triggering a recalc on the animatedIndex property.
If I could get some direction from someone who knows more about the library and the best path forward I'd happily do the implementation and submit a PR!