mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-01-12 22:51:18 +08:00
fix: use the correct velocity value in closing animation (#7836)
In this commit f24d3a3461 we modified the `velocity` in inverted gesture, but since we also use this value in the closing animation, the change in that commit also introduced a new bug:

This PR fixes the issue by keeping the original velocity value.
This commit is contained in:
@@ -271,16 +271,15 @@ export default class Card extends React.Component<Props> {
|
||||
velocity = nativeEvent.velocityX;
|
||||
}
|
||||
|
||||
if (
|
||||
gestureDirection === 'horizontal-inverted' ||
|
||||
gestureDirection === 'vertical-inverted'
|
||||
) {
|
||||
translation *= -1;
|
||||
velocity *= -1;
|
||||
}
|
||||
const gestureDirectionFactor =
|
||||
gestureDirection === 'horizontal' || gestureDirection === 'vertical'
|
||||
? 1
|
||||
: -1;
|
||||
|
||||
const closing =
|
||||
translation + velocity * gestureVelocityImpact > distance / 2
|
||||
gestureDirectionFactor *
|
||||
(translation + velocity * gestureVelocityImpact) >
|
||||
distance / 2
|
||||
? velocity !== 0 || translation !== 0
|
||||
: false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user