Skip to content

Commit

Permalink
Deprecate old API (#3262)
Browse files Browse the repository at this point in the history
## Description

This PR deprecates old Gesture Handler API.

## Test plan

Try importing any handler from old API.
  • Loading branch information
m-bert committed Dec 20, 2024
1 parent 1561c53 commit 61aaef9
Show file tree
Hide file tree
Showing 20 changed files with 91 additions and 12 deletions.
2 changes: 1 addition & 1 deletion docs/docs/gesture-handlers/about-handlers.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/gesture-handlers/common-gh.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/gesture-handlers/create-native-wrapper.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/gesture-handlers/fling-gh.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/gesture-handlers/force-gh.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/gesture-handlers/interactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/gesture-handlers/longpress-gh.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/gesture-handlers/nativeview-gh.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/gesture-handlers/pan-gh.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/gesture-handlers/pinch-gh.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/gesture-handlers/rotation-gh.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/gesture-handlers/tap-gh.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
10 changes: 10 additions & 0 deletions src/handlers/FlingGestureHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<FlingGestureHandlerEventPayload>,
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,
Expand Down
9 changes: 9 additions & 0 deletions src/handlers/ForceTouchGestureHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<ForceTouchGestureHandlerEventPayload>,
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<
Expand Down
10 changes: 10 additions & 0 deletions src/handlers/LongPressGestureHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<LongPressGestureHandlerEventPayload>,
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,
Expand Down
10 changes: 10 additions & 0 deletions src/handlers/NativeViewGestureHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<NativeViewGestureHandlerPayload>,
NativeViewGestureConfig {}
Expand All @@ -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,
Expand Down
10 changes: 10 additions & 0 deletions src/handlers/PanGestureHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<PanGestureHandlerEventPayload>,
CommonPanProperties {
Expand Down Expand Up @@ -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,
Expand Down
10 changes: 10 additions & 0 deletions src/handlers/PinchGestureHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<PinchGestureHandlerEventPayload> {}

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,
Expand Down
10 changes: 10 additions & 0 deletions src/handlers/RotationGestureHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<RotationGestureHandlerEventPayload> {}

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,
Expand Down
10 changes: 10 additions & 0 deletions src/handlers/TapGestureHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<TapGestureHandlerEventPayload>,
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,
Expand Down

0 comments on commit 61aaef9

Please sign in to comment.