Temzasse / react-modal-sheet

Flexible bottom sheet component built with Framer Motion to provide buttery smooth UX while keeping accessibility in mind 🪐
https://temzasse.github.io/react-modal-sheet/
MIT License
783 stars 74 forks source link

initialSnap -34px bug #146

Open 0oooooooo0 opened 7 months ago

0oooooooo0 commented 7 months ago

<Sheet snapPoints={[1, 0.7, 0]} initialSnap={1}>

will not open by 0.7, but will open with a value of -34px.

laem commented 6 months ago

I'm having a similar problem : when the sheet is rendered with open=true, it starts from the top, then slides back to the initialSnap.

Looks like a bug to me : it should slide from the bottom.

Note that this works with a default open=false and then a dynamic setOpen(true).

Here is a sandbox to demonstrate this behaviour : https://codesandbox.io/p/devbox/test-react-modal-sheet-x56rff?file=%2Fapp%2FSnapPoints.tsx%3A15%2C48

Note that it is easily fixed with these three lines :

    useEffect(() => {
        setTimeout(() => setOpen(true), 1)
    }, [setOpen])

@0oooooooo0 Is it related to your bug ? If not, I'll raise a new issue :)

0oooooooo0 commented 6 months ago

This looks like the same issue. Check out my PR

https://github.com/Temzasse/react-modal-sheet/pull/148