Skip to content

Commit

Permalink
fix: make open transitions more interruptible on iOS (stipsan#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
stipsan committed Dec 7, 2020
1 parent 8ef2206 commit f898dd0
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/BottomSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -272,15 +272,14 @@ export const BottomSheet = React.forwardRef<

if (maybeCancel()) return

canDragRef.current = true
await Promise.all([
scrollLockRef.current.activate(),
focusTrapRef.current.activate(),
ariaHiderRef.current.activate(),
])

if (maybeCancel()) return

canDragRef.current = true
} else {
console.log('animate open')
await next({
Expand All @@ -296,6 +295,7 @@ export const BottomSheet = React.forwardRef<

if (maybeCancel()) return

canDragRef.current = true
await Promise.all([
scrollLockRef.current.activate(),
focusTrapRef.current.activate(),
Expand All @@ -317,7 +317,6 @@ export const BottomSheet = React.forwardRef<

if (maybeCancel()) return

canDragRef.current = true
heightRef.current = defaultSnapRef.current
shouldInterpolateRefs.current = true
await next({
Expand Down Expand Up @@ -544,19 +543,16 @@ export const BottomSheet = React.forwardRef<
useDrag(handleDrag, {
domTarget: backdropRef,
eventOptions: { capture: true },
enabled: ready && on,
axis: 'y',
})
useDrag(handleDrag, {
domTarget: headerRef,
eventOptions: { capture: true },
enabled: ready && on,
axis: 'y',
})
useDrag(handleDrag, {
domTarget: footerRef,
eventOptions: { capture: true },
enabled: ready && on,
axis: 'y',
})

Expand Down

0 comments on commit f898dd0

Please sign in to comment.