stipsan / react-spring-bottom-sheet

Accessible ♿️, Delightful ✨, & Fast 🚀
https://react-spring.bottom-sheet.dev/
MIT License
967 stars 133 forks source link

How to prevent close? #278

Closed ChanghyeonYoon closed 1 year ago

ChanghyeonYoon commented 1 year ago

I want to disable close. I set open value is always true. But when i swipe down, bottom sheet will close. How can i prevent close?

ChanghyeonYoon commented 1 year ago

I solved by onDismiss.

const onDismiss = React.useCallback(() => {
    if (!bottomSheetRef.current) return;
    bottomSheetRef.current.snapTo(0);
  }, [bottomSheetRef]);

<BottomSheet isOpen onDismiss={onDismiss}  />