From 61aaef919cf6ee02b335c54288a89d67a999df2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Bert?= <63123542+m-bert@users.noreply.github.com> Date: Fri, 13 Dec 2024 13:41:30 +0100 Subject: [PATCH] Deprecate old API (#3262) ## Description This PR deprecates old Gesture Handler API. ## Test plan Try importing any handler from old API. --- docs/docs/gesture-handlers/about-handlers.md | 2 +- docs/docs/gesture-handlers/common-gh.md | 2 +- docs/docs/gesture-handlers/create-native-wrapper.md | 2 +- docs/docs/gesture-handlers/fling-gh.md | 2 +- docs/docs/gesture-handlers/force-gh.md | 2 +- docs/docs/gesture-handlers/interactions.md | 2 +- docs/docs/gesture-handlers/longpress-gh.md | 2 +- docs/docs/gesture-handlers/nativeview-gh.md | 2 +- docs/docs/gesture-handlers/pan-gh.md | 2 +- docs/docs/gesture-handlers/pinch-gh.md | 2 +- docs/docs/gesture-handlers/rotation-gh.md | 2 +- docs/docs/gesture-handlers/tap-gh.md | 2 +- src/handlers/FlingGestureHandler.ts | 10 ++++++++++ src/handlers/ForceTouchGestureHandler.ts | 9 +++++++++ src/handlers/LongPressGestureHandler.ts | 10 ++++++++++ src/handlers/NativeViewGestureHandler.ts | 10 ++++++++++ src/handlers/PanGestureHandler.ts | 10 ++++++++++ src/handlers/PinchGestureHandler.ts | 10 ++++++++++ src/handlers/RotationGestureHandler.ts | 10 ++++++++++ src/handlers/TapGestureHandler.ts | 10 ++++++++++ 20 files changed, 91 insertions(+), 12 deletions(-) diff --git a/docs/docs/gesture-handlers/about-handlers.md b/docs/docs/gesture-handlers/about-handlers.md index 4f20ddabe5..c67eb59173 100644 --- a/docs/docs/gesture-handlers/about-handlers.md +++ b/docs/docs/gesture-handlers/about-handlers.md @@ -6,7 +6,7 @@ sidebar_position: 1 --- :::warning -Consider using the new [gestures API](/docs/gestures/gesture) instead. The old API is not actively supported and is not receiving the new features. Check out [RNGH 2.0 section in Introduction](/docs/#rngh-20) for more information. +The old API will be removed in the future version of Gesture Handler. Please migrate to [gestures API](/docs/gestures/gesture) instead. Check out our [upgrading guide](/docs/guides/upgrading-to-2) for more information. ::: Gesture handlers are the core building blocks of this library. diff --git a/docs/docs/gesture-handlers/common-gh.md b/docs/docs/gesture-handlers/common-gh.md index ae8d9fe441..58421e27ac 100644 --- a/docs/docs/gesture-handlers/common-gh.md +++ b/docs/docs/gesture-handlers/common-gh.md @@ -6,7 +6,7 @@ sidebar_position: 4 --- :::warning -Consider using the new [gestures API](/docs/gestures/gesture) instead. The old API is not actively supported and is not receiving the new features. Check out [RNGH 2.0 section in Introduction](/docs/#rngh-20) for more information. +The old API will be removed in the future version of Gesture Handler. Please migrate to [gestures API](/docs/gestures/gesture) instead. Check out our [upgrading guide](/docs/guides/upgrading-to-2) for more information. ::: This page covers the common set of properties all gesture handler components expose. diff --git a/docs/docs/gesture-handlers/create-native-wrapper.md b/docs/docs/gesture-handlers/create-native-wrapper.md index 40bdeb0a12..aa84e63b37 100644 --- a/docs/docs/gesture-handlers/create-native-wrapper.md +++ b/docs/docs/gesture-handlers/create-native-wrapper.md @@ -6,7 +6,7 @@ sidebar_position: 13 --- :::warning -Consider using the new [gestures API](/docs/gestures/gesture) instead. The old API is not actively supported and is not receiving the new features. Check out [RNGH 2.0 section in Introduction](/docs/#rngh-20) for more information. +The old API will be removed in the future version of Gesture Handler. Please migrate to [gestures API](/docs/gestures/gesture) instead. Check out our [upgrading guide](/docs/guides/upgrading-to-2) for more information. ::: Creates provided component with NativeViewGestureHandler, allowing it to be part of RNGH's diff --git a/docs/docs/gesture-handlers/fling-gh.md b/docs/docs/gesture-handlers/fling-gh.md index 2709aa6558..baedfc15e1 100644 --- a/docs/docs/gesture-handlers/fling-gh.md +++ b/docs/docs/gesture-handlers/fling-gh.md @@ -6,7 +6,7 @@ sidebar_position: 9 --- :::warning -Consider using the new [gestures API](/docs/gestures/gesture) instead. The old API is not actively supported and is not receiving the new features. Check out [RNGH 2.0 section in Introduction](/docs/#rngh-20) for more information. +The old API will be removed in the future version of Gesture Handler. Please migrate to [gestures API](/docs/gestures/gesture) instead. Check out our [upgrading guide](/docs/guides/upgrading-to-2) for more information. ::: A discrete gesture handler that activates when the movement is sufficiently long and fast. diff --git a/docs/docs/gesture-handlers/force-gh.md b/docs/docs/gesture-handlers/force-gh.md index 62cc74224a..6e23205984 100644 --- a/docs/docs/gesture-handlers/force-gh.md +++ b/docs/docs/gesture-handlers/force-gh.md @@ -6,7 +6,7 @@ sidebar_position: 11 --- :::warning -Consider using the new [gestures API](/docs/gestures/gesture) instead. The old API is not actively supported and is not receiving the new features. Check out [RNGH 2.0 section in Introduction](/docs/#rngh-20) for more information. +The old API will be removed in the future version of Gesture Handler. Please migrate to [gestures API](/docs/gestures/gesture) instead. Check out our [upgrading guide](/docs/guides/upgrading-to-2) for more information. ::: A continuous gesture handler that recognizes force of a touch. It allows for tracking pressure of touch on some iOS devices. diff --git a/docs/docs/gesture-handlers/interactions.md b/docs/docs/gesture-handlers/interactions.md index a6d480507c..64b9636051 100644 --- a/docs/docs/gesture-handlers/interactions.md +++ b/docs/docs/gesture-handlers/interactions.md @@ -6,7 +6,7 @@ sidebar_position: 3 --- :::warning -Consider using the new [gestures API](/docs/gestures/gesture) instead. The old API is not actively supported and is not receiving the new features. Check out [RNGH 2.0 section in Introduction](/docs/#rngh-20) for more information. +The old API will be removed in the future version of Gesture Handler. Please migrate to [gestures API](/docs/gestures/gesture) instead. Check out our [upgrading guide](/docs/guides/upgrading-to-2) for more information. ::: Gesture handlers can "communicate" with each other to support complex gestures and control how they _[activate](/docs/under-the-hood/state#active)_ in certain scenarios. diff --git a/docs/docs/gesture-handlers/longpress-gh.md b/docs/docs/gesture-handlers/longpress-gh.md index bffa54774b..2b2e751b99 100644 --- a/docs/docs/gesture-handlers/longpress-gh.md +++ b/docs/docs/gesture-handlers/longpress-gh.md @@ -6,7 +6,7 @@ sidebar_position: 7 --- :::warning -Consider using the new [gestures API](/docs/gestures/gesture) instead. The old API is not actively supported and is not receiving the new features. Check out [RNGH 2.0 section in Introduction](/docs/#rngh-20) for more information. +The old API will be removed in the future version of Gesture Handler. Please migrate to [gestures API](/docs/gestures/gesture) instead. Check out our [upgrading guide](/docs/guides/upgrading-to-2) for more information. ::: A discrete gesture handler that activates when the corresponding view is pressed for a sufficiently long time. diff --git a/docs/docs/gesture-handlers/nativeview-gh.md b/docs/docs/gesture-handlers/nativeview-gh.md index 01de75e1b5..5c494c9bff 100644 --- a/docs/docs/gesture-handlers/nativeview-gh.md +++ b/docs/docs/gesture-handlers/nativeview-gh.md @@ -6,7 +6,7 @@ sidebar_position: 12 --- :::warning -Consider using the new [gestures API](/docs/gestures/gesture) instead. The old API is not actively supported and is not receiving the new features. Check out [RNGH 2.0 section in Introduction](/docs/#rngh-20) for more information. +The old API will be removed in the future version of Gesture Handler. Please migrate to [gestures API](/docs/gestures/gesture) instead. Check out our [upgrading guide](/docs/guides/upgrading-to-2) for more information. ::: A gesture handler that allows other touch handling components to participate in diff --git a/docs/docs/gesture-handlers/pan-gh.md b/docs/docs/gesture-handlers/pan-gh.md index 05c195e2eb..d70c80cdd0 100644 --- a/docs/docs/gesture-handlers/pan-gh.md +++ b/docs/docs/gesture-handlers/pan-gh.md @@ -6,7 +6,7 @@ sidebar_position: 5 --- :::warning -Consider using the new [gestures API](/docs/gestures/gesture) instead. The old API is not actively supported and is not receiving the new features. Check out [RNGH 2.0 section in Introduction](/docs/#rngh-20) for more information. +The old API will be removed in the future version of Gesture Handler. Please migrate to [gestures API](/docs/gestures/gesture) instead. Check out our [upgrading guide](/docs/guides/upgrading-to-2) for more information. ::: A continuous gesture handler that can recognize a panning (dragging) gesture and track its movement. diff --git a/docs/docs/gesture-handlers/pinch-gh.md b/docs/docs/gesture-handlers/pinch-gh.md index e12e97438d..adf4ae9442 100644 --- a/docs/docs/gesture-handlers/pinch-gh.md +++ b/docs/docs/gesture-handlers/pinch-gh.md @@ -6,7 +6,7 @@ sidebar_position: 10 --- :::warning -Consider using the new [gestures API](/docs/gestures/gesture) instead. The old API is not actively supported and is not receiving the new features. Check out [RNGH 2.0 section in Introduction](/docs/#rngh-20) for more information. +The old API will be removed in the future version of Gesture Handler. Please migrate to [gestures API](/docs/gestures/gesture) instead. Check out our [upgrading guide](/docs/guides/upgrading-to-2) for more information. ::: A continuous gesture handler that recognizes pinch gesture. It allows for tracking the distance between two fingers and use that information to scale or zoom your content. diff --git a/docs/docs/gesture-handlers/rotation-gh.md b/docs/docs/gesture-handlers/rotation-gh.md index 1605c21288..b6b20f931c 100644 --- a/docs/docs/gesture-handlers/rotation-gh.md +++ b/docs/docs/gesture-handlers/rotation-gh.md @@ -6,7 +6,7 @@ sidebar_position: 8 --- :::warning -Consider using the new [gestures API](/docs/gestures/gesture) instead. The old API is not actively supported and is not receiving the new features. Check out [RNGH 2.0 section in Introduction](/docs/#rngh-20) for more information. +The old API will be removed in the future version of Gesture Handler. Please migrate to [gestures API](/docs/gestures/gesture) instead. Check out our [upgrading guide](/docs/guides/upgrading-to-2) for more information. ::: A continuous gesture handler that can recognize a rotation gesture and track its movement. diff --git a/docs/docs/gesture-handlers/tap-gh.md b/docs/docs/gesture-handlers/tap-gh.md index 83eeb74bb6..c151632c03 100644 --- a/docs/docs/gesture-handlers/tap-gh.md +++ b/docs/docs/gesture-handlers/tap-gh.md @@ -6,7 +6,7 @@ sidebar_position: 6 --- :::warning -Consider using the new [gestures API](/docs/gestures/gesture) instead. The old API is not actively supported and is not receiving the new features. Check out [RNGH 2.0 section in Introduction](/docs/#rngh-20) for more information. +The old API will be removed in the future version of Gesture Handler. Please migrate to [gestures API](/docs/gestures/gesture) instead. Check out our [upgrading guide](/docs/guides/upgrading-to-2) for more information. ::: A discrete gesture handler that recognizes one or many taps. diff --git a/src/handlers/FlingGestureHandler.ts b/src/handlers/FlingGestureHandler.ts index a202123dd7..3ef728f7bd 100644 --- a/src/handlers/FlingGestureHandler.ts +++ b/src/handlers/FlingGestureHandler.ts @@ -33,13 +33,23 @@ export interface FlingGestureConfig { numberOfPointers?: number; } +/** + * @deprecated FlingGestureHandler will be removed in the future version of Gesture Handler. Use `Gesture.Fling()` instead. + */ export interface FlingGestureHandlerProps extends BaseGestureHandlerProps, FlingGestureConfig {} export const flingHandlerName = 'FlingGestureHandler'; +/** + * @deprecated FlingGestureHandler will be removed in the future version of Gesture Handler. Use `Gesture.Fling()` instead. + */ export type FlingGestureHandler = typeof FlingGestureHandler; + +/** + * @deprecated FlingGestureHandler will be removed in the future version of Gesture Handler. Use `Gesture.Fling()` instead. + */ // eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; see description on the top of gestureHandlerCommon.ts file export const FlingGestureHandler = createHandler< FlingGestureHandlerProps, diff --git a/src/handlers/ForceTouchGestureHandler.ts b/src/handlers/ForceTouchGestureHandler.ts index 4df1a72fda..3d0fa538fe 100644 --- a/src/handlers/ForceTouchGestureHandler.ts +++ b/src/handlers/ForceTouchGestureHandler.ts @@ -50,16 +50,25 @@ export interface ForceTouchGestureConfig { feedbackOnActivation?: boolean; } +/** + * @deprecated ForceTouchGestureHandler will be removed in the future version of Gesture Handler. Use `Gesture.ForceTouch()` instead. + */ export interface ForceTouchGestureHandlerProps extends BaseGestureHandlerProps, ForceTouchGestureConfig {} +/** + * @deprecated ForceTouchGestureHandler will be removed in the future version of Gesture Handler. Use `Gesture.ForceTouch()` instead. + */ export type ForceTouchGestureHandler = typeof ForceTouchGestureHandler & { forceTouchAvailable: boolean; }; export const forceTouchHandlerName = 'ForceTouchGestureHandler'; +/** + * @deprecated ForceTouchGestureHandler will be removed in the future version of Gesture Handler. Use `Gesture.ForceTouch()` instead. + */ // eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; see description on the top of gestureHandlerCommon.ts file export const ForceTouchGestureHandler = PlatformConstants?.forceTouchAvailable ? createHandler< diff --git a/src/handlers/LongPressGestureHandler.ts b/src/handlers/LongPressGestureHandler.ts index e7b038dac4..b6116e045f 100644 --- a/src/handlers/LongPressGestureHandler.ts +++ b/src/handlers/LongPressGestureHandler.ts @@ -32,13 +32,23 @@ export interface LongPressGestureConfig { numberOfPointers?: number; } +/** + * @deprecated LongPressGestureHandler will be removed in the future version of Gesture Handler. Use `Gesture.LongPress()` instead. + */ export interface LongPressGestureHandlerProps extends BaseGestureHandlerProps, LongPressGestureConfig {} export const longPressHandlerName = 'LongPressGestureHandler'; +/** + * @deprecated LongPressGestureHandler will be removed in the future version of Gesture Handler. Use `Gesture.LongPress()` instead. + */ export type LongPressGestureHandler = typeof LongPressGestureHandler; + +/** + * @deprecated LongPressGestureHandler will be removed in the future version of Gesture Handler. Use `Gesture.LongPress()` instead. + */ // eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; see description on the top of gestureHandlerCommon.ts file export const LongPressGestureHandler = createHandler< LongPressGestureHandlerProps, diff --git a/src/handlers/NativeViewGestureHandler.ts b/src/handlers/NativeViewGestureHandler.ts index f80f90f210..1271e266d0 100644 --- a/src/handlers/NativeViewGestureHandler.ts +++ b/src/handlers/NativeViewGestureHandler.ts @@ -26,6 +26,9 @@ export interface NativeViewGestureConfig { disallowInterruption?: boolean; } +/** + * @deprecated NativeViewGestureHandler will be removed in the future version of Gesture Handler. Use `Gesture.Native()` instead. + */ export interface NativeViewGestureHandlerProps extends BaseGestureHandlerProps, NativeViewGestureConfig {} @@ -37,7 +40,14 @@ export const nativeViewProps = [ export const nativeViewHandlerName = 'NativeViewGestureHandler'; +/** + * @deprecated NativeViewGestureHandler will be removed in the future version of Gesture Handler. Use `Gesture.Native()` instead. + */ export type NativeViewGestureHandler = typeof NativeViewGestureHandler; + +/** + * @deprecated NativeViewGestureHandler will be removed in the future version of Gesture Handler. Use `Gesture.Native()` instead. + */ // eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; see description on the top of gestureHandlerCommon.ts file export const NativeViewGestureHandler = createHandler< NativeViewGestureHandlerProps, diff --git a/src/handlers/PanGestureHandler.ts b/src/handlers/PanGestureHandler.ts index aa86bcb498..c69465adf4 100644 --- a/src/handlers/PanGestureHandler.ts +++ b/src/handlers/PanGestureHandler.ts @@ -82,6 +82,9 @@ export interface PanGestureConfig extends CommonPanProperties { failOffsetXEnd?: number; } +/** + * @deprecated PanGestureHandler will be removed in the future version of Gesture Handler. Use `Gesture.Pan()` instead. + */ export interface PanGestureHandlerProps extends BaseGestureHandlerProps, CommonPanProperties { @@ -132,7 +135,14 @@ export interface PanGestureHandlerProps export const panHandlerName = 'PanGestureHandler'; +/** + * @deprecated PanGestureHandler will be removed in the future version of Gesture Handler. Use `Gesture.Pan()` instead. + */ export type PanGestureHandler = typeof PanGestureHandler; + +/** + * @deprecated PanGestureHandler will be removed in the future version of Gesture Handler. Use `Gesture.Pan()` instead. + */ // eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; see description on the top of gestureHandlerCommon.ts file export const PanGestureHandler = createHandler< PanGestureHandlerProps, diff --git a/src/handlers/PinchGestureHandler.ts b/src/handlers/PinchGestureHandler.ts index a7a7bf9cb6..5d5b4ffd05 100644 --- a/src/handlers/PinchGestureHandler.ts +++ b/src/handlers/PinchGestureHandler.ts @@ -5,12 +5,22 @@ import { baseGestureHandlerProps, } from './gestureHandlerCommon'; +/** + * @deprecated PinchGestureHandler will be removed in the future version of Gesture Handler. Use `Gesture.Pinch()` instead. + */ export interface PinchGestureHandlerProps extends BaseGestureHandlerProps {} export const pinchHandlerName = 'PinchGestureHandler'; +/** + * @deprecated PinchGestureHandler will be removed in the future version of Gesture Handler. Use `Gesture.Pinch()` instead. + */ export type PinchGestureHandler = typeof PinchGestureHandler; + +/** + * @deprecated PinchGestureHandler will be removed in the future version of Gesture Handler. Use `Gesture.Pinch()` instead. + */ // eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; see description on the top of gestureHandlerCommon.ts file export const PinchGestureHandler = createHandler< PinchGestureHandlerProps, diff --git a/src/handlers/RotationGestureHandler.ts b/src/handlers/RotationGestureHandler.ts index d6b35c1ca3..c82eddb38e 100644 --- a/src/handlers/RotationGestureHandler.ts +++ b/src/handlers/RotationGestureHandler.ts @@ -5,12 +5,22 @@ import { baseGestureHandlerProps, } from './gestureHandlerCommon'; +/** + * @deprecated RotationGestureHandler will be removed in the future version of Gesture Handler. Use `Gesture.Rotation()` instead. + */ export interface RotationGestureHandlerProps extends BaseGestureHandlerProps {} export const rotationHandlerName = 'RotationGestureHandler'; +/** + * @deprecated RotationGestureHandler will be removed in the future version of Gesture Handler. Use `Gesture.Rotation()` instead. + */ export type RotationGestureHandler = typeof RotationGestureHandler; + +/** + * @deprecated RotationGestureHandler will be removed in the future version of Gesture Handler. Use `Gesture.Rotation()` instead. + */ // eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; see description on the top of gestureHandlerCommon.ts file export const RotationGestureHandler = createHandler< RotationGestureHandlerProps, diff --git a/src/handlers/TapGestureHandler.ts b/src/handlers/TapGestureHandler.ts index 4fb2e3a615..80307ffec0 100644 --- a/src/handlers/TapGestureHandler.ts +++ b/src/handlers/TapGestureHandler.ts @@ -66,13 +66,23 @@ export interface TapGestureConfig { maxDist?: number; } +/** + * @deprecated TapGestureHandler will be removed in the future version of Gesture Handler. Use `Gesture.Tap()` instead. + */ export interface TapGestureHandlerProps extends BaseGestureHandlerProps, TapGestureConfig {} export const tapHandlerName = 'TapGestureHandler'; +/** + * @deprecated TapGestureHandler will be removed in the future version of Gesture Handler. Use `Gesture.Tap()` instead. + */ export type TapGestureHandler = typeof TapGestureHandler; + +/** + * @deprecated TapGestureHandler will be removed in the future version of Gesture Handler. Use `Gesture.Tap()` instead. + */ // eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; see description on the top of gestureHandlerCommon.ts file export const TapGestureHandler = createHandler< TapGestureHandlerProps,