Skip to content

Commit 7abc041

Browse files
committed
only set velocity when gesture active, reset on complete
1 parent 1462fd0 commit 7abc041

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ class SwipeableItem<T> extends React.PureComponent<Props<T>> {
298298
onPanEvent = event([
299299
{
300300
nativeEvent: ({ translationX, velocityX }: PanGestureHandlerEventExtra) =>
301-
block([
301+
cond(eq(this.gestureState, GestureState.ACTIVE), [
302302
set(this.panX, translationX),
303303
set(this.velocity, velocityX),
304304
set(this.tempTranslate, add(translationX, this.prevTranslate)),
@@ -363,6 +363,7 @@ class SwipeableItem<T> extends React.PureComponent<Props<T>> {
363363
this.animConfig.toValue as Animated.Value<number>,
364364
this.currentSnapPoint
365365
),
366+
set(this.velocity, 0),
366367
startClock(this.clock)
367368
])
368369
]),

0 commit comments

Comments
 (0)