From dd32a5e2788a11a5c2be0d1840f5775c7307c57f Mon Sep 17 00:00:00 2001 From: Liam DeBeasi Date: Tue, 18 Feb 2020 15:14:30 -0500 Subject: [PATCH] fix(ios): clamp out of bounds values for swipe to go back (#20540) fixes #20505 --- core/src/utils/gesture/swipe-back.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/core/src/utils/gesture/swipe-back.ts b/core/src/utils/gesture/swipe-back.ts index 3ac10df3a3..6345ff4002 100644 --- a/core/src/utils/gesture/swipe-back.ts +++ b/core/src/utils/gesture/swipe-back.ts @@ -1,3 +1,5 @@ +import { clamp } from '../helpers'; + import { Gesture, GestureDetail, createGesture } from './index'; export const createSwipeBackGesture = ( @@ -38,12 +40,11 @@ export const createSwipeBackGesture = ( } /** - * TODO: stepValue can sometimes return a negative - * value, but you can't have a negative time value - * for the cubic bezier curve (at least with web animations) - * Not sure if the negative step value is an error or not + * TODO: stepValue can sometimes return negative values + * or values greater than 1 which should not be possible. + * Need to investigate more to find where the issue is. */ - onEndHandler(shouldComplete, (stepValue <= 0) ? 0.01 : stepValue, realDur); + onEndHandler(shouldComplete, (stepValue <= 0) ? 0.01 : clamp(0, stepValue, 0.9999), realDur); }; return createGesture({