@@ -153,7 +153,11 @@ const backdropClick = () => {
153153 if (props .canBackdropClose ) close ()
154154}
155155
156- // Scroll prevention handler
156+ function handleTouchMove(event : TouchEvent ) {
157+ preventScroll .value = true
158+ handleSheetScroll (event )
159+ }
160+
157161function handleSheetScroll(event : TouchEvent ) {
158162 if (preventScroll .value ) {
159163 event .preventDefault ()
@@ -235,13 +239,15 @@ const handleDragEnd: Handler<'drag', PointerEvent> | undefined = () => {
235239 })
236240}
237241
242+ const handleDragStart = () => {
243+ height .value = sheetHeight .value
244+ translateY .value = motionValues .value .y ! .get ()
245+ stopMotion ()
246+ }
247+
238248useGesture (
239249 {
240- onDragStart : () => {
241- height .value = sheetHeight .value
242- translateY .value = motionValues .value .y ! .get ()
243- stopMotion ()
244- },
250+ onDragStart: handleDragStart ,
245251 onDrag: handleDrag ,
246252 onDragEnd: handleDragEnd ,
247253 },
@@ -253,11 +259,7 @@ useGesture(
253259
254260useGesture (
255261 {
256- onDragStart : () => {
257- height .value = sheetHeight .value
258- translateY .value = motionValues .value .y ! .get ()
259- stopMotion ()
260- },
262+ onDragStart: handleDragStart ,
261263 onDrag: handleDrag ,
262264 onDragEnd: handleDragEnd ,
263265 },
@@ -424,7 +426,7 @@ defineExpose({ open, close, snapToPoint })
424426 data-vsbs-sheet
425427 tabindex =" -1"
426428 >
427- <div ref =" sheetHeader" data-vsbs-header >
429+ <div ref =" sheetHeader" data-vsbs-header @touchmove = " handleTouchMove " >
428430 <slot name =" header" />
429431 </div >
430432
@@ -436,7 +438,7 @@ defineExpose({ open, close, snapToPoint })
436438 </div >
437439 </div >
438440
439- <div ref =" sheetFooter" data-vsbs-footer >
441+ <div ref =" sheetFooter" data-vsbs-footer @touchmove = " handleTouchMove " >
440442 <slot name =" footer" />
441443 </div >
442444 </div >
0 commit comments