Closed fairhat closed 3 years ago
I'm solving it like this: const snapPoints = React.useCallback(isMobile? [500, 100] : [600, 100], [isMobile]);
Yep @10000multiplier solution looks good. I leave these kind of things for the user to handle since I don't want to make too many assumptions about the usage of this lib.
You could utilize react-use to detect the mobile breakpoint in JS with useMedia.
Or you can clamp the max snap point based on the height of the window like this:
const maxSnapPoint = Math.min(window.innerHeight, 600);
const snapPoints = [maxSnapPoint, 100, 0];
I hope this helps 🙂
Hey again,
noticed a bug: If i set the snappoint to e.g 600 (which is the height i want to have on desktop) causes the mobile ui to "oversnap" the sheet out of the viewport (because the phone im testing this with has actually <600 px viewport height)
any ideas how to prevent this from happening?