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
828 stars 78 forks source link

prevent Closing component #153

Closed danilesky closed 8 months ago

danilesky commented 9 months ago

Hello , i would like to ask if would be possible somehow disable closing , when i swipe out too much downside modal will dissapear and it sets z-index to -1 and visibility to hidden.

What i want to achieve : On swipe down too fast , i want my modal sheet to stay at the lowest snapPoint not to dissapear.

Thanks for answear :)

lucasdemoraesc commented 8 months ago

Hi @danilesky, I just had this same problem here. Looking around here in the repo I found this workaround https://github.com/Temzasse/react-modal-sheet/issues/6#issuecomment-967702561 .

This solved my problem, but I didn't want to use snapPoints, so the disableDrag property was a better fit:

<Sheet
    isOpen={props.isOpen}
    onClose={() => toast.warning("Por favor, selecione uma empresa para continuar.")}
    disableDrag
    detent="content-height"
    disableScrollLocking
>
    {...}
</Sheet>
danilesky commented 8 months ago

Hello @lucasdemoraesc , thanks for answear , i already solved it by myself with almost same solution . Anyways , thanks for your interest :)