Skip to content

Commit d99cb06

Browse files
committed
changed FlingGestureBasic to travel by a fixed distance in v2
1 parent 8916a0a commit d99cb06

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

packages/docs-gesture-handler/versioned_docs/version-2.x/examples/FlingGestureBasic.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,10 @@ export default function App() {
5252
startTranslateX.value = event.x;
5353
})
5454
.onStart((event) => {
55+
const directionMultiplier = event.x - startTranslateX.value > 0 ? 1 : -1;
5556
translateX.value = withTiming(
5657
clamp(
57-
translateX.value + event.x - startTranslateX.value,
58+
translateX.value + directionMultiplier * 100,
5859
containerWidth.value / -2 + 50,
5960
containerWidth.value / 2 - 50
6061
),

0 commit comments

Comments
 (0)