fix(ui): attach the bottom sheet's touch listeners when the sheet mounts

The non-passive touchmove listeners on the sheet and its backdrop were bound in an effect that ran while the portaled sheet was still unmounted, and never ran again, so they were never attached. The mounted element is now state, and the listeners follow it.
This commit is contained in:
Marc-André Bombeck committed 2026-10-22 15:35:41 +02:00
1 parent 996cc15b50
commit a0e97a4e54
2 files changed
+17 -5

No files matched your search

+3
View File
@@ -148,6 +148,7 @@ export function BottomSheetContent({
const openerRef = React.useRef<HTMLElement | null>(null);
const initial: SheetSnap = preview ? "preview" : "full";
const [snap, setSnap] = React.useState<SheetSnap>(initial);
const [node, setNode] = React.useState<HTMLDivElement | null>(null);
const drag = useSheetDrag({
enabled: draggable,
@@ -158,11 +159,13 @@ export function BottomSheetContent({
contentRef,
overlayRef,
probeRef,
node,
});
const setContent = React.useCallback(
(node: HTMLDivElement | null) => {
contentRef.current = node;
setNode(node);
if (typeof ref === "function") ref(node);
else if (ref) ref.current = node;
},