Skip to content

Commit d649fbc

Browse files
authored
fix: finish stack animation on CANCELLED event (react-navigation#7898)
fixes react-navigation#7897
1 parent 105da6a commit d649fbc

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

packages/stack/src/views/Stack/Card.tsx

+11-1
Original file line numberDiff line numberDiff line change
@@ -246,11 +246,21 @@ export default class Card extends React.Component<Props> {
246246
this.handleStartInteraction();
247247
onGestureBegin?.();
248248
break;
249-
case GestureState.CANCELLED:
249+
case GestureState.CANCELLED: {
250250
this.isSwiping.setValue(FALSE);
251251
this.handleEndInteraction();
252+
253+
const velocity =
254+
gestureDirection === 'vertical' ||
255+
gestureDirection === 'vertical-inverted'
256+
? nativeEvent.velocityY
257+
: nativeEvent.velocityX;
258+
259+
this.animate({ closing: this.props.closing, velocity });
260+
252261
onGestureCanceled?.();
253262
break;
263+
}
254264
case GestureState.END: {
255265
this.isSwiping.setValue(FALSE);
256266

0 commit comments

Comments
 (0)