Skip to content

Commit f898dd0

Browse files
authored
fix: make open transitions more interruptible on iOS (stipsan#23)
1 parent 8ef2206 commit f898dd0

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/BottomSheet.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -272,15 +272,14 @@ export const BottomSheet = React.forwardRef<
272272

273273
if (maybeCancel()) return
274274

275+
canDragRef.current = true
275276
await Promise.all([
276277
scrollLockRef.current.activate(),
277278
focusTrapRef.current.activate(),
278279
ariaHiderRef.current.activate(),
279280
])
280281

281282
if (maybeCancel()) return
282-
283-
canDragRef.current = true
284283
} else {
285284
console.log('animate open')
286285
await next({
@@ -296,6 +295,7 @@ export const BottomSheet = React.forwardRef<
296295

297296
if (maybeCancel()) return
298297

298+
canDragRef.current = true
299299
await Promise.all([
300300
scrollLockRef.current.activate(),
301301
focusTrapRef.current.activate(),
@@ -317,7 +317,6 @@ export const BottomSheet = React.forwardRef<
317317

318318
if (maybeCancel()) return
319319

320-
canDragRef.current = true
321320
heightRef.current = defaultSnapRef.current
322321
shouldInterpolateRefs.current = true
323322
await next({
@@ -544,19 +543,16 @@ export const BottomSheet = React.forwardRef<
544543
useDrag(handleDrag, {
545544
domTarget: backdropRef,
546545
eventOptions: { capture: true },
547-
enabled: ready && on,
548546
axis: 'y',
549547
})
550548
useDrag(handleDrag, {
551549
domTarget: headerRef,
552550
eventOptions: { capture: true },
553-
enabled: ready && on,
554551
axis: 'y',
555552
})
556553
useDrag(handleDrag, {
557554
domTarget: footerRef,
558555
eventOptions: { capture: true },
559-
enabled: ready && on,
560556
axis: 'y',
561557
})
562558

0 commit comments

Comments
 (0)