fix(sheet): native scroll container so vaul drag detection works
This commit is contained in:
@@ -9,7 +9,7 @@ import {
|
||||
import { useIsMobile } from "@/hooks/use-is-mobile";
|
||||
import Drawer from "./drawer";
|
||||
import Modal from "./modal";
|
||||
import { ScrollArea, Flex, Loader } from "@mantine/core";
|
||||
import { Box, Flex, Loader } from "@mantine/core";
|
||||
|
||||
interface SheetProps extends PropsWithChildren {
|
||||
title?: string;
|
||||
@@ -60,14 +60,19 @@ const Sheet: React.FC<SheetProps> = ({ title, children, opened, onChange }) => {
|
||||
<Loader size='lg' />
|
||||
</Flex>
|
||||
}>
|
||||
<ScrollArea.Autosize
|
||||
style={{ flex: 1, maxHeight: '75dvh' }}
|
||||
scrollbarSize={8}
|
||||
scrollbars="y"
|
||||
type="scroll"
|
||||
{/* Native overflow, not ScrollArea: vaul's drag-vs-scroll detection
|
||||
only recognizes natively scrollable elements. */}
|
||||
<Box
|
||||
style={{
|
||||
flex: 1,
|
||||
maxHeight: "75dvh",
|
||||
overflowY: "auto",
|
||||
overscrollBehavior: "contain",
|
||||
WebkitOverflowScrolling: "touch",
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</ScrollArea.Autosize>
|
||||
</Box>
|
||||
</Suspense>
|
||||
</SheetComponent>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user