From 448dfa0a6955008ce4dc73354f5b8319ae1a1cc2 Mon Sep 17 00:00:00 2001 From: Julian Baumann <39265507+julian-baumann@users.noreply.github.com> Date: Thu, 14 May 2020 17:50:31 +0200 Subject: [PATCH] fix(modal): card style modal no longer gets stuck when swiping quickly (#21224) --- core/src/components/modal/gestures/swipe-to-close.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/core/src/components/modal/gestures/swipe-to-close.ts b/core/src/components/modal/gestures/swipe-to-close.ts index a0d95c3585..e39f05473c 100644 --- a/core/src/components/modal/gestures/swipe-to-close.ts +++ b/core/src/components/modal/gestures/swipe-to-close.ts @@ -39,16 +39,15 @@ export const createSwipeToCloseGesture = ( }; const onMove = (detail: GestureDetail) => { - const step = detail.deltaY / height; - if (step < 0) { return; } + const step = clamp(0.0001, detail.deltaY / height, 0.9999); animation.progressStep(step); }; const onEnd = (detail: GestureDetail) => { const velocity = detail.velocityY; - const step = detail.deltaY / height; - if (step < 0) { return; } + + const step = clamp(0.0001, detail.deltaY / height, 0.9999); const threshold = (detail.deltaY + velocity * 1000) / height;