fix(ios): clamp out of bounds values for swipe to go back (#20540)

fixes #20505
This commit is contained in:
Liam DeBeasi
2020-02-18 15:14:30 -05:00
committed by GitHub
parent ce41d90715
commit dd32a5e278

View File

@ -1,3 +1,5 @@
import { clamp } from '../helpers';
import { Gesture, GestureDetail, createGesture } from './index'; import { Gesture, GestureDetail, createGesture } from './index';
export const createSwipeBackGesture = ( export const createSwipeBackGesture = (
@ -38,12 +40,11 @@ export const createSwipeBackGesture = (
} }
/** /**
* TODO: stepValue can sometimes return a negative * TODO: stepValue can sometimes return negative values
* value, but you can't have a negative time value * or values greater than 1 which should not be possible.
* for the cubic bezier curve (at least with web animations) * Need to investigate more to find where the issue is.
* Not sure if the negative step value is an error or not
*/ */
onEndHandler(shouldComplete, (stepValue <= 0) ? 0.01 : stepValue, realDur); onEndHandler(shouldComplete, (stepValue <= 0) ? 0.01 : clamp(0, stepValue, 0.9999), realDur);
}; };
return createGesture({ return createGesture({