Skip to content

Commit

Permalink
Migrate next to main (#3303)
Browse files Browse the repository at this point in the history
## Description

This PR migrates changed from [next](https://github.com/software-mansion/react-native-gesture-handler/tree/next) branch into `main`.

## Test plan
Most of those commits are deprecations, to check `get`/`set` run example on web.
  • Loading branch information
m-bert authored Jan 27, 2025
1 parent bb76607 commit ce10992
Showing 49 changed files with 491 additions and 381 deletions.
4 changes: 4 additions & 0 deletions docs/docs/components/touchables.md
Original file line number Diff line number Diff line change
@@ -4,6 +4,10 @@ title: Touchables
sidebar_label: Touchables
---

:::warning
Touchables will be removed in the future version of Gesture Handler.
:::

Gesture Handler library provides an implementation of RN's touchable components that are based on [native buttons](buttons.mdx) and does not rely on JS responder system utilized by RN. Our touchable implementation follows the same API and aims to be a drop-in replacement for touchables available in React Native.

React Native's touchables API can be found here:
2 changes: 1 addition & 1 deletion docs/docs/gesture-handlers/about-handlers.md
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 1 addition & 1 deletion docs/docs/gesture-handlers/common-gh.md
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 1 addition & 1 deletion docs/docs/gesture-handlers/create-native-wrapper.md
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion docs/docs/gesture-handlers/fling-gh.md
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 1 addition & 1 deletion docs/docs/gesture-handlers/force-gh.md
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 1 addition & 1 deletion docs/docs/gesture-handlers/interactions.md
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 1 addition & 1 deletion docs/docs/gesture-handlers/longpress-gh.md
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 1 addition & 1 deletion docs/docs/gesture-handlers/nativeview-gh.md
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion docs/docs/gesture-handlers/pan-gh.md
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 1 addition & 1 deletion docs/docs/gesture-handlers/pinch-gh.md
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 1 addition & 1 deletion docs/docs/gesture-handlers/rotation-gh.md
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 1 addition & 1 deletion docs/docs/gesture-handlers/tap-gh.md
Original file line number Diff line number Diff line change
@@ -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.
4 changes: 2 additions & 2 deletions src/RNGestureHandlerModule.web.ts
Original file line number Diff line number Diff line change
@@ -40,7 +40,7 @@ export default {
handlerTag,
new GestureClass(new GestureHandlerWebDelegate())
);
InteractionManager.getInstance().configureInteractions(
InteractionManager.instance.configureInteractions(
NodeManager.getHandler(handlerTag),
config as unknown as Config
);
@@ -93,7 +93,7 @@ export default {
if (isNewWebImplementationEnabled()) {
NodeManager.getHandler(handlerTag).updateGestureConfig(newConfig);

InteractionManager.getInstance().configureInteractions(
InteractionManager.instance.configureInteractions(
NodeManager.getHandler(handlerTag),
newConfig
);
5 changes: 5 additions & 0 deletions src/components/touchables/TouchableHighlight.tsx
Original file line number Diff line number Diff line change
@@ -19,10 +19,15 @@ interface State {
};
}

/**
* @deprecated TouchableHighlight will be removed in the future version of Gesture Handler.
*/
export type TouchableHighlightProps = RNTouchableHighlightProps &
GenericTouchableProps;

/**
* @deprecated TouchableHighlight will be removed in the future version of Gesture Handler.
*
* TouchableHighlight follows RN's implementation
*/
export default class TouchableHighlight extends Component<
2 changes: 2 additions & 0 deletions src/components/touchables/TouchableNativeFeedback.android.tsx
Original file line number Diff line number Diff line change
@@ -8,6 +8,8 @@ import {
} from './TouchableNativeFeedbackProps';

/**
* @deprecated TouchableNativeFeedback will be removed in the future version of Gesture Handler.
*
* TouchableNativeFeedback behaves slightly different than RN's TouchableNativeFeedback.
* There's small difference with handling long press ripple since RN's implementation calls
* ripple animation via bridge. This solution leaves all animations' handling for native components so
7 changes: 6 additions & 1 deletion src/components/touchables/TouchableNativeFeedback.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
import { TouchableNativeFeedback } from 'react-native';
import { TouchableNativeFeedback as RNTouchableNativeFeedback } from 'react-native';

/**
* @deprecated TouchableNativeFeedback will be removed in the future version of Gesture Handler.
*/
const TouchableNativeFeedback = RNTouchableNativeFeedback;

export default TouchableNativeFeedback;
3 changes: 3 additions & 0 deletions src/components/touchables/TouchableNativeFeedbackProps.tsx
Original file line number Diff line number Diff line change
@@ -8,5 +8,8 @@ export type TouchableNativeFeedbackExtraProps = {
foreground?: boolean;
};

/**
* @deprecated TouchableNativeFeedback will be removed in the future version of Gesture Handler.
*/
export type TouchableNativeFeedbackProps = RNTouchableNativeFeedbackProps &
GenericTouchableProps;
5 changes: 5 additions & 0 deletions src/components/touchables/TouchableOpacity.tsx
Original file line number Diff line number Diff line change
@@ -10,12 +10,17 @@ import type { GenericTouchableProps } from './GenericTouchableProps';
import * as React from 'react';
import { Component } from 'react';

/**
* @deprecated TouchableOpacity will be removed in the future version of Gesture Handler.
*/
export type TouchableOpacityProps = RNTouchableOpacityProps &
GenericTouchableProps & {
useNativeAnimations?: boolean;
};

/**
* @deprecated TouchableOpacity will be removed in the future version of Gesture Handler.
*
* TouchableOpacity bases on timing animation which has been used in RN's core
*/
export default class TouchableOpacity extends Component<TouchableOpacityProps> {
6 changes: 6 additions & 0 deletions src/components/touchables/TouchableWithoutFeedback.tsx
Original file line number Diff line number Diff line change
@@ -3,8 +3,14 @@ import { PropsWithChildren } from 'react';
import GenericTouchable from './GenericTouchable';
import type { GenericTouchableProps } from './GenericTouchableProps';

/**
* @deprecated TouchableWithoutFeedback will be removed in the future version of Gesture Handler.
*/
export type TouchableWithoutFeedbackProps = GenericTouchableProps;

/**
* @deprecated TouchableWithoutFeedback will be removed in the future version of Gesture Handler.
*/
const TouchableWithoutFeedback = React.forwardRef<
GenericTouchable,
PropsWithChildren<TouchableWithoutFeedbackProps>
10 changes: 10 additions & 0 deletions src/handlers/FlingGestureHandler.ts
Original file line number Diff line number Diff line change
@@ -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,
9 changes: 9 additions & 0 deletions src/handlers/ForceTouchGestureHandler.ts
Original file line number Diff line number Diff line change
@@ -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<
10 changes: 10 additions & 0 deletions src/handlers/LongPressGestureHandler.ts
Original file line number Diff line number Diff line change
@@ -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,
10 changes: 10 additions & 0 deletions src/handlers/NativeViewGestureHandler.ts
Original file line number Diff line number Diff line change
@@ -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 {}
@@ -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,
10 changes: 10 additions & 0 deletions src/handlers/PanGestureHandler.ts
Original file line number Diff line number Diff line change
@@ -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 {
@@ -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,
10 changes: 10 additions & 0 deletions src/handlers/PinchGestureHandler.ts
Original file line number Diff line number Diff line change
@@ -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,
10 changes: 10 additions & 0 deletions src/handlers/RotationGestureHandler.ts
Original file line number Diff line number Diff line change
@@ -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,
Loading

0 comments on commit ce10992

Please sign in to comment.