From a3baa099f9d93715df6b07e29d08fa2708ddabf2 Mon Sep 17 00:00:00 2001 From: Neo Date: Fri, 23 Jun 2017 11:26:54 +0800 Subject: [PATCH] Fix typo -- movedDistance moveX, moveY -> dy/dx (#1824) --- packages/react-navigation/src/views/CardStack.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/react-navigation/src/views/CardStack.js b/packages/react-navigation/src/views/CardStack.js index 9d589c1f..8f16ae1b 100644 --- a/packages/react-navigation/src/views/CardStack.js +++ b/packages/react-navigation/src/views/CardStack.js @@ -321,10 +321,10 @@ class CardStack extends Component { const axisDistance = isVertical ? layout.height.__getValue() : layout.width.__getValue(); - const movedDistance = gesture[isVertical ? 'moveY' : 'moveX']; - const defaultVelocity = axisDistance / ANIMATION_DURATION; + const movedDistance = gesture[isVertical ? 'dy' : 'dx']; const gestureVelocity = gesture[isVertical ? 'vy' : 'vx']; - const velocity = Math.max(gestureVelocity, defaultVelocity); + const defaultVelocity = axisDistance / ANIMATION_DURATION; + const velocity = Math.max(Math.abs(gestureVelocity), defaultVelocity); const resetDuration = movedDistance / velocity; const goBackDuration = (axisDistance - movedDistance) / velocity;