Skip to content

Commit 312c954

Browse files
committed
Use 0 instead of current values
1 parent 16b1cc2 commit 312c954

File tree

4 files changed

+6
-12
lines changed

4 files changed

+6
-12
lines changed

packages/react-native-gesture-handler/src/v3/hooks/gestures/useHover.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ function diffCalculator(
4646
) {
4747
'worklet';
4848
return {
49-
changeX: previous ? current.x - previous.x : current.x,
50-
changeY: previous ? current.y - previous.y : current.y,
49+
changeX: previous ? current.x - previous.x : 0,
50+
changeY: previous ? current.y - previous.y : 0,
5151
};
5252
}
5353

packages/react-native-gesture-handler/src/v3/hooks/gestures/usePan.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -245,12 +245,8 @@ function diffCalculator(
245245
) {
246246
'worklet';
247247
return {
248-
changeX: previous
249-
? current.translationX - previous.translationX
250-
: current.translationX,
251-
changeY: previous
252-
? current.translationY - previous.translationY
253-
: current.translationY,
248+
changeX: previous ? current.translationX - previous.translationX : 0,
249+
changeY: previous ? current.translationY - previous.translationY : 0,
254250
};
255251
}
256252

packages/react-native-gesture-handler/src/v3/hooks/gestures/usePinch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function diffCalculator(
3131
) {
3232
'worklet';
3333
return {
34-
scaleChange: previous ? current.scale / previous.scale : current.scale,
34+
scaleChange: previous ? current.scale / previous.scale : 0,
3535
};
3636
}
3737

packages/react-native-gesture-handler/src/v3/hooks/gestures/useRotation.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ function diffCalculator(
3131
) {
3232
'worklet';
3333
return {
34-
rotationChange: previous
35-
? current.rotation - previous.rotation
36-
: current.rotation,
34+
rotationChange: previous ? current.rotation - previous.rotation : 0,
3735
};
3836
}
3937

0 commit comments

Comments
 (0)