Skip to content

Commit 742a2f0

Browse files
committed
Merge branch 'main' into @mbert/dont-duplicate-events-ios
2 parents 545a393 + 67cdbb0 commit 742a2f0

14 files changed

Lines changed: 50 additions & 13 deletions

File tree

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,9 @@ class RNGestureHandlerButtonViewManager :
493493
if (inside != isPointerInsideBounds) {
494494
isPointerInsideBounds = inside
495495
if (inside) {
496-
animatePressIn()
496+
// Re-establish View's pressed flag to restore ripple and the
497+
// UP handler runs its normal release cleanup.
498+
setPressed(true)
497499
} else {
498500
animatePressOut()
499501
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class RNGestureHandlerRootView(context: Context?) : ReactViewGroup(context) {
4949
// When starting a new event stream, dispatch CANCEL event so the subtree
5050
// can clean up its internal state that may be stale due to Gesture Handler
5151
// starting to intercept events mid-stream.
52-
if (event.actionMasked == MotionEvent.ACTION_DOWN) {
52+
if (rootViewEnabled && event.actionMasked == MotionEvent.ACTION_DOWN) {
5353
val cancelEvent = MotionEvent.obtain(event).apply { action = MotionEvent.ACTION_CANCEL }
5454
super.dispatchTouchEvent(cancelEvent)
5555
cancelEvent.recycle()

packages/react-native-gesture-handler/src/components/Pressable/stateDefinitions.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ function getIosStatesConfig(
6161
eventName: StateMachineEvent.NATIVE_BEGIN,
6262
callback: handlePressIn,
6363
},
64+
{
65+
eventName: StateMachineEvent.NATIVE_START,
66+
},
6467
{
6568
eventName: StateMachineEvent.FINALIZE,
6669
callback: handlePressOut,

packages/react-native-gesture-handler/src/v3/components/GestureButtons.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const RawButton = createNativeWrapper<
2323
RawButtonProps
2424
>(GestureHandlerButton, {
2525
shouldCancelWhenOutside: false,
26-
shouldActivateOnStart: true,
26+
shouldActivateOnStart: false,
2727
});
2828

2929
/**

packages/react-native-gesture-handler/src/v3/components/Pressable.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ const Pressable = (props: PressableProps) => {
308308
stateMachine.handleEvent(StateMachineEvent.NATIVE_BEGIN);
309309
},
310310
onActivate: () => {
311-
if (Platform.OS !== 'android' && Platform.OS !== 'ios') {
311+
if (Platform.OS !== 'android') {
312312
// Native.onActivate is broken with Android + hitSlop
313313
stateMachine.handleEvent(StateMachineEvent.NATIVE_START);
314314
}

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ import type {
88
FlingHandlerData,
99
} from './FlingTypes';
1010

11-
export function useFlingGesture(config: FlingGestureConfig): FlingGesture {
11+
const EMPTY_FLING_CONFIG: FlingGestureConfig = {};
12+
13+
export function useFlingGesture(
14+
config: FlingGestureConfig = EMPTY_FLING_CONFIG
15+
): FlingGesture {
1216
const flingConfig = useClonedAndRemappedConfig<
1317
FlingGestureProperties,
1418
FlingHandlerData

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,11 @@ function transformHoverProps(
4444

4545
const HoverPropsMapping = new Map<string, string>([['effect', 'hoverEffect']]);
4646

47-
export function useHoverGesture(config: HoverGestureConfig): HoverGesture {
47+
const EMPTY_HOVER_CONFIG: HoverGestureConfig = {};
48+
49+
export function useHoverGesture(
50+
config: HoverGestureConfig = EMPTY_HOVER_CONFIG
51+
): HoverGesture {
4852
const hoverConfig = useClonedAndRemappedConfig<
4953
HoverGestureProperties,
5054
HoverHandlerData,

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@ function transformLongPressProps(
2828
return config;
2929
}
3030

31+
const EMPTY_LONG_PRESS_CONFIG: LongPressGestureConfig = {};
32+
3133
export function useLongPressGesture(
32-
config: LongPressGestureConfig
34+
config: LongPressGestureConfig = EMPTY_LONG_PRESS_CONFIG
3335
): LongPressGesture {
3436
const longPressConfig = useClonedAndRemappedConfig<
3537
LongPressGestureProperties,

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ import type {
88
ManualHandlerData,
99
} from './ManualTypes';
1010

11-
export function useManualGesture(config: ManualGestureConfig): ManualGesture {
11+
const EMPTY_MANUAL_CONFIG: ManualGestureConfig = {};
12+
13+
export function useManualGesture(
14+
config: ManualGestureConfig = EMPTY_MANUAL_CONFIG
15+
): ManualGesture {
1216
const manualConfig = useClonedAndRemappedConfig<
1317
ManualGestureProperties,
1418
ManualHandlerData

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ import type {
88
NativeHandlerData,
99
} from './NativeTypes';
1010

11-
export function useNativeGesture(config: NativeGestureConfig): NativeGesture {
11+
const EMPTY_NATIVE_CONFIG: NativeGestureConfig = {};
12+
13+
export function useNativeGesture(
14+
config: NativeGestureConfig = EMPTY_NATIVE_CONFIG
15+
): NativeGesture {
1216
const nativeConfig = useClonedAndRemappedConfig<
1317
NativeGestureProperties,
1418
NativeHandlerData

0 commit comments

Comments
 (0)