diff --git a/native/components/full-screen-view-modal.react.js b/native/components/full-screen-view-modal.react.js --- a/native/components/full-screen-view-modal.react.js +++ b/native/components/full-screen-view-modal.react.js @@ -349,20 +349,7 @@ dismissingFromPan, ); - const updates = [ - this.flingUpdate( - resetXClock, - resetYClock, - activeInteraction, - panJustEnded, - panVelocityX, - panVelocityY, - horizontalPanSpace, - verticalPanSpace, - curX, - curY, - ), - ]; + const updates = []; const updatedScale = [updates, curScale]; const updatedCurX = [updates, curX]; const updatedCurY = [updates, curY]; @@ -429,60 +416,6 @@ return max(vertPop, 0); } - flingUpdate( - // Inputs - resetXClock: Clock, - resetYClock: Clock, - activeInteraction: Node, - panJustEnded: Node, - panVelocityX: Node, - panVelocityY: Node, - horizontalPanSpace: Node, - verticalPanSpace: Node, - // Outputs - curX: Value, - curY: Value, - ): Node { - const flingXClock = new Clock(); - const flingYClock = new Clock(); - - const decayX = runDecay(flingXClock, panVelocityX, curX); - const recenteredX = clamp( - decayX, - multiply(-1, horizontalPanSpace), - horizontalPanSpace, - ); - const decayY = runDecay(flingYClock, panVelocityY, curY); - const recenteredY = clamp( - decayY, - multiply(-1, verticalPanSpace), - verticalPanSpace, - ); - - return cond( - activeInteraction, - [stopClock(flingXClock), stopClock(flingYClock)], - [ - cond( - clockRunning(resetXClock), - stopClock(flingXClock), - cond(or(panJustEnded, clockRunning(flingXClock)), [ - set(curX, recenteredX), - cond(neq(decayX, recenteredX), stopClock(flingXClock)), - ]), - ), - cond( - clockRunning(resetYClock), - stopClock(flingYClock), - cond(or(panJustEnded, clockRunning(flingYClock)), [ - set(curY, recenteredY), - cond(neq(decayY, recenteredY), stopClock(flingYClock)), - ]), - ), - ], - ); - } - updateDimensions() { const { width: frameWidth, height: frameHeight } = this.frame; const { topInset } = this.props.dimensions; @@ -992,18 +925,34 @@ curY.value = withDecay({ velocity: velocityY, ...decayConfig }); cancelAnimation(curScale); runOnJS(close)(); + } else { + const recenteredScale = Math.max(curScale.value, 1); + const horizontalPanSpace = getHorizontalPanSpace(recenteredScale); + const verticalPanSpace = getVerticalPanSpace(recenteredScale); + curX.value = withDecay({ + velocity: velocityX, + clamp: [-horizontalPanSpace, horizontalPanSpace], + ...decayConfig, + }); + curY.value = withDecay({ + velocity: velocityY, + clamp: [-verticalPanSpace, verticalPanSpace], + ...decayConfig, + }); } }, [ - close, - curX, - curY, panActive, progressiveOpacity, pinchActive, roundedCurScale, curScale, isRunningDismissAnimation, + curX, + curY, + close, + getHorizontalPanSpace, + getVerticalPanSpace, ], );