Skip to content

Commit f5f39ba

Browse files
committed
Merge branch 'main' into @mbert/monorepo-80rc2
2 parents 4795fe6 + 1415d55 commit f5f39ba

3 files changed

Lines changed: 23 additions & 16 deletions

File tree

.lintstagedrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
"yarn format:android"
77
],
88
"packages/react-native-gesture-handler/apple/**/*.{h,m,mm,cpp}": "yarn format:apple",
9-
"packages/react-native-gesture-handler/src/specs/*.ts": "yarn sync-architectures"
9+
"packages/react-native-gesture-handler/src/specs/*.ts": "yarn workspace react-native-gesture-handler sync-architectures"
1010
}

packages/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -725,10 +725,11 @@ class GestureHandlerOrchestrator(
725725
x in 0f..child.width.toFloat() && y in 0f..child.height.toFloat()
726726

727727
private fun shouldHandlerWaitForOther(handler: GestureHandler, other: GestureHandler): Boolean =
728-
handler !== other && (
729-
handler.shouldWaitForHandlerFailure(other) ||
730-
other.shouldRequireToWaitForFailure(handler)
731-
)
728+
handler !== other &&
729+
(
730+
handler.shouldWaitForHandlerFailure(other) ||
731+
other.shouldRequireToWaitForFailure(handler)
732+
)
732733

733734
private fun canRunSimultaneously(a: GestureHandler, b: GestureHandler) =
734735
a === b || a.shouldRecognizeSimultaneously(b) || b.shouldRecognizeSimultaneously(a)

packages/react-native-gesture-handler/src/components/ReanimatedSwipeable.tsx

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -357,27 +357,33 @@ const Swipeable = forwardRef<SwipeableMethods, SwipeableProps>(
357357
const dispatchImmediateEvents = useCallback(
358358
(fromValue: number, toValue: number) => {
359359
'worklet';
360-
if (toValue > 0 && onSwipeableWillOpen) {
361-
runOnJS(onSwipeableWillOpen)(SwipeDirection.RIGHT);
362-
} else if (toValue < 0 && onSwipeableWillOpen) {
363-
runOnJS(onSwipeableWillOpen)(SwipeDirection.LEFT);
364-
} else if (onSwipeableWillClose) {
360+
361+
if (onSwipeableWillOpen && toValue !== 0) {
362+
runOnJS(onSwipeableWillOpen)(
363+
toValue > 0 ? SwipeDirection.RIGHT : SwipeDirection.LEFT
364+
);
365+
}
366+
367+
if (onSwipeableWillClose && toValue === 0) {
365368
runOnJS(onSwipeableWillClose)(
366369
fromValue > 0 ? SwipeDirection.LEFT : SwipeDirection.RIGHT
367370
);
368371
}
369372
},
370-
[onSwipeableWillClose, onSwipeableWillOpen]
373+
[onSwipeableWillClose, onSwipeableWillOpen, rowState]
371374
);
372375

373376
const dispatchEndEvents = useCallback(
374377
(fromValue: number, toValue: number) => {
375378
'worklet';
376-
if (toValue > 0 && onSwipeableOpen) {
377-
runOnJS(onSwipeableOpen)(SwipeDirection.RIGHT);
378-
} else if (toValue < 0 && onSwipeableOpen) {
379-
runOnJS(onSwipeableOpen)(SwipeDirection.LEFT);
380-
} else if (onSwipeableClose) {
379+
380+
if (onSwipeableOpen && toValue !== 0) {
381+
runOnJS(onSwipeableOpen)(
382+
toValue > 0 ? SwipeDirection.RIGHT : SwipeDirection.LEFT
383+
);
384+
}
385+
386+
if (onSwipeableClose && toValue === 0) {
381387
runOnJS(onSwipeableClose)(
382388
fromValue > 0 ? SwipeDirection.LEFT : SwipeDirection.RIGHT
383389
);

0 commit comments

Comments
 (0)