From 3cb11648d879141b9e48e113696a3102fbf4c684 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20Antoni=20Kwa=C5=9Bniewski?= Date: Fri, 3 Oct 2025 12:47:26 +0200 Subject: [PATCH 01/15] add missing types --- .../src/v3/hooks/gestures/index.ts | 26 ++++++++++++------- .../src/v3/hooks/gestures/useFling.ts | 8 ++++++ .../src/v3/hooks/gestures/useHover.ts | 8 ++++++ .../src/v3/hooks/gestures/useLongPress.ts | 8 ++++++ .../src/v3/hooks/gestures/useManual.ts | 8 ++++++ .../src/v3/hooks/gestures/useNative.ts | 8 ++++++ .../src/v3/hooks/gestures/usePan.ts | 5 ++++ .../src/v3/hooks/gestures/usePinch.ts | 8 ++++++ .../src/v3/hooks/gestures/useRotation.ts | 8 ++++++ .../src/v3/hooks/gestures/useTap.ts | 5 ++++ 10 files changed, 83 insertions(+), 9 deletions(-) diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/index.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/index.ts index 64e175e259..af74f1d811 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/index.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/index.ts @@ -1,26 +1,34 @@ export type { TapGestureConfig } from './useTap'; -export { useTap } from './useTap'; +export { useTap, TapGesture, TapGestureEvent } from './useTap'; export type { FlingGestureConfig } from './useFling'; -export { useFling } from './useFling'; +export { useFling, FlingGesture, FlingGestureEvent } from './useFling'; export type { LongPressGestureConfig } from './useLongPress'; -export { useLongPress } from './useLongPress'; +export { + useLongPress, + LongPressGesture, + LongPressGestureEvent, +} from './useLongPress'; export type { PinchGestureConfig } from './usePinch'; -export { usePinch } from './usePinch'; +export { usePinch, PinchGesture, PinchGestureEvent } from './usePinch'; export type { RotationGestureConfig } from './useRotation'; -export { useRotation } from './useRotation'; +export { + useRotation, + RotationGesture, + RotationGestureEvent, +} from './useRotation'; export type { HoverGestureConfig } from './useHover'; -export { useHover } from './useHover'; +export { useHover, HoverGesture, HoverGestureEvent } from './useHover'; export type { ManualGestureConfig } from './useManual'; -export { useManual } from './useManual'; +export { useManual, ManualGesture, ManualGestureEvent } from './useManual'; export type { NativeViewGestureConfig } from './useNative'; -export { useNative } from './useNative'; +export { useNative, NativeGesture, NativeGestureEvent } from './useNative'; export type { PanGestureConfig } from './usePan'; -export { usePan } from './usePan'; +export { usePan, PanGesture, PanGestureEvent } from './usePan'; diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useFling.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useFling.ts index f1e6d2981b..4b931e1db2 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useFling.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useFling.ts @@ -1,6 +1,8 @@ import { BaseGestureConfig, ExcludeInternalConfigProps, + GestureEvents, + SingleGesture, SingleGestureName, } from '../../types'; import { useGesture } from '../useGesture'; @@ -51,3 +53,9 @@ export function useFling(config: FlingGestureConfig) { return useGesture(SingleGestureName.Fling, flingConfig); } + +export type FlingGestureEvent = GestureEvents; +export type FlingGesture = SingleGesture< + FlingHandlerData, + FlingGestureProperties +>; diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useHover.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useHover.ts index cbcf16d4b3..85ea3bde5c 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useHover.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useHover.ts @@ -3,6 +3,8 @@ import { HoverEffect } from '../../../handlers/gestures/hoverGesture'; import { BaseGestureConfig, ExcludeInternalConfigProps, + GestureEvents, + SingleGesture, SingleGestureName, } from '../../types'; import { useGesture } from '../useGesture'; @@ -44,3 +46,9 @@ export function useHover(config: HoverGestureConfig) { return useGesture(SingleGestureName.Hover, hoverConfig); } + +export type HoverGestureEvent = GestureEvents; +export type HoverGesture = SingleGesture< + HoverHandlerData, + HoverGestureProperties +>; diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useLongPress.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useLongPress.ts index 723c9a598c..1489deee00 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useLongPress.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useLongPress.ts @@ -1,6 +1,8 @@ import { BaseGestureConfig, ExcludeInternalConfigProps, + GestureEvents, + SingleGesture, SingleGestureName, } from '../../types'; import { useGesture } from '../useGesture'; @@ -78,3 +80,9 @@ export function useLongPress(config: LongPressGestureConfig) { longPressConfig ); } + +export type LongPressGestureEvent = GestureEvents; +export type LongPressGesture = SingleGesture< + LongPressHandlerData, + LongPressGestureProperties +>; diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useManual.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useManual.ts index 5d32f85e71..c1301af721 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useManual.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useManual.ts @@ -1,6 +1,8 @@ import { BaseGestureConfig, ExcludeInternalConfigProps, + GestureEvents, + SingleGesture, SingleGestureName, } from '../../types'; import { useGesture } from '../useGesture'; @@ -24,3 +26,9 @@ export function useManual(config: ManualGestureConfig) { return useGesture(SingleGestureName.Manual, manualConfig); } + +export type ManualGestureEvent = GestureEvents; +export type ManualGesture = SingleGesture< + ManualHandlerData, + ManualGestureProperties +>; diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useNative.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useNative.ts index 0ed71b4d83..f2ac939e40 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useNative.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useNative.ts @@ -1,6 +1,8 @@ import { BaseGestureConfig, ExcludeInternalConfigProps, + GestureEvents, + SingleGesture, SingleGestureName, } from '../../types'; import { useGesture } from '../useGesture'; @@ -42,3 +44,9 @@ export function useNative(config: NativeViewGestureConfig) { return useGesture(SingleGestureName.Native, nativeConfig); } + +export type NativeGestureEvent = GestureEvents; +export type NativeGesture = SingleGesture< + NativeViewHandlerData, + NativeViewGestureProperties +>; diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePan.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePan.ts index c79dc9cb12..2bcaf6766c 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePan.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePan.ts @@ -2,6 +2,8 @@ import { StylusData } from '../../../handlers/gestureHandlerCommon'; import { BaseGestureConfig, ExcludeInternalConfigProps, + GestureEvents, + SingleGesture, SingleGestureName, } from '../../types'; import { useGesture } from '../useGesture'; @@ -257,3 +259,6 @@ export function usePan(config: PanGestureConfig) { panConfig ); } + +export type PanGestureEvent = GestureEvents; +export type PanGesture = SingleGesture; diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePinch.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePinch.ts index ed61b0202c..4be2f1b785 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePinch.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePinch.ts @@ -1,6 +1,8 @@ import { BaseGestureConfig, ExcludeInternalConfigProps, + GestureEvents, + SingleGesture, SingleGestureName, } from '../../types'; import { useGesture } from '../useGesture'; @@ -30,3 +32,9 @@ export function usePinch(config: PinchGestureConfig) { return useGesture(SingleGestureName.Pinch, pinchConfig); } + +export type PinchGestureEvent = GestureEvents; +export type PinchGesture = SingleGesture< + PinchHandlerData, + PinchGestureProperties +>; diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useRotation.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useRotation.ts index 542def7146..b9eed71851 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useRotation.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useRotation.ts @@ -1,6 +1,8 @@ import { BaseGestureConfig, ExcludeInternalConfigProps, + GestureEvents, + SingleGesture, SingleGestureName, } from '../../types'; import { useGesture } from '../useGesture'; @@ -31,3 +33,9 @@ export function useRotation(config: RotationGestureConfig) { return useGesture(SingleGestureName.Rotation, rotationConfig); } + +export type RotationGestureEvent = GestureEvents; +export type RotationGesture = SingleGesture< + RotationHandlerData, + RotationGestureProperties +>; diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useTap.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useTap.ts index d45f8ae99e..64a9c35b55 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useTap.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useTap.ts @@ -1,6 +1,8 @@ import { BaseGestureConfig, ExcludeInternalConfigProps, + GestureEvents, + SingleGesture, SingleGestureName, } from '../../types'; import { useGesture } from '../useGesture'; @@ -107,3 +109,6 @@ export function useTap(config: TapGestureConfig) { tapConfig ); } + +export type TapGestureEvent = GestureEvents; +export type TapGesture = SingleGesture; From 052bfb7202d4b06b95ebdf185f83a79bdcb4e915 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20Antoni=20Kwa=C5=9Bniewski?= Date: Fri, 3 Oct 2025 13:19:26 +0200 Subject: [PATCH 02/15] addded type suffix --- .../src/v3/hooks/gestures/index.ts | 18 +++++++++--------- .../src/v3/hooks/gestures/useFling.ts | 2 +- .../src/v3/hooks/gestures/useHover.ts | 2 +- .../src/v3/hooks/gestures/useLongPress.ts | 2 +- .../src/v3/hooks/gestures/useManual.ts | 2 +- .../src/v3/hooks/gestures/useNative.ts | 2 +- .../src/v3/hooks/gestures/usePan.ts | 5 ++++- .../src/v3/hooks/gestures/usePinch.ts | 2 +- .../src/v3/hooks/gestures/useRotation.ts | 2 +- .../src/v3/hooks/gestures/useTap.ts | 5 ++++- 10 files changed, 24 insertions(+), 18 deletions(-) diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/index.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/index.ts index af74f1d811..92ac9e90c5 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/index.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/index.ts @@ -1,34 +1,34 @@ export type { TapGestureConfig } from './useTap'; -export { useTap, TapGesture, TapGestureEvent } from './useTap'; +export { useTap, TapGestureType, TapGestureEvent } from './useTap'; export type { FlingGestureConfig } from './useFling'; -export { useFling, FlingGesture, FlingGestureEvent } from './useFling'; +export { useFling, FlingGestureType, FlingGestureEvent } from './useFling'; export type { LongPressGestureConfig } from './useLongPress'; export { useLongPress, - LongPressGesture, + LongPressGestureType, LongPressGestureEvent, } from './useLongPress'; export type { PinchGestureConfig } from './usePinch'; -export { usePinch, PinchGesture, PinchGestureEvent } from './usePinch'; +export { usePinch, PinchGestureType, PinchGestureEvent } from './usePinch'; export type { RotationGestureConfig } from './useRotation'; export { useRotation, - RotationGesture, + RotationGestureType, RotationGestureEvent, } from './useRotation'; export type { HoverGestureConfig } from './useHover'; -export { useHover, HoverGesture, HoverGestureEvent } from './useHover'; +export { useHover, HoverGestureType, HoverGestureEvent } from './useHover'; export type { ManualGestureConfig } from './useManual'; -export { useManual, ManualGesture, ManualGestureEvent } from './useManual'; +export { useManual, ManualGestureType, ManualGestureEvent } from './useManual'; export type { NativeViewGestureConfig } from './useNative'; -export { useNative, NativeGesture, NativeGestureEvent } from './useNative'; +export { useNative, NativeGestureType, NativeGestureEvent } from './useNative'; export type { PanGestureConfig } from './usePan'; -export { usePan, PanGesture, PanGestureEvent } from './usePan'; +export { usePan, PanGestureType, PanGestureEvent } from './usePan'; diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useFling.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useFling.ts index 4b931e1db2..2245dd2866 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useFling.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useFling.ts @@ -55,7 +55,7 @@ export function useFling(config: FlingGestureConfig) { } export type FlingGestureEvent = GestureEvents; -export type FlingGesture = SingleGesture< +export type FlingGestureType = SingleGesture< FlingHandlerData, FlingGestureProperties >; diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useHover.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useHover.ts index 85ea3bde5c..f25332ad60 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useHover.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useHover.ts @@ -48,7 +48,7 @@ export function useHover(config: HoverGestureConfig) { } export type HoverGestureEvent = GestureEvents; -export type HoverGesture = SingleGesture< +export type HoverGestureType = SingleGesture< HoverHandlerData, HoverGestureProperties >; diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useLongPress.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useLongPress.ts index 1489deee00..8688904208 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useLongPress.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useLongPress.ts @@ -82,7 +82,7 @@ export function useLongPress(config: LongPressGestureConfig) { } export type LongPressGestureEvent = GestureEvents; -export type LongPressGesture = SingleGesture< +export type LongPressGestureType = SingleGesture< LongPressHandlerData, LongPressGestureProperties >; diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useManual.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useManual.ts index c1301af721..c97a2c6eb6 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useManual.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useManual.ts @@ -28,7 +28,7 @@ export function useManual(config: ManualGestureConfig) { } export type ManualGestureEvent = GestureEvents; -export type ManualGesture = SingleGesture< +export type ManualGestureType = SingleGesture< ManualHandlerData, ManualGestureProperties >; diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useNative.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useNative.ts index f2ac939e40..d25bdc1ece 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useNative.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useNative.ts @@ -46,7 +46,7 @@ export function useNative(config: NativeViewGestureConfig) { } export type NativeGestureEvent = GestureEvents; -export type NativeGesture = SingleGesture< +export type NativeGestureType = SingleGesture< NativeViewHandlerData, NativeViewGestureProperties >; diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePan.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePan.ts index 2bcaf6766c..549b975029 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePan.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePan.ts @@ -261,4 +261,7 @@ export function usePan(config: PanGestureConfig) { } export type PanGestureEvent = GestureEvents; -export type PanGesture = SingleGesture; +export type PanGestureType = SingleGesture< + PanHandlerData, + PanGestureProperties +>; diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePinch.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePinch.ts index 4be2f1b785..655a109e63 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePinch.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePinch.ts @@ -34,7 +34,7 @@ export function usePinch(config: PinchGestureConfig) { } export type PinchGestureEvent = GestureEvents; -export type PinchGesture = SingleGesture< +export type PinchGestureType = SingleGesture< PinchHandlerData, PinchGestureProperties >; diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useRotation.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useRotation.ts index b9eed71851..5dcadb76d2 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useRotation.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useRotation.ts @@ -35,7 +35,7 @@ export function useRotation(config: RotationGestureConfig) { } export type RotationGestureEvent = GestureEvents; -export type RotationGesture = SingleGesture< +export type RotationGestureType = SingleGesture< RotationHandlerData, RotationGestureProperties >; diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useTap.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useTap.ts index 64a9c35b55..da28eae978 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useTap.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useTap.ts @@ -111,4 +111,7 @@ export function useTap(config: TapGestureConfig) { } export type TapGestureEvent = GestureEvents; -export type TapGesture = SingleGesture; +export type TapGestureType = SingleGesture< + TapHandlerData, + TapGestureProperties +>; From 652fe3fd98bb3dd6317dfe377b4f0bc9ce64fd52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20Antoni=20Kwa=C5=9Bniewski?= Date: Fri, 3 Oct 2025 13:46:37 +0200 Subject: [PATCH 03/15] exporting single and composed gesture types --- packages/react-native-gesture-handler/src/index.ts | 6 +++++- packages/react-native-gesture-handler/src/v3/types.ts | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/react-native-gesture-handler/src/index.ts b/packages/react-native-gesture-handler/src/index.ts index 82392a25a7..feea452884 100644 --- a/packages/react-native-gesture-handler/src/index.ts +++ b/packages/react-native-gesture-handler/src/index.ts @@ -168,7 +168,11 @@ export { NativeDetector } from './v3/NativeDetector/NativeDetector'; export * from './v3/hooks/useGesture'; export * from './v3/hooks/relations'; -export { SingleGestureName } from './v3/types'; +export { + SingleGestureName, + SingleGestureType, + ComposedGesture as ComposedGestureType, +} from './v3/types'; export * from './v3/hooks/gestures'; diff --git a/packages/react-native-gesture-handler/src/v3/types.ts b/packages/react-native-gesture-handler/src/v3/types.ts index 110edade40..4bae732231 100644 --- a/packages/react-native-gesture-handler/src/v3/types.ts +++ b/packages/react-native-gesture-handler/src/v3/types.ts @@ -106,6 +106,8 @@ export type SingleGesture = { gestureRelations: GestureRelations; }; +export type SingleGestureType = SingleGesture; + export type ComposedGesture = { tags: number[]; type: ComposedGestureName; From 43bd77d4d1c02683ee846a8b90f84dfff591a599 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20Antoni=20Kwa=C5=9Bniewski?= Date: Fri, 3 Oct 2025 17:09:51 +0200 Subject: [PATCH 04/15] SingleGestureType as a union --- .../react-native-gesture-handler/src/index.ts | 1 - .../src/v3/hooks/gestures/index.ts | 66 ++++++++++++++----- .../src/v3/types.ts | 2 - 3 files changed, 49 insertions(+), 20 deletions(-) diff --git a/packages/react-native-gesture-handler/src/index.ts b/packages/react-native-gesture-handler/src/index.ts index feea452884..b20eb1839a 100644 --- a/packages/react-native-gesture-handler/src/index.ts +++ b/packages/react-native-gesture-handler/src/index.ts @@ -170,7 +170,6 @@ export * from './v3/hooks/relations'; export { SingleGestureName, - SingleGestureType, ComposedGesture as ComposedGestureType, } from './v3/types'; diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/index.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/index.ts index 92ac9e90c5..7a9dcc7199 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/index.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/index.ts @@ -1,34 +1,66 @@ +import { FlingGestureEvent, FlingGestureType } from './useFling'; +import { HoverGestureEvent, HoverGestureType } from './useHover'; +import { LongPressGestureEvent, LongPressGestureType } from './useLongPress'; +import { ManualGestureEvent, ManualGestureType } from './useManual'; +import { NativeGestureEvent, NativeGestureType } from './useNative'; +import { PanGestureEvent, PanGestureType } from './usePan'; +import { PinchGestureEvent, PinchGestureType } from './usePinch'; +import { RotationGestureEvent, RotationGestureType } from './useRotation'; +import { TapGestureEvent, TapGestureType } from './useTap'; + export type { TapGestureConfig } from './useTap'; -export { useTap, TapGestureType, TapGestureEvent } from './useTap'; +export type { TapGestureType, TapGestureEvent }; +export { useTap } from './useTap'; export type { FlingGestureConfig } from './useFling'; -export { useFling, FlingGestureType, FlingGestureEvent } from './useFling'; +export type { FlingGestureType, FlingGestureEvent }; +export { useFling } from './useFling'; export type { LongPressGestureConfig } from './useLongPress'; -export { - useLongPress, - LongPressGestureType, - LongPressGestureEvent, -} from './useLongPress'; +export type { LongPressGestureType, LongPressGestureEvent }; +export { useLongPress } from './useLongPress'; export type { PinchGestureConfig } from './usePinch'; -export { usePinch, PinchGestureType, PinchGestureEvent } from './usePinch'; +export type { PinchGestureType, PinchGestureEvent }; +export { usePinch } from './usePinch'; export type { RotationGestureConfig } from './useRotation'; -export { - useRotation, - RotationGestureType, - RotationGestureEvent, -} from './useRotation'; +export type { RotationGestureType, RotationGestureEvent }; +export { useRotation } from './useRotation'; export type { HoverGestureConfig } from './useHover'; -export { useHover, HoverGestureType, HoverGestureEvent } from './useHover'; +export type { HoverGestureType, HoverGestureEvent }; +export { useHover } from './useHover'; export type { ManualGestureConfig } from './useManual'; -export { useManual, ManualGestureType, ManualGestureEvent } from './useManual'; +export type { ManualGestureType, ManualGestureEvent }; +export { useManual } from './useManual'; export type { NativeViewGestureConfig } from './useNative'; -export { useNative, NativeGestureType, NativeGestureEvent } from './useNative'; +export type { NativeGestureType, NativeGestureEvent }; +export { useNative } from './useNative'; export type { PanGestureConfig } from './usePan'; -export { usePan, PanGestureType, PanGestureEvent } from './usePan'; +export type { PanGestureType, PanGestureEvent }; +export { usePan } from './usePan'; + +export type SingleGestureType = + | TapGestureType + | FlingGestureType + | LongPressGestureType + | PinchGestureType + | RotationGestureType + | HoverGestureType + | ManualGestureType + | NativeGestureType + | PanGestureType; +export type SingleGestureEvent = + | TapGestureEvent + | FlingGestureEvent + | LongPressGestureEvent + | PinchGestureEvent + | RotationGestureEvent + | HoverGestureEvent + | ManualGestureEvent + | NativeGestureEvent + | PanGestureEvent; diff --git a/packages/react-native-gesture-handler/src/v3/types.ts b/packages/react-native-gesture-handler/src/v3/types.ts index 4bae732231..110edade40 100644 --- a/packages/react-native-gesture-handler/src/v3/types.ts +++ b/packages/react-native-gesture-handler/src/v3/types.ts @@ -106,8 +106,6 @@ export type SingleGesture = { gestureRelations: GestureRelations; }; -export type SingleGestureType = SingleGesture; - export type ComposedGesture = { tags: number[]; type: ComposedGestureName; From 2b291b6dee71fcec0aa05a9c5c01f89187b08df9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20Antoni=20Kwa=C5=9Bniewski?= Date: Fri, 3 Oct 2025 21:25:54 +0200 Subject: [PATCH 05/15] new api gets better names --- .../react-native-gesture-handler/src/index.ts | 31 +++++----- .../src/v3/hooks/gestures/index.ts | 57 ++++++++++--------- .../src/v3/hooks/gestures/useFling.ts | 2 +- .../src/v3/hooks/gestures/useHover.ts | 2 +- .../src/v3/hooks/gestures/useLongPress.ts | 2 +- .../src/v3/hooks/gestures/useManual.ts | 2 +- .../src/v3/hooks/gestures/useNative.ts | 2 +- .../src/v3/hooks/gestures/usePan.ts | 5 +- .../src/v3/hooks/gestures/usePinch.ts | 2 +- .../src/v3/hooks/gestures/useRotation.ts | 2 +- .../src/v3/hooks/gestures/useTap.ts | 5 +- 11 files changed, 52 insertions(+), 60 deletions(-) diff --git a/packages/react-native-gesture-handler/src/index.ts b/packages/react-native-gesture-handler/src/index.ts index b20eb1839a..ce93333e97 100644 --- a/packages/react-native-gesture-handler/src/index.ts +++ b/packages/react-native-gesture-handler/src/index.ts @@ -54,20 +54,20 @@ export { default as createNativeWrapper } from './handlers/createNativeWrapper'; export type { NativeViewGestureHandlerProps } from './handlers/NativeViewGestureHandler'; export { GestureDetector } from './handlers/gestures/GestureDetector'; export { GestureObjects as Gesture } from './handlers/gestures/gestureObjects'; -export type { TapGestureType as TapGesture } from './handlers/gestures/tapGesture'; -export type { PanGestureType as PanGesture } from './handlers/gestures/panGesture'; -export type { FlingGestureType as FlingGesture } from './handlers/gestures/flingGesture'; -export type { LongPressGestureType as LongPressGesture } from './handlers/gestures/longPressGesture'; -export type { PinchGestureType as PinchGesture } from './handlers/gestures/pinchGesture'; -export type { RotationGestureType as RotationGesture } from './handlers/gestures/rotationGesture'; -export type { ForceTouchGestureType as ForceTouchGesture } from './handlers/gestures/forceTouchGesture'; -export type { ManualGestureType as ManualGesture } from './handlers/gestures/manualGesture'; -export type { HoverGestureType as HoverGesture } from './handlers/gestures/hoverGesture'; +export type { TapGestureType } from './handlers/gestures/tapGesture'; +export type { PanGestureType } from './handlers/gestures/panGesture'; +export type { FlingGestureType } from './handlers/gestures/flingGesture'; +export type { LongPressGestureType } from './handlers/gestures/longPressGesture'; +export type { PinchGestureType } from './handlers/gestures/pinchGesture'; +export type { RotationGestureType } from './handlers/gestures/rotationGesture'; +export type { ForceTouchGestureType } from './handlers/gestures/forceTouchGesture'; +export type { ManualGestureType } from './handlers/gestures/manualGesture'; +export type { HoverGestureType } from './handlers/gestures/hoverGesture'; export type { - ComposedGestureType as ComposedGesture, - RaceGestureType as RaceGesture, - SimultaneousGestureType as SimultaneousGesture, - ExclusiveGestureType as ExclusiveGesture, + ComposedGestureType, + RaceGestureType, + SimultaneousGestureType, + ExclusiveGestureType, } from './handlers/gestures/gestureComposition'; export type { GestureStateManagerType as GestureStateManager } from './handlers/gestures/gestureStateManager'; export { NativeViewGestureHandler } from './handlers/NativeViewGestureHandler'; @@ -168,10 +168,7 @@ export { NativeDetector } from './v3/NativeDetector/NativeDetector'; export * from './v3/hooks/useGesture'; export * from './v3/hooks/relations'; -export { - SingleGestureName, - ComposedGesture as ComposedGestureType, -} from './v3/types'; +export { SingleGestureName, ComposedGesture } from './v3/types'; export * from './v3/hooks/gestures'; diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/index.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/index.ts index 7a9dcc7199..411eebccef 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/index.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/index.ts @@ -1,59 +1,60 @@ -import { FlingGestureEvent, FlingGestureType } from './useFling'; -import { HoverGestureEvent, HoverGestureType } from './useHover'; -import { LongPressGestureEvent, LongPressGestureType } from './useLongPress'; -import { ManualGestureEvent, ManualGestureType } from './useManual'; -import { NativeGestureEvent, NativeGestureType } from './useNative'; -import { PanGestureEvent, PanGestureType } from './usePan'; -import { PinchGestureEvent, PinchGestureType } from './usePinch'; -import { RotationGestureEvent, RotationGestureType } from './useRotation'; -import { TapGestureEvent, TapGestureType } from './useTap'; +import { FlingGestureEvent, FlingGesture } from './useFling'; +import { HoverGestureEvent, HoverGesture } from './useHover'; +import { LongPressGestureEvent, LongPressGesture } from './useLongPress'; +import { ManualGestureEvent, ManualGesture } from './useManual'; +import { NativeGestureEvent, NativeGesture } from './useNative'; +import { PanGestureEvent, PanGesture } from './usePan'; +import { PinchGestureEvent, PinchGesture } from './usePinch'; +import { RotationGestureEvent, RotationGesture } from './useRotation'; +import { TapGestureEvent, TapGesture } from './useTap'; export type { TapGestureConfig } from './useTap'; -export type { TapGestureType, TapGestureEvent }; +export type { TapGesture, TapGestureEvent }; export { useTap } from './useTap'; export type { FlingGestureConfig } from './useFling'; -export type { FlingGestureType, FlingGestureEvent }; +export type { FlingGesture, FlingGestureEvent }; export { useFling } from './useFling'; export type { LongPressGestureConfig } from './useLongPress'; -export type { LongPressGestureType, LongPressGestureEvent }; +export type { LongPressGesture, LongPressGestureEvent }; export { useLongPress } from './useLongPress'; export type { PinchGestureConfig } from './usePinch'; -export type { PinchGestureType, PinchGestureEvent }; +export type { PinchGesture, PinchGestureEvent }; export { usePinch } from './usePinch'; export type { RotationGestureConfig } from './useRotation'; -export type { RotationGestureType, RotationGestureEvent }; +export type { RotationGesture, RotationGestureEvent }; export { useRotation } from './useRotation'; export type { HoverGestureConfig } from './useHover'; -export type { HoverGestureType, HoverGestureEvent }; +export type { HoverGesture, HoverGestureEvent }; export { useHover } from './useHover'; export type { ManualGestureConfig } from './useManual'; -export type { ManualGestureType, ManualGestureEvent }; +export type { ManualGesture, ManualGestureEvent }; export { useManual } from './useManual'; export type { NativeViewGestureConfig } from './useNative'; -export type { NativeGestureType, NativeGestureEvent }; +export type { NativeGesture, NativeGestureEvent }; export { useNative } from './useNative'; export type { PanGestureConfig } from './usePan'; -export type { PanGestureType, PanGestureEvent }; +export type { PanGesture, PanGestureEvent }; export { usePan } from './usePan'; -export type SingleGestureType = - | TapGestureType - | FlingGestureType - | LongPressGestureType - | PinchGestureType - | RotationGestureType - | HoverGestureType - | ManualGestureType - | NativeGestureType - | PanGestureType; +export type SingleGesture = + | TapGesture + | FlingGesture + | LongPressGesture + | PinchGesture + | RotationGesture + | HoverGesture + | ManualGesture + | NativeGesture + | PanGesture; + export type SingleGestureEvent = | TapGestureEvent | FlingGestureEvent diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useFling.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useFling.ts index 2245dd2866..4b931e1db2 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useFling.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useFling.ts @@ -55,7 +55,7 @@ export function useFling(config: FlingGestureConfig) { } export type FlingGestureEvent = GestureEvents; -export type FlingGestureType = SingleGesture< +export type FlingGesture = SingleGesture< FlingHandlerData, FlingGestureProperties >; diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useHover.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useHover.ts index f25332ad60..85ea3bde5c 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useHover.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useHover.ts @@ -48,7 +48,7 @@ export function useHover(config: HoverGestureConfig) { } export type HoverGestureEvent = GestureEvents; -export type HoverGestureType = SingleGesture< +export type HoverGesture = SingleGesture< HoverHandlerData, HoverGestureProperties >; diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useLongPress.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useLongPress.ts index 8688904208..1489deee00 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useLongPress.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useLongPress.ts @@ -82,7 +82,7 @@ export function useLongPress(config: LongPressGestureConfig) { } export type LongPressGestureEvent = GestureEvents; -export type LongPressGestureType = SingleGesture< +export type LongPressGesture = SingleGesture< LongPressHandlerData, LongPressGestureProperties >; diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useManual.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useManual.ts index c97a2c6eb6..c1301af721 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useManual.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useManual.ts @@ -28,7 +28,7 @@ export function useManual(config: ManualGestureConfig) { } export type ManualGestureEvent = GestureEvents; -export type ManualGestureType = SingleGesture< +export type ManualGesture = SingleGesture< ManualHandlerData, ManualGestureProperties >; diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useNative.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useNative.ts index d25bdc1ece..f2ac939e40 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useNative.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useNative.ts @@ -46,7 +46,7 @@ export function useNative(config: NativeViewGestureConfig) { } export type NativeGestureEvent = GestureEvents; -export type NativeGestureType = SingleGesture< +export type NativeGesture = SingleGesture< NativeViewHandlerData, NativeViewGestureProperties >; diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePan.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePan.ts index 549b975029..2bcaf6766c 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePan.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePan.ts @@ -261,7 +261,4 @@ export function usePan(config: PanGestureConfig) { } export type PanGestureEvent = GestureEvents; -export type PanGestureType = SingleGesture< - PanHandlerData, - PanGestureProperties ->; +export type PanGesture = SingleGesture; diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePinch.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePinch.ts index 655a109e63..4be2f1b785 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePinch.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePinch.ts @@ -34,7 +34,7 @@ export function usePinch(config: PinchGestureConfig) { } export type PinchGestureEvent = GestureEvents; -export type PinchGestureType = SingleGesture< +export type PinchGesture = SingleGesture< PinchHandlerData, PinchGestureProperties >; diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useRotation.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useRotation.ts index 5dcadb76d2..b9eed71851 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useRotation.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useRotation.ts @@ -35,7 +35,7 @@ export function useRotation(config: RotationGestureConfig) { } export type RotationGestureEvent = GestureEvents; -export type RotationGestureType = SingleGesture< +export type RotationGesture = SingleGesture< RotationHandlerData, RotationGestureProperties >; diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useTap.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useTap.ts index da28eae978..64a9c35b55 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useTap.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useTap.ts @@ -111,7 +111,4 @@ export function useTap(config: TapGestureConfig) { } export type TapGestureEvent = GestureEvents; -export type TapGestureType = SingleGesture< - TapHandlerData, - TapGestureProperties ->; +export type TapGesture = SingleGesture; From 704d604722fe511cadf2d5d958629069600a2ae6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20Antoni=20Kwa=C5=9Bniewski?= Date: Mon, 6 Oct 2025 10:47:57 +0200 Subject: [PATCH 06/15] import, export type --- .../react-native-gesture-handler/src/index.ts | 3 ++- .../src/v3/hooks/gestures/index.ts | 18 +++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/packages/react-native-gesture-handler/src/index.ts b/packages/react-native-gesture-handler/src/index.ts index ce93333e97..10577397e3 100644 --- a/packages/react-native-gesture-handler/src/index.ts +++ b/packages/react-native-gesture-handler/src/index.ts @@ -168,7 +168,8 @@ export { NativeDetector } from './v3/NativeDetector/NativeDetector'; export * from './v3/hooks/useGesture'; export * from './v3/hooks/relations'; -export { SingleGestureName, ComposedGesture } from './v3/types'; +export { SingleGestureName } from './v3/types'; +export type { ComposedGesture } from './v3/types'; export * from './v3/hooks/gestures'; diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/index.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/index.ts index 411eebccef..c81eb55e7a 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/index.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/index.ts @@ -1,12 +1,12 @@ -import { FlingGestureEvent, FlingGesture } from './useFling'; -import { HoverGestureEvent, HoverGesture } from './useHover'; -import { LongPressGestureEvent, LongPressGesture } from './useLongPress'; -import { ManualGestureEvent, ManualGesture } from './useManual'; -import { NativeGestureEvent, NativeGesture } from './useNative'; -import { PanGestureEvent, PanGesture } from './usePan'; -import { PinchGestureEvent, PinchGesture } from './usePinch'; -import { RotationGestureEvent, RotationGesture } from './useRotation'; -import { TapGestureEvent, TapGesture } from './useTap'; +import type { FlingGestureEvent, FlingGesture } from './useFling'; +import type { HoverGestureEvent, HoverGesture } from './useHover'; +import type { LongPressGestureEvent, LongPressGesture } from './useLongPress'; +import type { ManualGestureEvent, ManualGesture } from './useManual'; +import type { NativeGestureEvent, NativeGesture } from './useNative'; +import type { PanGestureEvent, PanGesture } from './usePan'; +import type { PinchGestureEvent, PinchGesture } from './usePinch'; +import type { RotationGestureEvent, RotationGesture } from './useRotation'; +import type { TapGestureEvent, TapGesture } from './useTap'; export type { TapGestureConfig } from './useTap'; export type { TapGesture, TapGestureEvent }; From 4b3451d439d56140b3b3a4e0d497de4fe88a15c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20Antoni=20Kwa=C5=9Bniewski?= Date: Mon, 6 Oct 2025 10:50:26 +0200 Subject: [PATCH 07/15] update types in tests and examples --- .../src/new_api/drag_n_drop/Draggable.tsx | 8 +++--- .../src/__tests__/Events.test.tsx | 28 +++++++++---------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/apps/common-app/src/new_api/drag_n_drop/Draggable.tsx b/apps/common-app/src/new_api/drag_n_drop/Draggable.tsx index 81f92a4471..6159f143ad 100644 --- a/apps/common-app/src/new_api/drag_n_drop/Draggable.tsx +++ b/apps/common-app/src/new_api/drag_n_drop/Draggable.tsx @@ -4,8 +4,8 @@ import { PanGestureHandlerEventPayload, Gesture, GestureDetector, - PanGesture, - TapGesture, + PanGestureType, + TapGestureType, } from 'react-native-gesture-handler'; import Animated, { runOnJS, useAnimatedStyle } from 'react-native-reanimated'; @@ -22,8 +22,8 @@ interface DraggableProps { isActive: boolean; translation: AnimatedPostion; position: { x: number; y: number }; - dragGesture: PanGesture; - tapEndGesture: TapGesture; + dragGesture: PanGestureType; + tapEndGesture: TapGestureType; tileSize: number; rowGap: number; columnGap: number; diff --git a/packages/react-native-gesture-handler/src/__tests__/Events.test.tsx b/packages/react-native-gesture-handler/src/__tests__/Events.test.tsx index 89568044f8..043ef574c3 100644 --- a/packages/react-native-gesture-handler/src/__tests__/Events.test.tsx +++ b/packages/react-native-gesture-handler/src/__tests__/Events.test.tsx @@ -13,8 +13,8 @@ import { Gesture, GestureDetector, State, - PanGesture, - TapGesture, + PanGestureType, + TapGestureType, } from '../index'; import { useAnimatedGestureHandler } from 'react-native-reanimated'; import { fireGestureHandler, getByGestureTestId } from '../jestUtils'; @@ -300,7 +300,7 @@ describe('Using RNGH v2 gesture API', () => { ); - fireGestureHandler(getByGestureTestId('pan'), [ + fireGestureHandler(getByGestureTestId('pan'), [ { state: State.BEGAN }, { state: State.ACTIVE }, { state: State.END }, @@ -315,7 +315,7 @@ describe('Using RNGH v2 gesture API', () => { test('sends events with additional data to handlers', () => { const panHandlers = mockedEventHandlers(); render(); - fireGestureHandler(getByGestureTestId('pan'), [ + fireGestureHandler(getByGestureTestId('pan'), [ { state: State.BEGAN, translationX: 0 }, { state: State.ACTIVE, translationX: 10 }, { translationX: 20 }, @@ -358,7 +358,7 @@ describe('Event list validation', () => { const panHandlers = mockedEventHandlers(); render(); expect(() => { - fireGestureHandler(getByGestureTestId('pan'), [ + fireGestureHandler(getByGestureTestId('pan'), [ { oldState: State.UNDETERMINED, state: State.BEGAN, x: 0, y: 10 }, { oldState: State.UNDETERMINED, state: State.ACTIVE, x: 1, y: 11 }, ]); @@ -372,7 +372,7 @@ describe('Event list validation', () => { (lastState) => { const panHandlers = mockedEventHandlers(); render(); - fireGestureHandler(getByGestureTestId('pan'), [ + fireGestureHandler(getByGestureTestId('pan'), [ { state: State.BEGAN }, { state: State.ACTIVE }, { state: lastState }, @@ -452,7 +452,7 @@ describe('Filling event list with defaults', () => { test('fills missing ACTIVE states', () => { const panHandlers = mockedEventHandlers(); render(); - fireGestureHandler(getByGestureTestId('pan'), [ + fireGestureHandler(getByGestureTestId('pan'), [ { state: State.BEGAN, x: 0, y: 10 }, { state: State.ACTIVE, x: 1, y: 11 }, { x: 2, y: 12 }, @@ -469,7 +469,7 @@ describe('Filling event list with defaults', () => { test('fills BEGIN and END events for discrete handlers', () => { const handlers = mockedEventHandlers(); render(); - fireGestureHandler(getByGestureTestId('tap'), [{ x: 5 }]); + fireGestureHandler(getByGestureTestId('tap'), [{ x: 5 }]); expect(handlers.begin).toHaveBeenCalledTimes(1); expect(handlers.end).toHaveBeenCalledTimes(1); }); @@ -477,7 +477,7 @@ describe('Filling event list with defaults', () => { test('with FAILED event, fills BEGIN event for discrete handlers', () => { const handlers = mockedEventHandlers(); render(); - fireGestureHandler(getByGestureTestId('tap'), [ + fireGestureHandler(getByGestureTestId('tap'), [ { state: State.FAILED }, ]); expect(handlers.begin).toHaveBeenCalledTimes(1); @@ -488,7 +488,7 @@ describe('Filling event list with defaults', () => { test('uses event data from first event in filled BEGIN, ACTIVE events', () => { const handlers = mockedEventHandlers(); render(); - fireGestureHandler(getByGestureTestId('pan'), [{ x: 120 }]); + fireGestureHandler(getByGestureTestId('pan'), [{ x: 120 }]); expect(handlers.begin).toHaveBeenCalledWith( expect.objectContaining({ x: 120 }) ); @@ -501,7 +501,7 @@ describe('Filling event list with defaults', () => { test('uses event data from last event in filled END events', () => { const handlers = mockedEventHandlers(); render(); - fireGestureHandler(getByGestureTestId('pan'), [ + fireGestureHandler(getByGestureTestId('pan'), [ { x: 120, state: State.FAILED }, ]); expect(handlers.begin).toHaveBeenCalledTimes(1); @@ -515,7 +515,7 @@ describe('Filling event list with defaults', () => { test('uses event data filled events', () => { const handlers = mockedEventHandlers(); render(); - fireGestureHandler(getByGestureTestId('pan'), [ + fireGestureHandler(getByGestureTestId('pan'), [ { x: 5, y: 15 }, { x: 6, y: 16 }, { x: 7, y: 17 }, @@ -533,7 +533,7 @@ describe('Filling event list with defaults', () => { test("fills BEGIN and END events when they're not present, for discrete handlers", () => { const handlers = mockedEventHandlers(); render(); - fireGestureHandler(getByGestureTestId('tap')); + fireGestureHandler(getByGestureTestId('tap')); expect(handlers.begin).toHaveBeenCalledTimes(1); expect(handlers.end).toHaveBeenCalledTimes(1); }); @@ -541,7 +541,7 @@ describe('Filling event list with defaults', () => { test("fills BEGIN, ACTIVE and END events when they're not present, for continuous handlers", () => { const handlers = mockedEventHandlers(); render(); - fireGestureHandler(getByGestureTestId('pan')); + fireGestureHandler(getByGestureTestId('pan')); expect(handlers.begin).toHaveBeenCalledTimes(1); expect(handlers.active).toHaveBeenCalledTimes(1); expect(handlers.end).toHaveBeenCalledTimes(1); From 679ab462ad6c046748245dc6248866fde7b3787a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20Antoni=20Kwa=C5=9Bniewski?= Date: Mon, 6 Oct 2025 11:57:37 +0200 Subject: [PATCH 08/15] export correct types --- .../src/v3/hooks/gestures/useFling.ts | 4 ++-- .../src/v3/hooks/gestures/useHover.ts | 4 ++-- .../src/v3/hooks/gestures/useLongPress.ts | 4 ++-- .../src/v3/hooks/gestures/useManual.ts | 4 ++-- .../src/v3/hooks/gestures/useNative.ts | 4 ++-- .../src/v3/hooks/gestures/usePan.ts | 4 ++-- .../src/v3/hooks/gestures/usePinch.ts | 4 ++-- .../src/v3/hooks/gestures/useRotation.ts | 4 ++-- .../src/v3/hooks/gestures/useTap.ts | 4 ++-- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useFling.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useFling.ts index d2190a9c01..6f5fafc55b 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useFling.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useFling.ts @@ -1,10 +1,10 @@ import { BaseGestureConfig, ExcludeInternalConfigProps, - GestureEvents, SingleGesture, SingleGestureName, WithSharedValue, + GestureHandlerEvent, } from '../../types'; import { useGesture } from '../useGesture'; import { cloneConfig } from '../utils'; @@ -55,7 +55,7 @@ export function useFling(config: FlingGestureConfig) { return useGesture(SingleGestureName.Fling, flingConfig); } -export type FlingGestureEvent = GestureEvents; +export type FlingGestureEvent = GestureHandlerEvent; export type FlingGesture = SingleGesture< FlingHandlerData, FlingGestureProperties diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useHover.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useHover.ts index 56d9dc0a7f..64fa3d1f0b 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useHover.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useHover.ts @@ -1,9 +1,9 @@ +import { GestureHandlerEvent } from 'react-native-reanimated/lib/typescript/hook'; import { StylusData } from '../../../handlers/gestureHandlerCommon'; import { HoverEffect } from '../../../handlers/gestures/hoverGesture'; import { BaseGestureConfig, ExcludeInternalConfigProps, - GestureEvents, SingleGesture, HandlerData, SingleGestureName, @@ -67,7 +67,7 @@ export function useHover(config: HoverGestureConfig) { return useGesture(SingleGestureName.Hover, hoverConfig); } -export type HoverGestureEvent = GestureEvents; +export type HoverGestureEvent = GestureHandlerEvent; export type HoverGesture = SingleGesture< HoverHandlerData, HoverGestureProperties diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useLongPress.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useLongPress.ts index 7ad69698ff..f7a2851a8b 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useLongPress.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useLongPress.ts @@ -1,7 +1,7 @@ +import { GestureHandlerEvent } from 'react-native-reanimated/lib/typescript/hook'; import { BaseGestureConfig, ExcludeInternalConfigProps, - GestureEvents, SingleGesture, SingleGestureName, WithSharedValue, @@ -82,7 +82,7 @@ export function useLongPress(config: LongPressGestureConfig) { ); } -export type LongPressGestureEvent = GestureEvents; +export type LongPressGestureEvent = GestureHandlerEvent; export type LongPressGesture = SingleGesture< LongPressHandlerData, LongPressGestureProperties diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useManual.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useManual.ts index c1301af721..b4f18e2b46 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useManual.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useManual.ts @@ -1,7 +1,7 @@ +import { GestureHandlerEvent } from 'react-native-reanimated/lib/typescript/hook'; import { BaseGestureConfig, ExcludeInternalConfigProps, - GestureEvents, SingleGesture, SingleGestureName, } from '../../types'; @@ -27,7 +27,7 @@ export function useManual(config: ManualGestureConfig) { return useGesture(SingleGestureName.Manual, manualConfig); } -export type ManualGestureEvent = GestureEvents; +export type ManualGestureEvent = GestureHandlerEvent; export type ManualGesture = SingleGesture< ManualHandlerData, ManualGestureProperties diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useNative.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useNative.ts index 6588c6979c..dcec89e561 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useNative.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useNative.ts @@ -1,7 +1,7 @@ +import { GestureHandlerEvent } from 'react-native-reanimated/lib/typescript/hook'; import { BaseGestureConfig, ExcludeInternalConfigProps, - GestureEvents, SingleGesture, SingleGestureName, WithSharedValue, @@ -46,7 +46,7 @@ export function useNative(config: NativeViewGestureConfig) { return useGesture(SingleGestureName.Native, nativeConfig); } -export type NativeGestureEvent = GestureEvents; +export type NativeGestureEvent = GestureHandlerEvent; export type NativeGesture = SingleGesture< NativeViewHandlerData, NativeViewGestureProperties diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePan.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePan.ts index b9b864fc3a..6d8dd697d5 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePan.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePan.ts @@ -1,8 +1,8 @@ +import { GestureHandlerEvent } from 'react-native-reanimated/lib/typescript/hook'; import { StylusData } from '../../../handlers/gestureHandlerCommon'; import { BaseGestureConfig, ExcludeInternalConfigProps, - GestureEvents, SingleGesture, HandlerData, SingleGestureName, @@ -265,5 +265,5 @@ export function usePan(config: PanGestureConfig) { ); } -export type PanGestureEvent = GestureEvents; +export type PanGestureEvent = GestureHandlerEvent; export type PanGesture = SingleGesture; diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePinch.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePinch.ts index d27cfad191..57d24c74c8 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePinch.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePinch.ts @@ -1,7 +1,7 @@ +import { GestureHandlerEvent } from 'react-native-reanimated/lib/typescript/hook'; import { BaseGestureConfig, ExcludeInternalConfigProps, - GestureEvents, SingleGesture, HandlerData, SingleGestureName, @@ -47,7 +47,7 @@ export function usePinch(config: PinchGestureConfig) { return useGesture(SingleGestureName.Pinch, pinchConfig); } -export type PinchGestureEvent = GestureEvents; +export type PinchGestureEvent = GestureHandlerEvent; export type PinchGesture = SingleGesture< PinchHandlerData, PinchGestureProperties diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useRotation.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useRotation.ts index 9608fbbc21..8f2bc08a1b 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useRotation.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useRotation.ts @@ -1,7 +1,7 @@ +import { GestureHandlerEvent } from 'react-native-reanimated/lib/typescript/hook'; import { BaseGestureConfig, ExcludeInternalConfigProps, - GestureEvents, SingleGesture, HandlerData, SingleGestureName, @@ -51,7 +51,7 @@ export function useRotation(config: RotationGestureConfig) { return useGesture(SingleGestureName.Rotation, rotationConfig); } -export type RotationGestureEvent = GestureEvents; +export type RotationGestureEvent = GestureHandlerEvent; export type RotationGesture = SingleGesture< RotationHandlerData, RotationGestureProperties diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useTap.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useTap.ts index acb9a33a1f..d3e34ff20b 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useTap.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useTap.ts @@ -1,7 +1,7 @@ +import { GestureHandlerEvent } from 'react-native-reanimated/lib/typescript/hook'; import { BaseGestureConfig, ExcludeInternalConfigProps, - GestureEvents, SingleGesture, SingleGestureName, WithSharedValue, @@ -111,5 +111,5 @@ export function useTap(config: TapGestureConfig) { ); } -export type TapGestureEvent = GestureEvents; +export type TapGestureEvent = GestureHandlerEvent; export type TapGesture = SingleGesture; From f92baaed5f536e664cf92c20a130afbc03a59fe5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20Antoni=20Kwa=C5=9Bniewski?= Date: Mon, 6 Oct 2025 13:36:53 +0200 Subject: [PATCH 09/15] fix wrong import --- .../src/v3/hooks/gestures/useHover.ts | 2 +- .../src/v3/hooks/gestures/useLongPress.ts | 2 +- .../src/v3/hooks/gestures/useManual.ts | 2 +- .../src/v3/hooks/gestures/useNative.ts | 2 +- .../src/v3/hooks/gestures/usePan.ts | 2 +- .../src/v3/hooks/gestures/usePinch.ts | 2 +- .../src/v3/hooks/gestures/useRotation.ts | 2 +- .../src/v3/hooks/gestures/useTap.ts | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useHover.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useHover.ts index 64fa3d1f0b..ec0fab3f61 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useHover.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useHover.ts @@ -1,4 +1,3 @@ -import { GestureHandlerEvent } from 'react-native-reanimated/lib/typescript/hook'; import { StylusData } from '../../../handlers/gestureHandlerCommon'; import { HoverEffect } from '../../../handlers/gestures/hoverGesture'; import { @@ -8,6 +7,7 @@ import { HandlerData, SingleGestureName, WithSharedValue, + GestureHandlerEvent, } from '../../types'; import { useGesture } from '../useGesture'; import { cloneConfig, getChangeEventCalculator } from '../utils'; diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useLongPress.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useLongPress.ts index f7a2851a8b..25d70ae461 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useLongPress.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useLongPress.ts @@ -1,10 +1,10 @@ -import { GestureHandlerEvent } from 'react-native-reanimated/lib/typescript/hook'; import { BaseGestureConfig, ExcludeInternalConfigProps, SingleGesture, SingleGestureName, WithSharedValue, + GestureHandlerEvent, } from '../../types'; import { useGesture } from '../useGesture'; import { cloneConfig, remapProps } from '../utils'; diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useManual.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useManual.ts index b4f18e2b46..b04191a38c 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useManual.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useManual.ts @@ -1,9 +1,9 @@ -import { GestureHandlerEvent } from 'react-native-reanimated/lib/typescript/hook'; import { BaseGestureConfig, ExcludeInternalConfigProps, SingleGesture, SingleGestureName, + GestureHandlerEvent, } from '../../types'; import { useGesture } from '../useGesture'; import { cloneConfig } from '../utils'; diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useNative.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useNative.ts index dcec89e561..b01db0e71d 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useNative.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useNative.ts @@ -1,10 +1,10 @@ -import { GestureHandlerEvent } from 'react-native-reanimated/lib/typescript/hook'; import { BaseGestureConfig, ExcludeInternalConfigProps, SingleGesture, SingleGestureName, WithSharedValue, + GestureHandlerEvent, } from '../../types'; import { useGesture } from '../useGesture'; import { cloneConfig } from '../utils'; diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePan.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePan.ts index 6d8dd697d5..3369c3d591 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePan.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePan.ts @@ -1,4 +1,3 @@ -import { GestureHandlerEvent } from 'react-native-reanimated/lib/typescript/hook'; import { StylusData } from '../../../handlers/gestureHandlerCommon'; import { BaseGestureConfig, @@ -7,6 +6,7 @@ import { HandlerData, SingleGestureName, WithSharedValue, + GestureHandlerEvent, } from '../../types'; import { useGesture } from '../useGesture'; import { diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePinch.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePinch.ts index 57d24c74c8..1d479034f0 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePinch.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePinch.ts @@ -1,10 +1,10 @@ -import { GestureHandlerEvent } from 'react-native-reanimated/lib/typescript/hook'; import { BaseGestureConfig, ExcludeInternalConfigProps, SingleGesture, HandlerData, SingleGestureName, + GestureHandlerEvent, } from '../../types'; import { useGesture } from '../useGesture'; import { cloneConfig, getChangeEventCalculator } from '../utils'; diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useRotation.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useRotation.ts index 8f2bc08a1b..9101d6c1b5 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useRotation.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useRotation.ts @@ -1,10 +1,10 @@ -import { GestureHandlerEvent } from 'react-native-reanimated/lib/typescript/hook'; import { BaseGestureConfig, ExcludeInternalConfigProps, SingleGesture, HandlerData, SingleGestureName, + GestureHandlerEvent, } from '../../types'; import { useGesture } from '../useGesture'; import { cloneConfig, getChangeEventCalculator } from '../utils'; diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useTap.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useTap.ts index d3e34ff20b..1bb0edb6f5 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useTap.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useTap.ts @@ -1,10 +1,10 @@ -import { GestureHandlerEvent } from 'react-native-reanimated/lib/typescript/hook'; import { BaseGestureConfig, ExcludeInternalConfigProps, SingleGesture, SingleGestureName, WithSharedValue, + GestureHandlerEvent, } from '../../types'; import { useGesture } from '../useGesture'; import { cloneConfig, remapProps } from '../utils'; From 762c71c9d2c12e4f900e951b3afa405f6aaf8f2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20Antoni=20Kwa=C5=9Bniewski?= Date: Mon, 6 Oct 2025 13:43:19 +0200 Subject: [PATCH 10/15] more specific export --- .../src/v3/hooks/gestures/useFling.ts | 7 +++++-- .../src/v3/hooks/gestures/useHover.ts | 7 +++++-- .../src/v3/hooks/gestures/useLongPress.ts | 7 +++++-- .../src/v3/hooks/gestures/useManual.ts | 7 +++++-- .../src/v3/hooks/gestures/useNative.ts | 7 +++++-- .../src/v3/hooks/gestures/usePan.ts | 7 +++++-- .../src/v3/hooks/gestures/usePinch.ts | 7 +++++-- .../src/v3/hooks/gestures/useRotation.ts | 7 +++++-- .../src/v3/hooks/gestures/useTap.ts | 7 +++++-- 9 files changed, 45 insertions(+), 18 deletions(-) diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useFling.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useFling.ts index 6f5fafc55b..5153c8ea6b 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useFling.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useFling.ts @@ -4,7 +4,8 @@ import { SingleGesture, SingleGestureName, WithSharedValue, - GestureHandlerEvent, + StateChangeEvent, + UpdateEvent, } from '../../types'; import { useGesture } from '../useGesture'; import { cloneConfig } from '../utils'; @@ -55,7 +56,9 @@ export function useFling(config: FlingGestureConfig) { return useGesture(SingleGestureName.Fling, flingConfig); } -export type FlingGestureEvent = GestureHandlerEvent; +export type FlingGestureEvent = + | StateChangeEvent + | UpdateEvent; export type FlingGesture = SingleGesture< FlingHandlerData, FlingGestureProperties diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useHover.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useHover.ts index ec0fab3f61..c7c28ea7f0 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useHover.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useHover.ts @@ -7,7 +7,8 @@ import { HandlerData, SingleGestureName, WithSharedValue, - GestureHandlerEvent, + StateChangeEvent, + UpdateEvent, } from '../../types'; import { useGesture } from '../useGesture'; import { cloneConfig, getChangeEventCalculator } from '../utils'; @@ -67,7 +68,9 @@ export function useHover(config: HoverGestureConfig) { return useGesture(SingleGestureName.Hover, hoverConfig); } -export type HoverGestureEvent = GestureHandlerEvent; +export type HoverGestureEvent = + | StateChangeEvent + | UpdateEvent; export type HoverGesture = SingleGesture< HoverHandlerData, HoverGestureProperties diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useLongPress.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useLongPress.ts index 25d70ae461..6d997d1dfc 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useLongPress.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useLongPress.ts @@ -4,7 +4,8 @@ import { SingleGesture, SingleGestureName, WithSharedValue, - GestureHandlerEvent, + StateChangeEvent, + UpdateEvent, } from '../../types'; import { useGesture } from '../useGesture'; import { cloneConfig, remapProps } from '../utils'; @@ -82,7 +83,9 @@ export function useLongPress(config: LongPressGestureConfig) { ); } -export type LongPressGestureEvent = GestureHandlerEvent; +export type LongPressGestureEvent = + | StateChangeEvent + | UpdateEvent; export type LongPressGesture = SingleGesture< LongPressHandlerData, LongPressGestureProperties diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useManual.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useManual.ts index b04191a38c..c4206c5a33 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useManual.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useManual.ts @@ -3,7 +3,8 @@ import { ExcludeInternalConfigProps, SingleGesture, SingleGestureName, - GestureHandlerEvent, + StateChangeEvent, + UpdateEvent, } from '../../types'; import { useGesture } from '../useGesture'; import { cloneConfig } from '../utils'; @@ -27,7 +28,9 @@ export function useManual(config: ManualGestureConfig) { return useGesture(SingleGestureName.Manual, manualConfig); } -export type ManualGestureEvent = GestureHandlerEvent; +export type ManualGestureEvent = + | StateChangeEvent + | UpdateEvent; export type ManualGesture = SingleGesture< ManualHandlerData, ManualGestureProperties diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useNative.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useNative.ts index b01db0e71d..bf3504def4 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useNative.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useNative.ts @@ -4,7 +4,8 @@ import { SingleGesture, SingleGestureName, WithSharedValue, - GestureHandlerEvent, + StateChangeEvent, + UpdateEvent, } from '../../types'; import { useGesture } from '../useGesture'; import { cloneConfig } from '../utils'; @@ -46,7 +47,9 @@ export function useNative(config: NativeViewGestureConfig) { return useGesture(SingleGestureName.Native, nativeConfig); } -export type NativeGestureEvent = GestureHandlerEvent; +export type NativeGestureEvent = + | StateChangeEvent + | UpdateEvent; export type NativeGesture = SingleGesture< NativeViewHandlerData, NativeViewGestureProperties diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePan.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePan.ts index 3369c3d591..6121098cfe 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePan.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePan.ts @@ -6,7 +6,8 @@ import { HandlerData, SingleGestureName, WithSharedValue, - GestureHandlerEvent, + StateChangeEvent, + UpdateEvent, } from '../../types'; import { useGesture } from '../useGesture'; import { @@ -265,5 +266,7 @@ export function usePan(config: PanGestureConfig) { ); } -export type PanGestureEvent = GestureHandlerEvent; +export type PanGestureEvent = + | StateChangeEvent + | UpdateEvent; export type PanGesture = SingleGesture; diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePinch.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePinch.ts index 1d479034f0..978ff03650 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePinch.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePinch.ts @@ -4,7 +4,8 @@ import { SingleGesture, HandlerData, SingleGestureName, - GestureHandlerEvent, + UpdateEvent, + StateChangeEvent, } from '../../types'; import { useGesture } from '../useGesture'; import { cloneConfig, getChangeEventCalculator } from '../utils'; @@ -47,7 +48,9 @@ export function usePinch(config: PinchGestureConfig) { return useGesture(SingleGestureName.Pinch, pinchConfig); } -export type PinchGestureEvent = GestureHandlerEvent; +export type PinchGestureEvent = + | StateChangeEvent + | UpdateEvent; export type PinchGesture = SingleGesture< PinchHandlerData, PinchGestureProperties diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useRotation.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useRotation.ts index 9101d6c1b5..9d21021f57 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useRotation.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useRotation.ts @@ -4,7 +4,8 @@ import { SingleGesture, HandlerData, SingleGestureName, - GestureHandlerEvent, + StateChangeEvent, + UpdateEvent, } from '../../types'; import { useGesture } from '../useGesture'; import { cloneConfig, getChangeEventCalculator } from '../utils'; @@ -51,7 +52,9 @@ export function useRotation(config: RotationGestureConfig) { return useGesture(SingleGestureName.Rotation, rotationConfig); } -export type RotationGestureEvent = GestureHandlerEvent; +export type RotationGestureEvent = + | StateChangeEvent + | UpdateEvent; export type RotationGesture = SingleGesture< RotationHandlerData, RotationGestureProperties diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useTap.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useTap.ts index 1bb0edb6f5..651a6fb08c 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useTap.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useTap.ts @@ -4,7 +4,8 @@ import { SingleGesture, SingleGestureName, WithSharedValue, - GestureHandlerEvent, + StateChangeEvent, + UpdateEvent, } from '../../types'; import { useGesture } from '../useGesture'; import { cloneConfig, remapProps } from '../utils'; @@ -111,5 +112,7 @@ export function useTap(config: TapGestureConfig) { ); } -export type TapGestureEvent = GestureHandlerEvent; +export type TapGestureEvent = + | StateChangeEvent + | UpdateEvent; export type TapGesture = SingleGesture; From fb3be0e1838ad411018af51e0dfccc76ae4789d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20Antoni=20Kwa=C5=9Bniewski?= Date: Tue, 7 Oct 2025 08:12:19 +0200 Subject: [PATCH 11/15] even more specific type --- .../src/v3/hooks/gestures/useFling.ts | 9 +++++---- .../src/v3/hooks/gestures/useHover.ts | 9 +++++---- .../src/v3/hooks/gestures/useLongPress.ts | 9 +++++---- .../src/v3/hooks/gestures/useManual.ts | 10 ++++++---- .../src/v3/hooks/gestures/useNative.ts | 9 +++++---- .../src/v3/hooks/gestures/usePan.ts | 9 +++++---- .../src/v3/hooks/gestures/usePinch.ts | 9 +++++---- .../src/v3/hooks/gestures/useRotation.ts | 9 +++++---- .../src/v3/hooks/gestures/useTap.ts | 9 +++++---- 9 files changed, 46 insertions(+), 36 deletions(-) diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useFling.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useFling.ts index 5153c8ea6b..d07d7e308b 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useFling.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useFling.ts @@ -4,8 +4,8 @@ import { SingleGesture, SingleGestureName, WithSharedValue, - StateChangeEvent, - UpdateEvent, + GestureStateChangeEvent, + GestureUpdateEvent, } from '../../types'; import { useGesture } from '../useGesture'; import { cloneConfig } from '../utils'; @@ -57,8 +57,9 @@ export function useFling(config: FlingGestureConfig) { } export type FlingGestureEvent = - | StateChangeEvent - | UpdateEvent; + | GestureStateChangeEvent + | GestureUpdateEvent; + export type FlingGesture = SingleGesture< FlingHandlerData, FlingGestureProperties diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useHover.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useHover.ts index c7c28ea7f0..11f064c20d 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useHover.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useHover.ts @@ -7,8 +7,8 @@ import { HandlerData, SingleGestureName, WithSharedValue, - StateChangeEvent, - UpdateEvent, + GestureStateChangeEvent, + GestureUpdateEvent, } from '../../types'; import { useGesture } from '../useGesture'; import { cloneConfig, getChangeEventCalculator } from '../utils'; @@ -69,8 +69,9 @@ export function useHover(config: HoverGestureConfig) { } export type HoverGestureEvent = - | StateChangeEvent - | UpdateEvent; + | GestureStateChangeEvent + | GestureUpdateEvent; + export type HoverGesture = SingleGesture< HoverHandlerData, HoverGestureProperties diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useLongPress.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useLongPress.ts index 6d997d1dfc..e31adaf9f9 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useLongPress.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useLongPress.ts @@ -4,8 +4,8 @@ import { SingleGesture, SingleGestureName, WithSharedValue, - StateChangeEvent, - UpdateEvent, + GestureStateChangeEvent, + GestureUpdateEvent, } from '../../types'; import { useGesture } from '../useGesture'; import { cloneConfig, remapProps } from '../utils'; @@ -84,8 +84,9 @@ export function useLongPress(config: LongPressGestureConfig) { } export type LongPressGestureEvent = - | StateChangeEvent - | UpdateEvent; + | GestureStateChangeEvent + | GestureUpdateEvent; + export type LongPressGesture = SingleGesture< LongPressHandlerData, LongPressGestureProperties diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useManual.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useManual.ts index c4206c5a33..897906baaf 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useManual.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useManual.ts @@ -3,9 +3,10 @@ import { ExcludeInternalConfigProps, SingleGesture, SingleGestureName, - StateChangeEvent, - UpdateEvent, + GestureStateChangeEvent, + GestureUpdateEvent, } from '../../types'; + import { useGesture } from '../useGesture'; import { cloneConfig } from '../utils'; @@ -29,8 +30,9 @@ export function useManual(config: ManualGestureConfig) { } export type ManualGestureEvent = - | StateChangeEvent - | UpdateEvent; + | GestureStateChangeEvent + | GestureUpdateEvent; + export type ManualGesture = SingleGesture< ManualHandlerData, ManualGestureProperties diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useNative.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useNative.ts index bf3504def4..614cfd1db2 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useNative.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useNative.ts @@ -4,8 +4,8 @@ import { SingleGesture, SingleGestureName, WithSharedValue, - StateChangeEvent, - UpdateEvent, + GestureStateChangeEvent, + GestureUpdateEvent, } from '../../types'; import { useGesture } from '../useGesture'; import { cloneConfig } from '../utils'; @@ -48,8 +48,9 @@ export function useNative(config: NativeViewGestureConfig) { } export type NativeGestureEvent = - | StateChangeEvent - | UpdateEvent; + | GestureStateChangeEvent + | GestureUpdateEvent; + export type NativeGesture = SingleGesture< NativeViewHandlerData, NativeViewGestureProperties diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePan.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePan.ts index 6121098cfe..3034a8cd8c 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePan.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePan.ts @@ -6,8 +6,8 @@ import { HandlerData, SingleGestureName, WithSharedValue, - StateChangeEvent, - UpdateEvent, + GestureStateChangeEvent, + GestureUpdateEvent, } from '../../types'; import { useGesture } from '../useGesture'; import { @@ -267,6 +267,7 @@ export function usePan(config: PanGestureConfig) { } export type PanGestureEvent = - | StateChangeEvent - | UpdateEvent; + | GestureStateChangeEvent + | GestureUpdateEvent; + export type PanGesture = SingleGesture; diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePinch.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePinch.ts index 978ff03650..eff76a736d 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePinch.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePinch.ts @@ -4,8 +4,8 @@ import { SingleGesture, HandlerData, SingleGestureName, - UpdateEvent, - StateChangeEvent, + GestureUpdateEvent, + GestureStateChangeEvent, } from '../../types'; import { useGesture } from '../useGesture'; import { cloneConfig, getChangeEventCalculator } from '../utils'; @@ -49,8 +49,9 @@ export function usePinch(config: PinchGestureConfig) { } export type PinchGestureEvent = - | StateChangeEvent - | UpdateEvent; + | GestureStateChangeEvent + | GestureUpdateEvent; + export type PinchGesture = SingleGesture< PinchHandlerData, PinchGestureProperties diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useRotation.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useRotation.ts index 9d21021f57..1fb81060fe 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useRotation.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useRotation.ts @@ -4,8 +4,8 @@ import { SingleGesture, HandlerData, SingleGestureName, - StateChangeEvent, - UpdateEvent, + GestureStateChangeEvent, + GestureUpdateEvent, } from '../../types'; import { useGesture } from '../useGesture'; import { cloneConfig, getChangeEventCalculator } from '../utils'; @@ -53,8 +53,9 @@ export function useRotation(config: RotationGestureConfig) { } export type RotationGestureEvent = - | StateChangeEvent - | UpdateEvent; + | GestureStateChangeEvent + | GestureUpdateEvent; + export type RotationGesture = SingleGesture< RotationHandlerData, RotationGestureProperties diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useTap.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useTap.ts index 651a6fb08c..edf2a866e6 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useTap.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useTap.ts @@ -4,8 +4,8 @@ import { SingleGesture, SingleGestureName, WithSharedValue, - StateChangeEvent, - UpdateEvent, + GestureStateChangeEvent, + GestureUpdateEvent, } from '../../types'; import { useGesture } from '../useGesture'; import { cloneConfig, remapProps } from '../utils'; @@ -113,6 +113,7 @@ export function useTap(config: TapGestureConfig) { } export type TapGestureEvent = - | StateChangeEvent - | UpdateEvent; + | GestureStateChangeEvent + | GestureUpdateEvent; + export type TapGesture = SingleGesture; From c7a25efa33292dd2a0ecfffab7dda8d91772482f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20Antoni=20Kwa=C5=9Bniewski?= Date: Mon, 13 Oct 2025 11:58:46 +0200 Subject: [PATCH 12/15] not exporting singlegesturename --- apps/basic-example/src/NativeDetector.tsx | 5 ++--- packages/react-native-gesture-handler/src/index.ts | 1 - 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/apps/basic-example/src/NativeDetector.tsx b/apps/basic-example/src/NativeDetector.tsx index c6ee6ef8b8..da305734c9 100644 --- a/apps/basic-example/src/NativeDetector.tsx +++ b/apps/basic-example/src/NativeDetector.tsx @@ -3,8 +3,7 @@ import { Animated, Button, useAnimatedValue } from 'react-native'; import { GestureHandlerRootView, NativeDetector, - SingleGestureName, - useGesture, + usePan, } from 'react-native-gesture-handler'; export default function App() { @@ -18,7 +17,7 @@ export default function App() { } ); - const gesture = useGesture(SingleGestureName.Pan, { + const gesture = usePan({ onUpdate: event, }); diff --git a/packages/react-native-gesture-handler/src/index.ts b/packages/react-native-gesture-handler/src/index.ts index e24c7372bd..1db5853452 100644 --- a/packages/react-native-gesture-handler/src/index.ts +++ b/packages/react-native-gesture-handler/src/index.ts @@ -169,7 +169,6 @@ export { LogicDetector } from './v3/LogicDetector'; export * from './v3/hooks/useGesture'; export * from './v3/hooks/relations'; -export { SingleGestureName } from './v3/types'; export type { ComposedGesture } from './v3/types'; export * from './v3/hooks/gestures'; From 5113634c2dd173e7242d90f67ce8b133533252b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20Antoni=20Kwa=C5=9Bniewski?= Date: Mon, 13 Oct 2025 12:15:45 +0200 Subject: [PATCH 13/15] separate update and state change types --- .../src/v3/hooks/gestures/index.ts | 129 ++++++++++++++---- .../src/v3/hooks/gestures/useFling.ts | 6 +- .../src/v3/hooks/gestures/useHover.ts | 6 +- .../src/v3/hooks/gestures/useLongPress.ts | 7 +- .../src/v3/hooks/gestures/useManual.ts | 6 +- .../src/v3/hooks/gestures/useNative.ts | 7 +- .../src/v3/hooks/gestures/usePan.ts | 6 +- .../src/v3/hooks/gestures/usePinch.ts | 6 +- .../src/v3/hooks/gestures/useRotation.ts | 7 +- .../src/v3/hooks/gestures/useTap.ts | 6 +- 10 files changed, 131 insertions(+), 55 deletions(-) diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/index.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/index.ts index c81eb55e7a..8135f6765e 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/index.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/index.ts @@ -1,47 +1,111 @@ -import type { FlingGestureEvent, FlingGesture } from './useFling'; -import type { HoverGestureEvent, HoverGesture } from './useHover'; -import type { LongPressGestureEvent, LongPressGesture } from './useLongPress'; -import type { ManualGestureEvent, ManualGesture } from './useManual'; -import type { NativeGestureEvent, NativeGesture } from './useNative'; -import type { PanGestureEvent, PanGesture } from './usePan'; -import type { PinchGestureEvent, PinchGesture } from './usePinch'; -import type { RotationGestureEvent, RotationGesture } from './useRotation'; -import type { TapGestureEvent, TapGesture } from './useTap'; +import type { + FlingGestureStateChangeEvent, + FlingGestureUpdateEvent, + FlingGesture, +} from './useFling'; +import type { + HoverGestureStateChangeEvent, + HoverGestureUpdateEvent, + HoverGesture, +} from './useHover'; +import type { + LongPressGestureStateChangeEvent, + LongPressGestureUpdateEvent, + LongPressGesture, +} from './useLongPress'; +import type { + ManualGestureStateChangeEvent, + ManualGestureUpdateEvent, + ManualGesture, +} from './useManual'; +import type { + NativeGestureStateChangeEvent, + NativeGestureUpdateEvent, + NativeGesture, +} from './useNative'; +import type { + PanGestureStateChangeEvent, + PanGestureUpdateEvent, + PanGesture, +} from './usePan'; +import type { + PinchGestureStateChangeEvent, + PinchGestureUpdateEvent, + PinchGesture, +} from './usePinch'; +import type { + RotationGestureStateChangeEvent, + RotationGestureUpdateEvent, + RotationGesture, +} from './useRotation'; +import type { + TapGestureStateChangeEvent, + TapGestureUpdateEvent, + TapGesture, +} from './useTap'; export type { TapGestureConfig } from './useTap'; -export type { TapGesture, TapGestureEvent }; +export type { TapGesture, TapGestureStateChangeEvent, TapGestureUpdateEvent }; export { useTap } from './useTap'; export type { FlingGestureConfig } from './useFling'; -export type { FlingGesture, FlingGestureEvent }; +export type { + FlingGesture, + FlingGestureStateChangeEvent, + FlingGestureUpdateEvent, +}; export { useFling } from './useFling'; export type { LongPressGestureConfig } from './useLongPress'; -export type { LongPressGesture, LongPressGestureEvent }; +export type { + LongPressGesture, + LongPressGestureStateChangeEvent, + LongPressGestureUpdateEvent, +}; export { useLongPress } from './useLongPress'; export type { PinchGestureConfig } from './usePinch'; -export type { PinchGesture, PinchGestureEvent }; +export type { + PinchGesture, + PinchGestureStateChangeEvent, + PinchGestureUpdateEvent, +}; export { usePinch } from './usePinch'; export type { RotationGestureConfig } from './useRotation'; -export type { RotationGesture, RotationGestureEvent }; +export type { + RotationGesture, + RotationGestureStateChangeEvent, + RotationGestureUpdateEvent, +}; export { useRotation } from './useRotation'; export type { HoverGestureConfig } from './useHover'; -export type { HoverGesture, HoverGestureEvent }; +export type { + HoverGesture, + HoverGestureStateChangeEvent, + HoverGestureUpdateEvent, +}; export { useHover } from './useHover'; export type { ManualGestureConfig } from './useManual'; -export type { ManualGesture, ManualGestureEvent }; +export type { + ManualGesture, + ManualGestureStateChangeEvent, + ManualGestureUpdateEvent, +}; export { useManual } from './useManual'; export type { NativeViewGestureConfig } from './useNative'; -export type { NativeGesture, NativeGestureEvent }; +export type { + NativeGesture, + NativeGestureStateChangeEvent, + NativeGestureUpdateEvent, +}; export { useNative } from './useNative'; export type { PanGestureConfig } from './usePan'; -export type { PanGesture, PanGestureEvent }; +export type { PanGesture, PanGestureStateChangeEvent, PanGestureUpdateEvent }; export { usePan } from './usePan'; export type SingleGesture = @@ -55,13 +119,22 @@ export type SingleGesture = | NativeGesture | PanGesture; -export type SingleGestureEvent = - | TapGestureEvent - | FlingGestureEvent - | LongPressGestureEvent - | PinchGestureEvent - | RotationGestureEvent - | HoverGestureEvent - | ManualGestureEvent - | NativeGestureEvent - | PanGestureEvent; +export type SingleGestureStateChangeEvent = + | TapGestureStateChangeEvent + | FlingGestureStateChangeEvent + | LongPressGestureStateChangeEvent + | RotationGestureStateChangeEvent + | HoverGestureStateChangeEvent + | ManualGestureStateChangeEvent + | NativeGestureStateChangeEvent + | PanGestureStateChangeEvent; + +export type SingleGestureUpdateEvent = + | TapGestureUpdateEvent + | FlingGestureUpdateEvent + | LongPressGestureUpdateEvent + | RotationGestureUpdateEvent + | HoverGestureUpdateEvent + | ManualGestureUpdateEvent + | NativeGestureUpdateEvent + | PanGestureUpdateEvent; diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useFling.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useFling.ts index d07d7e308b..90b97158da 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useFling.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useFling.ts @@ -56,9 +56,9 @@ export function useFling(config: FlingGestureConfig) { return useGesture(SingleGestureName.Fling, flingConfig); } -export type FlingGestureEvent = - | GestureStateChangeEvent - | GestureUpdateEvent; +export type FlingGestureStateChangeEvent = + GestureStateChangeEvent; +export type FlingGestureUpdateEvent = GestureUpdateEvent; export type FlingGesture = SingleGesture< FlingHandlerData, diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useHover.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useHover.ts index 11f064c20d..f332586255 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useHover.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useHover.ts @@ -68,9 +68,9 @@ export function useHover(config: HoverGestureConfig) { return useGesture(SingleGestureName.Hover, hoverConfig); } -export type HoverGestureEvent = - | GestureStateChangeEvent - | GestureUpdateEvent; +export type HoverGestureStateChangeEvent = + GestureStateChangeEvent; +export type HoverGestureUpdateEvent = GestureUpdateEvent; export type HoverGesture = SingleGesture< HoverHandlerData, diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useLongPress.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useLongPress.ts index e31adaf9f9..61c32b79d4 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useLongPress.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useLongPress.ts @@ -83,9 +83,10 @@ export function useLongPress(config: LongPressGestureConfig) { ); } -export type LongPressGestureEvent = - | GestureStateChangeEvent - | GestureUpdateEvent; +export type LongPressGestureStateChangeEvent = + GestureStateChangeEvent; +export type LongPressGestureUpdateEvent = + GestureUpdateEvent; export type LongPressGesture = SingleGesture< LongPressHandlerData, diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useManual.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useManual.ts index 897906baaf..15046a720b 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useManual.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useManual.ts @@ -29,9 +29,9 @@ export function useManual(config: ManualGestureConfig) { return useGesture(SingleGestureName.Manual, manualConfig); } -export type ManualGestureEvent = - | GestureStateChangeEvent - | GestureUpdateEvent; +export type ManualGestureStateChangeEvent = + GestureStateChangeEvent; +export type ManualGestureUpdateEvent = GestureUpdateEvent; export type ManualGesture = SingleGesture< ManualHandlerData, diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useNative.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useNative.ts index 614cfd1db2..eeaf76d80a 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useNative.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useNative.ts @@ -47,9 +47,10 @@ export function useNative(config: NativeViewGestureConfig) { return useGesture(SingleGestureName.Native, nativeConfig); } -export type NativeGestureEvent = - | GestureStateChangeEvent - | GestureUpdateEvent; +export type NativeGestureStateChangeEvent = + GestureStateChangeEvent; +export type NativeGestureUpdateEvent = + GestureUpdateEvent; export type NativeGesture = SingleGesture< NativeViewHandlerData, diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePan.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePan.ts index 3034a8cd8c..ef345e2dc3 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePan.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePan.ts @@ -266,8 +266,8 @@ export function usePan(config: PanGestureConfig) { ); } -export type PanGestureEvent = - | GestureStateChangeEvent - | GestureUpdateEvent; +export type PanGestureStateChangeEvent = + GestureStateChangeEvent; +export type PanGestureUpdateEvent = GestureUpdateEvent; export type PanGesture = SingleGesture; diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePinch.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePinch.ts index eff76a736d..bd71efa487 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePinch.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/usePinch.ts @@ -48,9 +48,9 @@ export function usePinch(config: PinchGestureConfig) { return useGesture(SingleGestureName.Pinch, pinchConfig); } -export type PinchGestureEvent = - | GestureStateChangeEvent - | GestureUpdateEvent; +export type PinchGestureStateChangeEvent = + GestureStateChangeEvent; +export type PinchGestureUpdateEvent = GestureUpdateEvent; export type PinchGesture = SingleGesture< PinchHandlerData, diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useRotation.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useRotation.ts index 1fb81060fe..56faf52c57 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useRotation.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useRotation.ts @@ -52,9 +52,10 @@ export function useRotation(config: RotationGestureConfig) { return useGesture(SingleGestureName.Rotation, rotationConfig); } -export type RotationGestureEvent = - | GestureStateChangeEvent - | GestureUpdateEvent; +export type RotationGestureStateChangeEvent = + GestureStateChangeEvent; +export type RotationGestureUpdateEvent = + GestureUpdateEvent; export type RotationGesture = SingleGesture< RotationHandlerData, diff --git a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useTap.ts b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useTap.ts index edf2a866e6..24389ca815 100644 --- a/packages/react-native-gesture-handler/src/v3/hooks/gestures/useTap.ts +++ b/packages/react-native-gesture-handler/src/v3/hooks/gestures/useTap.ts @@ -112,8 +112,8 @@ export function useTap(config: TapGestureConfig) { ); } -export type TapGestureEvent = - | GestureStateChangeEvent - | GestureUpdateEvent; +export type TapGestureStateChangeEvent = + GestureStateChangeEvent; +export type TapGestureUpdateEvent = GestureUpdateEvent; export type TapGesture = SingleGesture; From cc68f4c30513a07154c98c0741dbcbf967d2ddbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20Antoni=20Kwa=C5=9Bniewski?= Date: Mon, 13 Oct 2025 12:19:38 +0200 Subject: [PATCH 14/15] exporting touch event --- packages/react-native-gesture-handler/src/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/react-native-gesture-handler/src/index.ts b/packages/react-native-gesture-handler/src/index.ts index 1db5853452..d597c90ded 100644 --- a/packages/react-native-gesture-handler/src/index.ts +++ b/packages/react-native-gesture-handler/src/index.ts @@ -170,6 +170,7 @@ export * from './v3/hooks/useGesture'; export * from './v3/hooks/relations'; export type { ComposedGesture } from './v3/types'; +export type { GestureTouchEvent as SingleGestureTouchEvent } from './handlers/gestureHandlerCommon'; export * from './v3/hooks/gestures'; From 2633ba1ee5fde6e782d3b47b3ec0eba76b8f3059 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20Antoni=20Kwa=C5=9Bniewski?= Date: Tue, 14 Oct 2025 14:29:13 +0200 Subject: [PATCH 15/15] Legacy prefix --- .../src/new_api/drag_n_drop/Draggable.tsx | 8 ++--- .../src/__tests__/Events.test.tsx | 30 ++++++++++--------- .../react-native-gesture-handler/src/index.ts | 26 ++++++++-------- 3 files changed, 33 insertions(+), 31 deletions(-) diff --git a/apps/common-app/src/new_api/drag_n_drop/Draggable.tsx b/apps/common-app/src/new_api/drag_n_drop/Draggable.tsx index 6159f143ad..9b70bfcaca 100644 --- a/apps/common-app/src/new_api/drag_n_drop/Draggable.tsx +++ b/apps/common-app/src/new_api/drag_n_drop/Draggable.tsx @@ -4,8 +4,8 @@ import { PanGestureHandlerEventPayload, Gesture, GestureDetector, - PanGestureType, - TapGestureType, + LegacyPanGesture, + LegacyTapGesture, } from 'react-native-gesture-handler'; import Animated, { runOnJS, useAnimatedStyle } from 'react-native-reanimated'; @@ -22,8 +22,8 @@ interface DraggableProps { isActive: boolean; translation: AnimatedPostion; position: { x: number; y: number }; - dragGesture: PanGestureType; - tapEndGesture: TapGestureType; + dragGesture: LegacyPanGesture; + tapEndGesture: LegacyTapGesture; tileSize: number; rowGap: number; columnGap: number; diff --git a/packages/react-native-gesture-handler/src/__tests__/Events.test.tsx b/packages/react-native-gesture-handler/src/__tests__/Events.test.tsx index 043ef574c3..9f57a508ec 100644 --- a/packages/react-native-gesture-handler/src/__tests__/Events.test.tsx +++ b/packages/react-native-gesture-handler/src/__tests__/Events.test.tsx @@ -13,8 +13,8 @@ import { Gesture, GestureDetector, State, - PanGestureType, - TapGestureType, + LegacyPanGesture, + LegacyTapGesture, } from '../index'; import { useAnimatedGestureHandler } from 'react-native-reanimated'; import { fireGestureHandler, getByGestureTestId } from '../jestUtils'; @@ -300,7 +300,7 @@ describe('Using RNGH v2 gesture API', () => { ); - fireGestureHandler(getByGestureTestId('pan'), [ + fireGestureHandler(getByGestureTestId('pan'), [ { state: State.BEGAN }, { state: State.ACTIVE }, { state: State.END }, @@ -315,7 +315,7 @@ describe('Using RNGH v2 gesture API', () => { test('sends events with additional data to handlers', () => { const panHandlers = mockedEventHandlers(); render(); - fireGestureHandler(getByGestureTestId('pan'), [ + fireGestureHandler(getByGestureTestId('pan'), [ { state: State.BEGAN, translationX: 0 }, { state: State.ACTIVE, translationX: 10 }, { translationX: 20 }, @@ -358,7 +358,7 @@ describe('Event list validation', () => { const panHandlers = mockedEventHandlers(); render(); expect(() => { - fireGestureHandler(getByGestureTestId('pan'), [ + fireGestureHandler(getByGestureTestId('pan'), [ { oldState: State.UNDETERMINED, state: State.BEGAN, x: 0, y: 10 }, { oldState: State.UNDETERMINED, state: State.ACTIVE, x: 1, y: 11 }, ]); @@ -372,7 +372,7 @@ describe('Event list validation', () => { (lastState) => { const panHandlers = mockedEventHandlers(); render(); - fireGestureHandler(getByGestureTestId('pan'), [ + fireGestureHandler(getByGestureTestId('pan'), [ { state: State.BEGAN }, { state: State.ACTIVE }, { state: lastState }, @@ -452,7 +452,7 @@ describe('Filling event list with defaults', () => { test('fills missing ACTIVE states', () => { const panHandlers = mockedEventHandlers(); render(); - fireGestureHandler(getByGestureTestId('pan'), [ + fireGestureHandler(getByGestureTestId('pan'), [ { state: State.BEGAN, x: 0, y: 10 }, { state: State.ACTIVE, x: 1, y: 11 }, { x: 2, y: 12 }, @@ -469,7 +469,7 @@ describe('Filling event list with defaults', () => { test('fills BEGIN and END events for discrete handlers', () => { const handlers = mockedEventHandlers(); render(); - fireGestureHandler(getByGestureTestId('tap'), [{ x: 5 }]); + fireGestureHandler(getByGestureTestId('tap'), [{ x: 5 }]); expect(handlers.begin).toHaveBeenCalledTimes(1); expect(handlers.end).toHaveBeenCalledTimes(1); }); @@ -477,7 +477,7 @@ describe('Filling event list with defaults', () => { test('with FAILED event, fills BEGIN event for discrete handlers', () => { const handlers = mockedEventHandlers(); render(); - fireGestureHandler(getByGestureTestId('tap'), [ + fireGestureHandler(getByGestureTestId('tap'), [ { state: State.FAILED }, ]); expect(handlers.begin).toHaveBeenCalledTimes(1); @@ -488,7 +488,9 @@ describe('Filling event list with defaults', () => { test('uses event data from first event in filled BEGIN, ACTIVE events', () => { const handlers = mockedEventHandlers(); render(); - fireGestureHandler(getByGestureTestId('pan'), [{ x: 120 }]); + fireGestureHandler(getByGestureTestId('pan'), [ + { x: 120 }, + ]); expect(handlers.begin).toHaveBeenCalledWith( expect.objectContaining({ x: 120 }) ); @@ -501,7 +503,7 @@ describe('Filling event list with defaults', () => { test('uses event data from last event in filled END events', () => { const handlers = mockedEventHandlers(); render(); - fireGestureHandler(getByGestureTestId('pan'), [ + fireGestureHandler(getByGestureTestId('pan'), [ { x: 120, state: State.FAILED }, ]); expect(handlers.begin).toHaveBeenCalledTimes(1); @@ -515,7 +517,7 @@ describe('Filling event list with defaults', () => { test('uses event data filled events', () => { const handlers = mockedEventHandlers(); render(); - fireGestureHandler(getByGestureTestId('pan'), [ + fireGestureHandler(getByGestureTestId('pan'), [ { x: 5, y: 15 }, { x: 6, y: 16 }, { x: 7, y: 17 }, @@ -533,7 +535,7 @@ describe('Filling event list with defaults', () => { test("fills BEGIN and END events when they're not present, for discrete handlers", () => { const handlers = mockedEventHandlers(); render(); - fireGestureHandler(getByGestureTestId('tap')); + fireGestureHandler(getByGestureTestId('tap')); expect(handlers.begin).toHaveBeenCalledTimes(1); expect(handlers.end).toHaveBeenCalledTimes(1); }); @@ -541,7 +543,7 @@ describe('Filling event list with defaults', () => { test("fills BEGIN, ACTIVE and END events when they're not present, for continuous handlers", () => { const handlers = mockedEventHandlers(); render(); - fireGestureHandler(getByGestureTestId('pan')); + fireGestureHandler(getByGestureTestId('pan')); expect(handlers.begin).toHaveBeenCalledTimes(1); expect(handlers.active).toHaveBeenCalledTimes(1); expect(handlers.end).toHaveBeenCalledTimes(1); diff --git a/packages/react-native-gesture-handler/src/index.ts b/packages/react-native-gesture-handler/src/index.ts index d597c90ded..1ab1892563 100644 --- a/packages/react-native-gesture-handler/src/index.ts +++ b/packages/react-native-gesture-handler/src/index.ts @@ -54,20 +54,20 @@ export { default as createNativeWrapper } from './handlers/createNativeWrapper'; export type { NativeViewGestureHandlerProps } from './handlers/NativeViewGestureHandler'; export { GestureDetector } from './handlers/gestures/GestureDetector'; export { GestureObjects as Gesture } from './handlers/gestures/gestureObjects'; -export type { TapGestureType } from './handlers/gestures/tapGesture'; -export type { PanGestureType } from './handlers/gestures/panGesture'; -export type { FlingGestureType } from './handlers/gestures/flingGesture'; -export type { LongPressGestureType } from './handlers/gestures/longPressGesture'; -export type { PinchGestureType } from './handlers/gestures/pinchGesture'; -export type { RotationGestureType } from './handlers/gestures/rotationGesture'; -export type { ForceTouchGestureType } from './handlers/gestures/forceTouchGesture'; -export type { ManualGestureType } from './handlers/gestures/manualGesture'; -export type { HoverGestureType } from './handlers/gestures/hoverGesture'; +export type { TapGestureType as LegacyTapGesture } from './handlers/gestures/tapGesture'; +export type { PanGestureType as LegacyPanGesture } from './handlers/gestures/panGesture'; +export type { FlingGestureType as LegacyFlingGesture } from './handlers/gestures/flingGesture'; +export type { LongPressGestureType as LegacyLongPressGesture } from './handlers/gestures/longPressGesture'; +export type { PinchGestureType as LegacyPinchGesture } from './handlers/gestures/pinchGesture'; +export type { RotationGestureType as LegacyRotationGesture } from './handlers/gestures/rotationGesture'; +export type { ForceTouchGestureType as LegacyForceTouchGesture } from './handlers/gestures/forceTouchGesture'; +export type { ManualGestureType as LegacyManualGesture } from './handlers/gestures/manualGesture'; +export type { HoverGestureType as LegacyHoverGesture } from './handlers/gestures/hoverGesture'; export type { - ComposedGestureType, - RaceGestureType, - SimultaneousGestureType, - ExclusiveGestureType, + ComposedGestureType as LegacyComposedGesture, + RaceGestureType as LegacyRaceGesture, + SimultaneousGestureType as LegacySimultaneousGesture, + ExclusiveGestureType as LegacyExclusiveGesture, } from './handlers/gestures/gestureComposition'; export type { GestureStateManagerType as GestureStateManager } from './handlers/gestures/gestureStateManager'; export { NativeViewGestureHandler } from './handlers/NativeViewGestureHandler';