fix(modal): card style modal no longer gets stuck when swiping quickly (#21224)

This commit is contained in:
Julian Baumann
2020-05-14 17:50:31 +02:00
committed by GitHub
parent 39bfaeaa79
commit 448dfa0a69

View File

@ -39,16 +39,15 @@ export const createSwipeToCloseGesture = (
}; };
const onMove = (detail: GestureDetail) => { const onMove = (detail: GestureDetail) => {
const step = detail.deltaY / height; const step = clamp(0.0001, detail.deltaY / height, 0.9999);
if (step < 0) { return; }
animation.progressStep(step); animation.progressStep(step);
}; };
const onEnd = (detail: GestureDetail) => { const onEnd = (detail: GestureDetail) => {
const velocity = detail.velocityY; 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; const threshold = (detail.deltaY + velocity * 1000) / height;