Skip to content

Commit 3513778

Browse files
m-bertlatekvo
andauthored
Deprecate ForceTouch gesture (#3550)
## Description This PR deprecates `ForceTouch` gesture as it is no longer supported by Apple. ## Test plan Check that `Gesture.ForceTouch` is marked as deprecated <img width="1020" alt="image" src="https://github.com/user-attachments/assets/1bf03106-af23-4dd5-9da7-47fd81b4404e" /> --------- Co-authored-by: Ignacy Łątka <[email protected]>
1 parent 3a5e670 commit 3513778

File tree

5 files changed

+28
-1
lines changed

5 files changed

+28
-1
lines changed

packages/docs-gesture-handler/docs/gestures/force-touch-gesture.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ sidebar_label: Force touch gesture
55
sidebar_position: 10
66
---
77

8+
:::warning
9+
ForceTouch gesture is depracted and will be removed in the future version of Gesture Handler.
10+
:::
11+
812
import BaseEventData from './\_shared/base-gesture-event-data.md';
913
import BaseEventConfig from './\_shared/base-gesture-config.md';
1014
import BaseContinuousEventConfig from './\_shared/base-continuous-gesture-config.md';

packages/react-native-gesture-handler/src/handlers/GestureHandlerEventPayload.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ export type FlingGestureHandlerEventPayload = {
77
absoluteY: number;
88
};
99

10+
/**
11+
* @deprecated ForceTouch gesture is deprecated and will be removed in the future.
12+
*/
1013
export type ForceTouchGestureHandlerEventPayload = {
1114
x: number;
1215
y: number;

packages/react-native-gesture-handler/src/handlers/gestureHandlerTypesCompat.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,14 @@ export type TapGestureHandlerGestureEvent =
4646
export type TapGestureHandlerStateChangeEvent =
4747
HandlerStateChangeEvent<TapGestureHandlerEventPayload>;
4848

49+
/**
50+
* @deprecated ForceTouchGestureHandler is deprecated and will be removed in the future.
51+
*/
4952
export type ForceTouchGestureHandlerGestureEvent =
5053
GestureEvent<ForceTouchGestureHandlerEventPayload>;
54+
/**
55+
* @deprecated ForceTouchGestureHandler is deprecated and will be removed in the future.
56+
*/
5157
export type ForceTouchGestureHandlerStateChangeEvent =
5258
HandlerStateChangeEvent<ForceTouchGestureHandlerEventPayload>;
5359

@@ -84,6 +90,9 @@ export type PanGestureHandlerProperties = PanGestureHandlerProps;
8490
export type PinchGestureHandlerProperties = PinchGestureHandlerProps;
8591
export type RotationGestureHandlerProperties = RotationGestureHandlerProps;
8692
export type FlingGestureHandlerProperties = FlingGestureHandlerProps;
93+
/**
94+
* @deprecated ForceTouch gesture is deprecated and will be removed in the future.
95+
*/
8796
export type ForceTouchGestureHandlerProperties = ForceTouchGestureHandlerProps;
8897
// Button props
8998
export type RawButtonProperties = RawButtonProps;

packages/react-native-gesture-handler/src/handlers/gestures/forceTouchGesture.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ import { ForceTouchGestureConfig } from '../ForceTouchGestureHandler';
33
import type { ForceTouchGestureHandlerEventPayload } from '../GestureHandlerEventPayload';
44
import { GestureUpdateEvent } from '../gestureHandlerCommon';
55

6+
/**
7+
* @deprecated ForceTouch gesture is deprecated and will be removed in the future.
8+
*/
69
export type ForceTouchGestureChangeEventPayload = {
710
forceChange: number;
811
};
@@ -26,6 +29,9 @@ function changeEventCalculator(
2629
return { ...current, ...changePayload };
2730
}
2831

32+
/**
33+
* @deprecated ForceTouch gesture is deprecated and will be removed in the future.
34+
*/
2935
export class ForceTouchGesture extends ContinousBaseGesture<
3036
ForceTouchGestureHandlerEventPayload,
3137
ForceTouchGestureChangeEventPayload
@@ -83,4 +89,7 @@ export class ForceTouchGesture extends ContinousBaseGesture<
8389
}
8490
}
8591

92+
/**
93+
* @deprecated ForceTouch gesture is deprecated and will be removed in the future.
94+
*/
8695
export type ForceTouchGestureType = InstanceType<typeof ForceTouchGesture>;

packages/react-native-gesture-handler/src/handlers/gestures/gestureObjects.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ export const GestureObjects = {
7373
},
7474

7575
/**
76-
* #### iOS only
76+
* @deprecated ForceTouch gesture is deprecated and will be removed in the future.
77+
*
78+
* #### iOS only
7779
* A continuous gesture that recognizes force of a touch. It allows for tracking pressure of touch on some iOS devices.
7880
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/force-touch-gesture
7981
*/

0 commit comments

Comments
 (0)