react-spring-bottom-sheet icon indicating copy to clipboard operation
react-spring-bottom-sheet copied to clipboard

Sheet not resizing in certain cases

Open smontlouis opened this issue 4 years ago • 2 comments

When I'm using snapPoints={({ minHeight, maxHeight }) => [minHeight, maxHeight]}, everything works fine : the bottom sheet is resized.

But in my case, I want my BottomSheet to be always open, but very small (30px), and when it's sliding to minHeight, sometimes I need the BottomSheet to fit the content, but the BottomSheet is failing to resize. snapPoints={({ minHeight, maxHeight }) => [30, minHeight, maxHeight]}

I kind of understand why this is needed, but is there a solution ?

Demo code

smontlouis avatar Apr 09 '21 09:04 smontlouis

Ok this is a bug, it manages to correct the snap position if a drag interaction is done, but for some reason it's failing if the content changes when idle.

Here's a workaround until there's a fix: https://codesandbox.io/s/reproducing-issue-react-spring-bottom-sheet-33-forked-rudje?file=/src/App.js

In any case your use case should "just work" without any need to use the ref.snapTo API or other workarounds.

stipsan avatar Apr 14 '21 16:04 stipsan

Awesome thank you :)

smontlouis avatar Apr 14 '21 16:04 smontlouis