Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

fix(BottomSheet): a drag across the resting detent no longer flashes the sheet away from the finger (#9193)

Cindy Zhang10bdc28f6611
diff --git a/.changeset/bottom-sheet-drag-detent-flash.md b/.changeset/bottom-sheet-drag-detent-flash.md
new file mode 100644
index 0000000000..e3509361e3
--- /dev/null
+++ b/.changeset/bottom-sheet-drag-detent-flash.md
@@ -0,0 +1,7 @@
+---
+'@astryxdesign/core': patch
+---
+
+[fix] Dragging a `BottomSheet` with snap points up from a shorter detent, or back down past it, no longer flashes the sheet away from the finger. For one frame the sheet jumped by the height its scrolling area gives up at that detent (about half the screen at a half-height stop) and then snapped back. The height and position now change in the same frame.
+
+@cixzhang
diff --git a/packages/core/src/BottomSheet/BottomSheet.test.tsx b/packages/core/src/BottomSheet/BottomSheet.test.tsx
index d2a22412b1..1a6ec95d24 100644
--- a/packages/core/src/BottomSheet/BottomSheet.test.tsx
+++ b/packages/core/src/BottomSheet/BottomSheet.test.tsx
@@ -11,7 +11,7 @@
import {describe, it, expect, vi, beforeEach, afterEach} from 'vitest';
import {act, render, screen, fireEvent} from '@testing-library/react';
-import {createRef, useState} from 'react';
+import {Profiler, createRef, useState} from 'react';
import {BottomSheet} from './BottomSheet';
import {BottomSheetEscapeContext} from './bottomSheetEscape';
import {resetBottomSheetStackForTests} from './bottomSheetStack';
@@ -1270,6 +1270,286 @@ describe('BottomSheet', () => {
expect(sheet.style.transition).toBe('');
});
+ it('restores the layout height in the same task as the transform when a drag crosses its detent, without a synchronous render', async () => {
+ const observers = mockResizeObserverInstances();
+ mockVisualViewport(800);
+ mockWindowHeight(800);
+ let commits = 0;
+ render(
+ <Profiler
+ id="sheet"
+ onRender={() => {
+ commits += 1;
+ }}>
+ <BottomSheet
+ isOpen
+ onOpenChange={() => {}}
+ label="Release notes"
+ snapPoints={SNAP_POINTS}
+ height="tall">
+ Content
+ </BottomSheet>
+ </Profiler>,
+ );
+ const sheet = getSheet();
+ const sheetObserver = observers.find(instance =>
+ instance.observed.has(sheet),
+ );
+ act(() => {
+ sheetObserver?.callback(
+ [resizeEntry(784, 736)],
+ sheetObserver as unknown as ResizeObserver,
+ );
+ });
+
+ // Rest on p50 (offset 336): the scrolling area gives up 336px of
+ // layout height and the sheet carries no transform.
+ fireTimedPointer(getHandle(), 'pointerdown', {time: 0, y: 0});
+ fireTimedPointer(getHandle(), 'pointermove', {time: 1000, y: 336});
+ fireTimedPointer(getHandle(), 'pointerup', {time: 2000, y: 336});
+ expect(sheet.style.height).toBe('448px');
+ expect(sheet.style.transform).toBe('');
+
+ const replacedNodes: Node[] = [];
+ const mutations = new MutationObserver(records => {
+ for (const record of records) {
+ replacedNodes.push(...record.addedNodes, ...record.removedNodes);
+ }
+ });
+ mutations.observe(sheet, {childList: true, subtree: true});
+ fireTimedPointer(getHandle(), 'pointerdown', {time: 3000, y: 336});
+
+ // Each finger sample arrives outside act(), as a browser delivers it:
+ // a render React schedules for later is still pending when this task
+ // ends, and the browser paints whatever the element holds then.
+ const reactGlobals = globalThis as {IS_REACT_ACT_ENVIRONMENT?: boolean};
+ const wasActEnvironment = reactGlobals.IS_REACT_ACT_ENVIRONMENT;
+ reactGlobals.IS_REACT_ACT_ENVIRONMENT = false;
+ const sampleAt = (time: number, y: number) => {
+ const event = new Event('pointermove', {bubbles: true});
+ Object.defineProperties(event, {
+ clientY: {value: y},
+ isPrimary: {value: true},
+ pointerId: {value: 1},
+ timeStamp: {value: time},
+ });
+ getHandle().dispatchEvent(event);
+ return {
+ height: sheet.style.height,
+ transform: sheet.style.transform,
+ inset: getBody().style.paddingBlockEnd,
+ };
+ };
+ let above: {height: string; transform: string; inset: string};
+ let below: {height: string; transform: string; inset: string};
+ const commitsBeforeCrossing = commits;
+ let commitsInCrossingTasks: number;
+ try {
+ // Up past the detent: the transform is written for the full height
+ // (no layout split), so the full height has to be there too.
+ above = sampleAt(4000, 136);
+ // Back down past it: the split returns with the transform.
+ below = sampleAt(5000, 436);
+ // React committed nothing inside those input tasks: the elements were
+ // written directly, not through a forced synchronous render.
+ commitsInCrossingTasks = commits - commitsBeforeCrossing;
+ } finally {
+ reactGlobals.IS_REACT_ACT_ENVIRONMENT = wasActEnvironment;
+ }
+ await act(async () => {});
+
+ expect(above.transform).toMatch(/^translateY\(/);
+ expect(above.height).toBe('784px');
+ // The scrolling area keeps its scroll position across the taller
+ // height: its end inset lands with it.
+ expect(above.inset).toBe('336px');
+ expect(below.transform).toBe('translateY(100px)');
+ expect(below.height).toBe('448px');
+ expect(below.inset).toBe('');
+ expect(commitsInCrossingTasks).toBe(0);
+ // The scheduled render caught up to the values already on screen.
+ expect(sheet.style.height).toBe('448px');
+ expect(sheet.style.transform).toBe('translateY(100px)');
+ // Nothing in the sheet was replaced along the way.
+ mutations.disconnect();
+ expect(replacedNodes).toEqual([]);
+ });
+
+ it("rests at the detent's height when the finger lifts in the same task as the move that crossed it", async () => {
+ const observers = mockResizeObserverInstances();
+ mockVisualViewport(800);
+ mockWindowHeight(800);
+ render(
+ <BottomSheet
+ isOpen
+ onOpenChange={() => {}}
+ label="Release notes"
+ snapPoints={SNAP_POINTS}
+ height="tall">
+ Content
+ </BottomSheet>,
+ );
+ const sheet = getSheet();
+ const sheetObserver = observers.find(instance =>
+ instance.observed.has(sheet),
+ );
+ act(() => {
+ sheetObserver?.callback(
+ [resizeEntry(784, 736)],
+ sheetObserver as unknown as ResizeObserver,
+ );
+ });
+
+ // Rest on p50 (offset 336) with the 336px layout split.
+ fireTimedPointer(getHandle(), 'pointerdown', {time: 0, y: 0});
+ fireTimedPointer(getHandle(), 'pointermove', {time: 1000, y: 336});
+ fireTimedPointer(getHandle(), 'pointerup', {time: 2000, y: 336});
+ expect(sheet.style.height).toBe('448px');
+ fireTimedPointer(getHandle(), 'pointerdown', {time: 3000, y: 336});
+
+ // A 3px nudge up crosses the detent, and the finger lifts before the
+ // render that move scheduled has committed: both arrive in one task,
+ // outside act(), as a browser can deliver them.
+ const reactGlobals = globalThis as {IS_REACT_ACT_ENVIRONMENT?: boolean};
+ const wasActEnvironment = reactGlobals.IS_REACT_ACT_ENVIRONMENT;
+ reactGlobals.IS_REACT_ACT_ENVIRONMENT = false;
+ const dispatch = (
+ type: 'pointermove' | 'pointerup',
+ time: number,
+ y: number,
+ ) => {
+ const event = new Event(type, {bubbles: true, cancelable: true});
+ Object.defineProperties(event, {
+ button: {value: 0},
+ clientY: {value: y},
+ isPrimary: {value: true},
+ pointerId: {value: 1},
+ timeStamp: {value: time},
+ });
+ getHandle().dispatchEvent(event);
+ };
+ let heightAboveDetent: string;
+ try {
+ dispatch('pointermove', 4000, 333);
+ heightAboveDetent = sheet.style.height;
+ dispatch('pointerup', 4500, 333);
+ } finally {
+ reactGlobals.IS_REACT_ACT_ENVIRONMENT = wasActEnvironment;
+ }
+ await act(async () => {});
+
+ // The crossing move drew the sheet at its full height...
+ expect(heightAboveDetent).toBe('784px');
+ // ...and at rest it is drawn at p50 again: the split height, no
+ // offset, and no end inset left over from the drag.
+ expect(sheet.style.height).toBe('448px');
+ expect(sheet.style.transform).toBe('');
+ expect(getBody().style.paddingBlockEnd).toBe('');
+ });
+
+ describe('with a caller-set height', () => {
+ // Rests on p50 (offset 336), presses the handle again, and returns the
+ // sheet and a dispatcher that delivers pointer events outside act(), as
+ // a browser does, so a render React schedules is still pending when
+ // each event's task ends.
+ function restOnHalfWithCallerHeight() {
+ const observers = mockResizeObserverInstances();
+ mockVisualViewport(800);
+ mockWindowHeight(800);
+ render(
+ <BottomSheet
+ isOpen
+ onOpenChange={() => {}}
+ label="Release notes"
+ snapPoints={SNAP_POINTS}
+ height="tall"
+ style={{height: '500px'}}>
+ Content
+ </BottomSheet>,
+ );
+ const sheet = getSheet();
+ const sheetObserver = observers.find(instance =>
+ instance.observed.has(sheet),
+ );
+ act(() => {
+ sheetObserver?.callback(
+ [resizeEntry(784, 736)],
+ sheetObserver as unknown as ResizeObserver,
+ );
+ });
+ fireTimedPointer(getHandle(), 'pointerdown', {time: 0, y: 0});
+ fireTimedPointer(getHandle(), 'pointermove', {time: 1000, y: 336});
+ fireTimedPointer(getHandle(), 'pointerup', {time: 2000, y: 336});
+ fireTimedPointer(getHandle(), 'pointerdown', {time: 3000, y: 336});
+ const outsideAct = (run: (dispatch: typeof dispatchRaw) => void) => {
+ const reactGlobals = globalThis as {
+ IS_REACT_ACT_ENVIRONMENT?: boolean;
+ };
+ const wasActEnvironment = reactGlobals.IS_REACT_ACT_ENVIRONMENT;
+ reactGlobals.IS_REACT_ACT_ENVIRONMENT = false;
+ try {
+ run(dispatchRaw);
+ } finally {
+ reactGlobals.IS_REACT_ACT_ENVIRONMENT = wasActEnvironment;
+ }
+ };
+ function dispatchRaw(
+ type: 'pointermove' | 'pointerup',
+ time: number,
+ y: number,
+ ) {
+ const event = new Event(type, {bubbles: true, cancelable: true});
+ Object.defineProperties(event, {
+ button: {value: 0},
+ clientY: {value: y},
+ isPrimary: {value: true},
+ pointerId: {value: 1},
+ timeStamp: {value: time},
+ });
+ getHandle().dispatchEvent(event);
+ }
+ return {sheet, outsideAct};
+ }
+
+ it('keeps the caller height through a drag across the detent and back', async () => {
+ const {sheet, outsideAct} = restOnHalfWithCallerHeight();
+ expect(sheet.style.height).toBe('500px');
+
+ const heights: string[] = [];
+ outsideAct(dispatch => {
+ dispatch('pointermove', 4000, 136);
+ heights.push(sheet.style.height);
+ dispatch('pointermove', 5000, 436);
+ heights.push(sheet.style.height);
+ });
+ await act(async () => {});
+ outsideAct(dispatch => {
+ dispatch('pointerup', 6000, 336);
+ });
+ await act(async () => {});
+
+ // The caller's height owns the element: the crossing writes only the
+ // transform and the end inset, and nothing replaces the height after.
+ expect(heights).toEqual(['500px', '500px']);
+ expect(sheet.style.height).toBe('500px');
+ });
+
+ it('keeps the caller height when the finger lifts in the same task as the crossing move', async () => {
+ const {sheet, outsideAct} = restOnHalfWithCallerHeight();
+
+ let heightAboveDetent = '';
+ outsideAct(dispatch => {
+ dispatch('pointermove', 4000, 333);
+ heightAboveDetent = sheet.style.height;
+ dispatch('pointerup', 4500, 333);
+ });
+ await act(async () => {});
+
+ expect(heightAboveDetent).toBe('500px');
+ expect(sheet.style.height).toBe('500px');
+ });
+ });
+
it('uses transforms while dragging and resizes to the visible snapped height', () => {
const observers = mockResizeObserverInstances();
mockVisualViewport(800);
diff --git a/packages/core/src/BottomSheet/BottomSheetPanel.tsx b/packages/core/src/BottomSheet/BottomSheetPanel.tsx
index 1b7258f178..b5fe330d10 100644
--- a/packages/core/src/BottomSheet/BottomSheetPanel.tsx
+++ b/packages/core/src/BottomSheet/BottomSheetPanel.tsx
@@ -71,7 +71,11 @@ import {
type BottomSheetSnapPoint,
} from './snapOffsets';
import {useMobileKeyboard} from './useMobileKeyboard';
-import {useSheetGestures} from './useSheetGestures';
+import {
+ scrollPreservationPadding,
+ sheetLayoutHeight,
+ useSheetGestures,
+} from './useSheetGestures';
const HEIGHT_BUDGETS = {
hug: '92dvh',
@@ -592,6 +596,8 @@ export function BottomSheetPanel({
ignoredSnapPointsMessage !== '',
);
+ // A caller's height owns the element's height: the drag never writes it.
+ const consumerHeight = style?.height;
const {
contentProps,
handleProps,
@@ -616,6 +622,7 @@ export function BottomSheetPanel({
onDismiss,
snapHeights,
onScrimOpacity,
+ hasFixedHeight: consumerHeight != null,
});
const {getViewportProps, getContentProps} = useScrollableArea({
@@ -758,6 +765,8 @@ export function BottomSheetPanel({
// transform — the layout height changes at rest, in one reconciling render
// whose visible geometry is identical (see useSheetGestures).
// - dragging above the base restores the full height below the viewport
+ // (the move that crosses writes that height to the element itself,
+ // so this render only catches up to it)
// - a peek settles with layout 0, so it slides rather than reflowing
const layoutOffset = isDragging
? dragOffset < settledOffset
@@ -774,7 +783,7 @@ export function BottomSheetPanel({
const isTraveling = isDragging || settlingLayoutOffset != null;
resizedHeight =
layoutOffset > 0 || isTraveling
- ? `${Math.max(0, sheetHeight - Math.max(0, layoutOffset))}px`
+ ? sheetLayoutHeight(sheetHeight, layoutOffset)
: undefined;
gestureTransform =
translation !== 0 ? `translateY(${translation}px)` : undefined;
@@ -791,6 +800,9 @@ export function BottomSheetPanel({
? retainedTransform
: undefined;
const consumerTransform = style?.transform;
+ const hostHeight =
+ isInteractive || isRetained || isClosing ? resizedHeight : undefined;
+ const bodyEndPadding = scrollPreservationPadding(scrollPreservationInset);
// The transform is written to the element here, not rendered through the
// style prop. A drag writes it straight to the element once per input
// sample (useSheetGestures) and renders nothing in between, so React never
@@ -799,20 +811,39 @@ export function BottomSheetPanel({
// the finger left it. Written after every commit instead, outside a drag,
// the resting value lands in the same style update as the restored
// transition, so a settle or a dismissal animates from the live position.
+ //
+ // The height and the scrolling area's end inset are rendered through props,
+ // but a drag that crosses its base detent writes them to the elements too.
+ // When the release is processed before that move's render commits, React
+ // compares the resting values with the ones it committed before the drag,
+ // finds them unchanged and writes nothing, so the sheet would stay drawn at
+ // the drag's height. They are written here after every commit, outside a
+ // drag, for the same reason as the transform. A caller's height is left to
+ // the style prop: the drag does not write over it, so there is nothing to
+ // restore.
useLayoutEffect(() => {
- if (isDragging || consumerTransform != null) {
+ if (isDragging) {
return;
}
const element = elementRef.current;
if (element != null) {
- element.style.transform = sheetTransform ?? '';
+ if (consumerTransform == null) {
+ element.style.transform = sheetTransform ?? '';
+ }
+ if (consumerHeight == null) {
+ element.style.height = hostHeight ?? '';
+ }
+ }
+ const body = bodyElementRef.current;
+ if (body != null) {
+ body.style.paddingBlockEnd = bodyEndPadding ?? '';
}
});
const gestureStyle = {
transition: contentProps.style.transition,
touchAction: contentProps.style.touchAction,
overscrollBehavior: contentProps.style.overscrollBehavior,
- height: resizedHeight,
+ height: hostHeight,
};
return (
<div
@@ -839,7 +870,7 @@ export function BottomSheetPanel({
...(isInteractive
? gestureStyle
: isRetained || isClosing
- ? {height: resizedHeight}
+ ? {height: hostHeight}
: {}),
...style,
},
@@ -860,8 +891,8 @@ export function BottomSheetPanel({
styles.body,
height === 'tall' && styles.tallKeyboardBody,
),
- scrollPreservationInset > 0
- ? {style: {paddingBlockEnd: `${scrollPreservationInset}px`}}
+ bodyEndPadding != null
+ ? {style: {paddingBlockEnd: bodyEndPadding}}
: {},
),
}),
diff --git a/packages/core/src/BottomSheet/useSheetGestures.ts b/packages/core/src/BottomSheet/useSheetGestures.ts
index e4b0a72bd8..0edb608071 100644
--- a/packages/core/src/BottomSheet/useSheetGestures.ts
+++ b/packages/core/src/BottomSheet/useSheetGestures.ts
@@ -5,7 +5,8 @@
/**
* @file useSheetGestures.ts
* @input Uses React (useCallback, useEffect, useMemo, useRef, useState)
- * @output Exports useSheetGestures hook and its option/result types
+ * @output Exports useSheetGestures hook, its option/result types, and the
+ * height and end-inset formats a host renders for the layout split
* @position Internal to BottomSheet; not exported from the core entry point
*
* Drag + snap machinery for the bottom sheet. Tracks a pointer drag down the
@@ -26,10 +27,18 @@
* A live drag writes that transform straight to the sheet element, once per
* input sample, and renders nothing: React state changes when the drag begins
* and ends, and in between only when the layout split changes (a drag that
- * crosses above its base detent restores the full height). The live offset
- * is readable through `activeOffsetRef`. The host owns the element's
- * transform outside a drag and writes the resting value after each commit,
- * so a settle animates from wherever the finger left the sheet.
+ * crosses above its base detent restores the full height). That crossing
+ * changes three things that only look right together: the transform, the
+ * sheet's height and the scrolling area's end inset. The move writes all
+ * three to the elements in the same task, so the browser paints them in one
+ * frame, and the render it schedules catches the host up to the same values
+ * whenever it commits; it never decides what the next frame shows. The live
+ * offset is readable through `activeOffsetRef`. The host owns the element's
+ * transform, height and end inset outside a drag and writes their resting
+ * values after each commit (a host with a fixed height of its own keeps that
+ * height, and the drag never writes it), so a settle animates from wherever the finger
+ * left the sheet, and a release processed before the crossing move's render
+ * commits still leaves the sheet drawn at its resting detent.
*
* Those are pixels, and the stops behind them are relative to the viewport, so
* a sheet at rest re-resolves its detent on `resize` / `orientationchange`,
@@ -206,6 +215,28 @@ function preservationInsetForOffset(
return Math.max(0, baseOffset - targetOffset - naturalEndGap);
}
+/**
+ * The sheet's height, in px, while it is in motion or rests with a layout
+ * split: the fully open height less the part the scrolling area gives up.
+ * The host renders it and a live drag writes it; one format keeps the two
+ * identical, so the render that follows a written value changes nothing.
+ */
+export function sheetLayoutHeight(
+ sheetHeight: number,
+ layoutOffset: number,
+): string {
+ return `${Math.max(0, sheetHeight - Math.max(0, layoutOffset))}px`;
+}
+
+/**
+ * The scrolling area's end padding that preserves its scroll position across
+ * a height change, or nothing when there is none to add. Shared by the host's
+ * render and a live drag's write for the same reason as sheetLayoutHeight.
+ */
+export function scrollPreservationPadding(inset: number): string | undefined {
+ return inset > 0 ? `${inset}px` : undefined;
+}
+
function renderedBlockEndPadding(element: HTMLElement): number {
const value = Number.parseFloat(getComputedStyle(element).paddingBlockEnd);
return Number.isFinite(value) ? value : 0;
@@ -368,6 +399,14 @@ export interface UseSheetGesturesOptions {
* on the dismiss overshoot. Lets the owner mirror it onto the scrim.
*/
onScrimOpacity?: (opacity: number) => void;
+ /**
+ * Whether the host draws the sheet at a fixed height of its own (a caller's
+ * height) rather than the layout-split height. A drag across the base
+ * detent then writes only the transform and the end inset, and leaves the
+ * element's height to the host.
+ * @default false
+ */
+ hasFixedHeight?: boolean;
}
export interface SheetContentProps {
@@ -508,6 +547,7 @@ export function useSheetGestures({
snapHeights,
onSnap,
onScrimOpacity,
+ hasFixedHeight = false,
}: UseSheetGesturesOptions): UseSheetGesturesResult {
const [dragOffset, setDragOffset] = useState(0);
const [settledOffset, setSettledOffset] = useState(0);
@@ -657,11 +697,13 @@ export function useSheetGestures({
const canDismissRef = useRef(canDismiss);
const onSnapRef = useRef(onSnap);
const onScrimOpacityRef = useRef(onScrimOpacity);
+ const hasFixedHeightRef = useRef(hasFixedHeight);
useEffect(() => {
onDismissRef.current = onDismiss;
canDismissRef.current = canDismiss;
onSnapRef.current = onSnap;
onScrimOpacityRef.current = onScrimOpacity;
+ hasFixedHeightRef.current = hasFixedHeight;
});
// Live drag bookkeeping (refs so pointermove doesn't churn renders).
@@ -954,6 +996,31 @@ export function useSheetGestures({
[],
);
+ // A live drag's layout split moved. The transform written beside this call
+ // is only correct on the new split, so the height and end inset that pair
+ // with it go to the elements in the same task. They are the values the host
+ // renders from the state this move also sets, in the same format, so its
+ // commit, whenever it lands, leaves them as they are. If the drag ends
+ // before that commit, the host's post-commit write puts the resting values
+ // back, since React sees no change from what it committed before the drag.
+ // A host with a fixed height of its own renders that height throughout and
+ // never restores a written one, so its height is not written.
+ const writeLiveLayout = useCallback(
+ (sheetHeight: number, layoutOffset: number) => {
+ const element = sheetElRef.current;
+ // Unmeasured, the host renders no height to pair with.
+ if (element != null && sheetHeight > 0 && !hasFixedHeightRef.current) {
+ element.style.height = sheetLayoutHeight(sheetHeight, layoutOffset);
+ }
+ const body = bodyNodeRef.current;
+ if (body != null) {
+ body.style.paddingBlockEnd =
+ scrollPreservationPadding(scrollPreservationInsetRef.current) ?? '';
+ }
+ },
+ [],
+ );
+
const cancelDrag = useCallback(
(target?: HTMLElement) => {
const state = dragStateRef.current;
@@ -1262,23 +1329,28 @@ export function useSheetGestures({
state.renderedOffset = next;
state.layoutOffset = layoutOffset;
activeOffsetRef.current = next;
+ updateScrollPreservationInset(
+ preservationInsetForOffset(
+ state.baseLayoutOffset,
+ layoutOffset,
+ state.naturalEndGap,
+ ),
+ );
writeLiveTransform(next, layoutOffset);
if (hasLayoutChanged) {
- // The layout split moved: the host renders the new height, reading
- // the offset it has to pair with it from state.
+ // The layout split moved. The new height and end inset are written
+ // with the transform, in this task: a render scheduled normally can
+ // commit after the next paint, and the transform alone on the old
+ // height would put the sheet the whole split away from the finger
+ // for that frame. The host still renders them from state, reading
+ // the offset it has to pair with the height from here.
+ writeLiveLayout(state.height, layoutOffset);
setDragOffset(next);
}
if (!state.hasTraveled && next !== state.baseOffset) {
state.hasTraveled = true;
setIsTraveling(true);
}
- updateScrollPreservationInset(
- preservationInsetForOffset(
- state.baseLayoutOffset,
- layoutOffset,
- state.naturalEndGap,
- ),
- );
// Mirror the scrim to the live drag: full at/above the mid detent,
// fading to hidden as it collapses onto the peek detent and through the
@@ -1295,7 +1367,12 @@ export function useSheetGestures({
scrimOpacityForOffset(next, offsets, dismissOffset, peekOffset),
);
},
- [resolveDetents, updateScrollPreservationInset, writeLiveTransform],
+ [
+ resolveDetents,
+ updateScrollPreservationInset,
+ writeLiveLayout,
+ writeLiveTransform,
+ ],
);
const endDrag = useCallback(