react-native-gesture-handler 2.21.2 → 2.22.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -3
- package/android/build.gradle +10 -0
- package/android/paper/src/main/java/com/facebook/react/viewmanagers/RNGestureHandlerButtonManagerDelegate.java +3 -2
- package/android/paper/src/main/java/com/facebook/react/viewmanagers/RNGestureHandlerRootViewManagerDelegate.java +3 -2
- package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandler.kt +16 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt +1 -1
- package/android/src/main/java/com/swmansion/gesturehandler/core/NativeViewGestureHandler.kt +45 -8
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt +18 -0
- package/apple/Handlers/RNFlingHandler.m +0 -1
- package/apple/Handlers/RNForceTouchHandler.m +0 -1
- package/apple/Handlers/RNLongPressHandler.m +0 -1
- package/apple/Handlers/RNManualHandler.m +0 -1
- package/apple/Handlers/RNPanHandler.m +0 -3
- package/apple/Handlers/RNPinchHandler.m +0 -1
- package/apple/Handlers/RNRotationHandler.m +0 -1
- package/apple/Handlers/RNTapHandler.m +0 -1
- package/apple/RNGestureHandlerButton.h +1 -0
- package/apple/RNGestureHandlerButton.mm +51 -0
- package/apple/RNGestureHandlerManager.mm +6 -1
- package/apple/RNManualActivationRecognizer.m +1 -0
- package/lib/commonjs/ActionType.js.map +1 -1
- package/lib/commonjs/Directions.js.map +1 -1
- package/lib/commonjs/EnableNewWebImplementation.js +14 -1
- package/lib/commonjs/EnableNewWebImplementation.js.map +1 -1
- package/lib/commonjs/State.js.map +1 -1
- package/lib/commonjs/TouchEventType.js.map +1 -1
- package/lib/commonjs/components/Pressable/Pressable.js +1 -1
- package/lib/commonjs/components/Pressable/Pressable.js.map +1 -1
- package/lib/commonjs/components/ReanimatedSwipeable.js.map +1 -1
- package/lib/commonjs/components/Swipeable.js.map +1 -1
- package/lib/commonjs/components/Text.js +61 -0
- package/lib/commonjs/components/Text.js.map +1 -0
- package/lib/commonjs/components/touchables/GenericTouchable.js.map +1 -1
- package/lib/commonjs/getShadowNodeFromRef.js +10 -2
- package/lib/commonjs/getShadowNodeFromRef.js.map +1 -1
- package/lib/commonjs/ghQueueMicrotask.js.map +1 -1
- package/lib/commonjs/handlers/createHandler.js +12 -0
- package/lib/commonjs/handlers/createHandler.js.map +1 -1
- package/lib/commonjs/handlers/gestureHandlerCommon.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/attachHandlers.js +4 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/attachHandlers.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/dropHandlers.js +4 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/dropHandlers.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/index.js +3 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/index.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/useMountReactions.js +48 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/useMountReactions.js.map +1 -0
- package/lib/commonjs/handlers/gestures/gesture.js.map +1 -1
- package/lib/commonjs/handlers/utils.js +1 -0
- package/lib/commonjs/handlers/utils.js.map +1 -1
- package/lib/commonjs/index.js +8 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/jestUtils/jestUtils.js.map +1 -1
- package/lib/commonjs/mountRegistry.js +49 -0
- package/lib/commonjs/mountRegistry.js.map +1 -0
- package/lib/commonjs/web/detectors/ScaleGestureDetector.js.map +1 -1
- package/lib/commonjs/web/handlers/FlingGestureHandler.js +0 -4
- package/lib/commonjs/web/handlers/FlingGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/GestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/HoverGestureHandler.js +0 -14
- package/lib/commonjs/web/handlers/HoverGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/ManualGestureHandler.js +0 -14
- package/lib/commonjs/web/handlers/ManualGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/NativeViewGestureHandler.js +3 -5
- package/lib/commonjs/web/handlers/NativeViewGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/PanGestureHandler.js +0 -4
- package/lib/commonjs/web/handlers/PanGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/PinchGestureHandler.js +0 -10
- package/lib/commonjs/web/handlers/PinchGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/RotationGestureHandler.js +0 -14
- package/lib/commonjs/web/handlers/RotationGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/TapGestureHandler.js +0 -4
- package/lib/commonjs/web/handlers/TapGestureHandler.js.map +1 -1
- package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js.map +1 -1
- package/lib/commonjs/web_hammer/GestureHandler.js.map +1 -1
- package/lib/commonjs/web_hammer/PressGestureHandler.js.map +1 -1
- package/lib/module/ActionType.js.map +1 -1
- package/lib/module/Directions.js.map +1 -1
- package/lib/module/EnableNewWebImplementation.js +14 -1
- package/lib/module/EnableNewWebImplementation.js.map +1 -1
- package/lib/module/State.js.map +1 -1
- package/lib/module/TouchEventType.js.map +1 -1
- package/lib/module/components/Pressable/Pressable.js +1 -1
- package/lib/module/components/Pressable/Pressable.js.map +1 -1
- package/lib/module/components/ReanimatedSwipeable.js.map +1 -1
- package/lib/module/components/Swipeable.js.map +1 -1
- package/lib/module/components/Text.js +44 -0
- package/lib/module/components/Text.js.map +1 -0
- package/lib/module/components/touchables/GenericTouchable.js.map +1 -1
- package/lib/module/getShadowNodeFromRef.js +10 -2
- package/lib/module/getShadowNodeFromRef.js.map +1 -1
- package/lib/module/ghQueueMicrotask.js.map +1 -1
- package/lib/module/handlers/createHandler.js +11 -0
- package/lib/module/handlers/createHandler.js.map +1 -1
- package/lib/module/handlers/gestureHandlerCommon.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/attachHandlers.js +3 -0
- package/lib/module/handlers/gestures/GestureDetector/attachHandlers.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/dropHandlers.js +2 -0
- package/lib/module/handlers/gestures/GestureDetector/dropHandlers.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/index.js +2 -0
- package/lib/module/handlers/gestures/GestureDetector/index.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/useMountReactions.js +39 -0
- package/lib/module/handlers/gestures/GestureDetector/useMountReactions.js.map +1 -0
- package/lib/module/handlers/gestures/gesture.js.map +1 -1
- package/lib/module/handlers/utils.js +1 -3
- package/lib/module/handlers/utils.js.map +1 -1
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/jestUtils/jestUtils.js.map +1 -1
- package/lib/module/mountRegistry.js +40 -0
- package/lib/module/mountRegistry.js.map +1 -0
- package/lib/module/web/detectors/ScaleGestureDetector.js.map +1 -1
- package/lib/module/web/handlers/FlingGestureHandler.js +0 -4
- package/lib/module/web/handlers/FlingGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/GestureHandler.js.map +1 -1
- package/lib/module/web/handlers/HoverGestureHandler.js +0 -14
- package/lib/module/web/handlers/HoverGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/ManualGestureHandler.js +0 -14
- package/lib/module/web/handlers/ManualGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/NativeViewGestureHandler.js +3 -5
- package/lib/module/web/handlers/NativeViewGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/PanGestureHandler.js +0 -4
- package/lib/module/web/handlers/PanGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/PinchGestureHandler.js +0 -10
- package/lib/module/web/handlers/PinchGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/RotationGestureHandler.js +0 -14
- package/lib/module/web/handlers/RotationGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/TapGestureHandler.js +0 -4
- package/lib/module/web/handlers/TapGestureHandler.js.map +1 -1
- package/lib/module/web/tools/GestureHandlerWebDelegate.js.map +1 -1
- package/lib/module/web_hammer/GestureHandler.js.map +1 -1
- package/lib/module/web_hammer/PressGestureHandler.js.map +1 -1
- package/lib/typescript/ActionType.d.ts +1 -1
- package/lib/typescript/Directions.d.ts +2 -2
- package/lib/typescript/EnableNewWebImplementation.d.ts +6 -0
- package/lib/typescript/State.d.ts +1 -1
- package/lib/typescript/TouchEventType.d.ts +1 -1
- package/lib/typescript/components/GestureButtonsProps.d.ts +2 -2
- package/lib/typescript/components/Text.d.ts +4 -0
- package/lib/typescript/components/touchables/GenericTouchable.d.ts +1 -1
- package/lib/typescript/handlers/GestureHandlerEventPayload.d.ts +2 -2
- package/lib/typescript/handlers/gestures/GestureDetector/useMountReactions.d.ts +2 -0
- package/lib/typescript/handlers/gestures/gesture.d.ts +1 -1
- package/lib/typescript/handlers/utils.d.ts +1 -0
- package/lib/typescript/index.d.ts +1 -0
- package/lib/typescript/mocks.d.ts +3 -3
- package/lib/typescript/mountRegistry.d.ts +17 -0
- package/lib/typescript/web/handlers/FlingGestureHandler.d.ts +0 -2
- package/lib/typescript/web/handlers/HoverGestureHandler.d.ts +1 -4
- package/lib/typescript/web/handlers/ManualGestureHandler.d.ts +1 -4
- package/lib/typescript/web/handlers/NativeViewGestureHandler.d.ts +0 -1
- package/lib/typescript/web/handlers/PanGestureHandler.d.ts +0 -2
- package/lib/typescript/web/handlers/PinchGestureHandler.d.ts +1 -2
- package/lib/typescript/web/handlers/RotationGestureHandler.d.ts +1 -3
- package/lib/typescript/web/handlers/TapGestureHandler.d.ts +0 -2
- package/package.json +16 -17
- package/src/ActionType.ts +1 -1
- package/src/Directions.ts +2 -2
- package/src/EnableNewWebImplementation.ts +18 -0
- package/src/State.ts +1 -1
- package/src/TouchEventType.ts +2 -1
- package/src/components/GestureButtonsProps.ts +4 -2
- package/src/components/Pressable/Pressable.tsx +3 -3
- package/src/components/ReanimatedSwipeable.tsx +8 -8
- package/src/components/Swipeable.tsx +4 -4
- package/src/components/Text.tsx +60 -0
- package/src/components/touchables/GenericTouchable.tsx +1 -1
- package/src/getShadowNodeFromRef.ts +8 -2
- package/src/ghQueueMicrotask.ts +2 -2
- package/src/handlers/GestureHandlerEventPayload.ts +2 -2
- package/src/handlers/createHandler.tsx +14 -1
- package/src/handlers/gestureHandlerCommon.ts +3 -3
- package/src/handlers/gestures/GestureDetector/attachHandlers.ts +3 -0
- package/src/handlers/gestures/GestureDetector/dropHandlers.ts +3 -0
- package/src/handlers/gestures/GestureDetector/index.tsx +3 -0
- package/src/handlers/gestures/GestureDetector/useMountReactions.ts +51 -0
- package/src/handlers/gestures/gesture.ts +3 -3
- package/src/handlers/utils.ts +2 -1
- package/src/index.ts +1 -0
- package/src/jestUtils/jestUtils.ts +10 -12
- package/src/mountRegistry.ts +51 -0
- package/src/web/detectors/ScaleGestureDetector.ts +1 -1
- package/src/web/handlers/FlingGestureHandler.ts +0 -4
- package/src/web/handlers/GestureHandler.ts +1 -3
- package/src/web/handlers/HoverGestureHandler.ts +1 -9
- package/src/web/handlers/ManualGestureHandler.ts +1 -9
- package/src/web/handlers/NativeViewGestureHandler.ts +5 -5
- package/src/web/handlers/PanGestureHandler.ts +0 -4
- package/src/web/handlers/PinchGestureHandler.ts +1 -5
- package/src/web/handlers/RotationGestureHandler.ts +1 -9
- package/src/web/handlers/TapGestureHandler.ts +0 -4
- package/src/web/tools/GestureHandlerWebDelegate.ts +4 -4
- package/src/web_hammer/GestureHandler.ts +1 -1
- package/src/web_hammer/PressGestureHandler.ts +7 -4
- package/android/src/main/java/com/swmansion/gesturehandler/RNGestureHandlerPackage.kt +0 -86
|
@@ -2,5 +2,6 @@ import * as React from 'react';
|
|
|
2
2
|
export declare function filterConfig(props: Record<string, unknown>, validProps: string[], defaults?: Record<string, unknown>): {
|
|
3
3
|
[x: string]: unknown;
|
|
4
4
|
};
|
|
5
|
+
export declare function transformIntoHandlerTags(handlerIDs: any): any;
|
|
5
6
|
export declare function findNodeHandle(node: null | number | React.Component<any, any> | React.ComponentClass<any>): null | number | React.Component<any, any> | React.ComponentClass<any>;
|
|
6
7
|
export declare function scheduleFlushOperations(): void;
|
|
@@ -46,6 +46,7 @@ export { RawButton, BaseButton, RectButton, BorderlessButton, PureNativeButton,
|
|
|
46
46
|
export type { TouchableHighlightProps, TouchableOpacityProps, TouchableWithoutFeedbackProps, } from './components/touchables';
|
|
47
47
|
export { TouchableHighlight, TouchableNativeFeedback, TouchableOpacity, TouchableWithoutFeedback, } from './components/touchables';
|
|
48
48
|
export { ScrollView, Switch, TextInput, DrawerLayoutAndroid, FlatList, RefreshControl, } from './components/GestureComponents';
|
|
49
|
+
export { Text } from './components/Text';
|
|
49
50
|
export { HoverEffect } from './handlers/gestures/hoverGesture';
|
|
50
51
|
export type { GestureHandlerGestureEvent, GestureHandlerStateChangeEvent, GestureHandlerGestureEventNativeEvent, GestureHandlerStateChangeNativeEvent, NativeViewGestureHandlerGestureEvent, NativeViewGestureHandlerStateChangeEvent, TapGestureHandlerGestureEvent, TapGestureHandlerStateChangeEvent, ForceTouchGestureHandlerGestureEvent, ForceTouchGestureHandlerStateChangeEvent, LongPressGestureHandlerGestureEvent, LongPressGestureHandlerStateChangeEvent, PanGestureHandlerGestureEvent, PanGestureHandlerStateChangeEvent, PinchGestureHandlerGestureEvent, PinchGestureHandlerStateChangeEvent, RotationGestureHandlerGestureEvent, RotationGestureHandlerStateChangeEvent, FlingGestureHandlerGestureEvent, FlingGestureHandlerStateChangeEvent, NativeViewGestureHandlerProperties, TapGestureHandlerProperties, LongPressGestureHandlerProperties, PanGestureHandlerProperties, PinchGestureHandlerProperties, RotationGestureHandlerProperties, FlingGestureHandlerProperties, ForceTouchGestureHandlerProperties, RawButtonProperties, BaseButtonProperties, RectButtonProperties, BorderlessButtonProperties, } from './handlers/gestureHandlerTypesCompat';
|
|
51
52
|
export type { SwipeableProps } from './components/Swipeable';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { TouchableNativeFeedback, TouchableWithoutFeedback, ScrollView, FlatList, Switch, TextInput, DrawerLayoutAndroid, View } from 'react-native';
|
|
3
3
|
declare const _default: {
|
|
4
|
-
readonly TouchableHighlight:
|
|
4
|
+
readonly TouchableHighlight: React.ForwardRefExoticComponent<import("react-native").TouchableHighlightProps & React.RefAttributes<View>>;
|
|
5
5
|
readonly TouchableNativeFeedback: typeof TouchableNativeFeedback;
|
|
6
|
-
readonly TouchableOpacity:
|
|
6
|
+
readonly TouchableOpacity: React.ForwardRefExoticComponent<import("react-native").TouchableOpacityProps & React.RefAttributes<View>>;
|
|
7
7
|
readonly TouchableWithoutFeedback: typeof TouchableWithoutFeedback;
|
|
8
8
|
readonly ScrollView: typeof ScrollView;
|
|
9
9
|
readonly FlatList: typeof FlatList;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { GestureType } from './handlers/gestures/gesture';
|
|
3
|
+
interface ReactComponentWithHandlerTag extends React.Component {
|
|
4
|
+
handlerTag: number;
|
|
5
|
+
}
|
|
6
|
+
export type GestureMountListener = (gesture: GestureType | ReactComponentWithHandlerTag) => void;
|
|
7
|
+
export declare class MountRegistry {
|
|
8
|
+
private static mountListeners;
|
|
9
|
+
private static unmountListeners;
|
|
10
|
+
static addMountListener(listener: GestureMountListener): () => void;
|
|
11
|
+
static addUnmountListener(listener: GestureMountListener): () => void;
|
|
12
|
+
static gestureHandlerWillMount(handler: React.Component): void;
|
|
13
|
+
static gestureHandlerWillUnmount(handler: React.Component): void;
|
|
14
|
+
static gestureWillMount(gesture: GestureType): void;
|
|
15
|
+
static gestureWillUnmount(gesture: GestureType): void;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { AdaptedEvent, Config } from '../interfaces';
|
|
3
2
|
import GestureHandler from './GestureHandler';
|
|
4
3
|
export default class FlingGestureHandler extends GestureHandler {
|
|
@@ -9,7 +8,6 @@ export default class FlingGestureHandler extends GestureHandler {
|
|
|
9
8
|
private delayTimeout;
|
|
10
9
|
private maxNumberOfPointersSimultaneously;
|
|
11
10
|
private keyPointer;
|
|
12
|
-
init(ref: number, propsRef: React.RefObject<unknown>): void;
|
|
13
11
|
updateGestureConfig({ enabled, ...props }: Config): void;
|
|
14
12
|
private startFling;
|
|
15
13
|
private tryEndFling;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
import { AdaptedEvent, Config } from '../interfaces';
|
|
1
|
+
import { AdaptedEvent } from '../interfaces';
|
|
3
2
|
import GestureHandler from './GestureHandler';
|
|
4
3
|
export default class HoverGestureHandler extends GestureHandler {
|
|
5
4
|
private stylusData;
|
|
6
|
-
init(ref: number, propsRef: React.RefObject<unknown>): void;
|
|
7
5
|
protected transformNativeEvent(): Record<string, unknown>;
|
|
8
|
-
updateGestureConfig({ enabled, ...props }: Config): void;
|
|
9
6
|
protected onPointerMoveOver(event: AdaptedEvent): void;
|
|
10
7
|
protected onPointerMoveOut(event: AdaptedEvent): void;
|
|
11
8
|
protected onPointerMove(event: AdaptedEvent): void;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import { AdaptedEvent, Config } from '../interfaces';
|
|
1
|
+
import { AdaptedEvent } from '../interfaces';
|
|
3
2
|
import GestureHandler from './GestureHandler';
|
|
4
3
|
export default class ManualGestureHandler extends GestureHandler {
|
|
5
|
-
init(ref: number, propsRef: React.RefObject<unknown>): void;
|
|
6
|
-
updateGestureConfig({ enabled, ...props }: Config): void;
|
|
7
4
|
protected onPointerDown(event: AdaptedEvent): void;
|
|
8
5
|
protected onPointerAdd(event: AdaptedEvent): void;
|
|
9
6
|
protected onPointerMove(event: AdaptedEvent): void;
|
|
@@ -11,7 +11,6 @@ export default class NativeViewGestureHandler extends GestureHandler {
|
|
|
11
11
|
init(ref: number, propsRef: React.RefObject<unknown>): void;
|
|
12
12
|
updateGestureConfig({ enabled, ...props }: Config): void;
|
|
13
13
|
private restoreViewStyles;
|
|
14
|
-
protected resetConfig(): void;
|
|
15
14
|
protected onPointerDown(event: AdaptedEvent): void;
|
|
16
15
|
protected onPointerAdd(event: AdaptedEvent): void;
|
|
17
16
|
private newPointerAction;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { AdaptedEvent, Config, StylusData } from '../interfaces';
|
|
3
2
|
import GestureHandler from './GestureHandler';
|
|
4
3
|
export default class PanGestureHandler extends GestureHandler {
|
|
@@ -31,7 +30,6 @@ export default class PanGestureHandler extends GestureHandler {
|
|
|
31
30
|
private enableTrackpadTwoFingerGesture;
|
|
32
31
|
private endWheelTimeout;
|
|
33
32
|
private wheelDevice;
|
|
34
|
-
init(ref: number, propsRef: React.RefObject<unknown>): void;
|
|
35
33
|
updateGestureConfig({ enabled, ...props }: Config): void;
|
|
36
34
|
protected resetConfig(): void;
|
|
37
35
|
protected transformNativeEvent(): {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { AdaptedEvent
|
|
2
|
+
import { AdaptedEvent } from '../interfaces';
|
|
3
3
|
import GestureHandler from './GestureHandler';
|
|
4
4
|
export default class PinchGestureHandler extends GestureHandler {
|
|
5
5
|
private scale;
|
|
@@ -9,7 +9,6 @@ export default class PinchGestureHandler extends GestureHandler {
|
|
|
9
9
|
private scaleDetectorListener;
|
|
10
10
|
private scaleGestureDetector;
|
|
11
11
|
init(ref: number, propsRef: React.RefObject<unknown>): void;
|
|
12
|
-
updateGestureConfig({ enabled, ...props }: Config): void;
|
|
13
12
|
protected transformNativeEvent(): {
|
|
14
13
|
focalX: number;
|
|
15
14
|
focalY: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { AdaptedEvent
|
|
2
|
+
import { AdaptedEvent } from '../interfaces';
|
|
3
3
|
import GestureHandler from './GestureHandler';
|
|
4
4
|
export default class RotationGestureHandler extends GestureHandler {
|
|
5
5
|
private rotation;
|
|
@@ -9,7 +9,6 @@ export default class RotationGestureHandler extends GestureHandler {
|
|
|
9
9
|
private rotationGestureListener;
|
|
10
10
|
private rotationGestureDetector;
|
|
11
11
|
init(ref: number, propsRef: React.RefObject<unknown>): void;
|
|
12
|
-
updateGestureConfig({ enabled, ...props }: Config): void;
|
|
13
12
|
protected transformNativeEvent(): {
|
|
14
13
|
rotation: number;
|
|
15
14
|
anchorX: number;
|
|
@@ -25,6 +24,5 @@ export default class RotationGestureHandler extends GestureHandler {
|
|
|
25
24
|
protected onPointerUp(event: AdaptedEvent): void;
|
|
26
25
|
protected onPointerRemove(event: AdaptedEvent): void;
|
|
27
26
|
protected tryBegin(): void;
|
|
28
|
-
activate(_force?: boolean): void;
|
|
29
27
|
protected onReset(): void;
|
|
30
28
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { AdaptedEvent, Config } from '../interfaces';
|
|
3
2
|
import GestureHandler from './GestureHandler';
|
|
4
3
|
export default class TapGestureHandler extends GestureHandler {
|
|
@@ -19,7 +18,6 @@ export default class TapGestureHandler extends GestureHandler {
|
|
|
19
18
|
private waitTimeout;
|
|
20
19
|
private delayTimeout;
|
|
21
20
|
private tapsSoFar;
|
|
22
|
-
init(ref: number, propsRef: React.RefObject<unknown>): void;
|
|
23
21
|
updateGestureConfig({ enabled, ...props }: Config): void;
|
|
24
22
|
protected resetConfig(): void;
|
|
25
23
|
private clearTimeouts;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-gesture-handler",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.22.0-rc.1",
|
|
4
4
|
"description": "Declarative API exposing native platform touch and gesture system to React Native",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"prepare": "bob build && husky install",
|
|
@@ -66,44 +66,38 @@
|
|
|
66
66
|
"dependencies": {
|
|
67
67
|
"@egjs/hammerjs": "^2.0.17",
|
|
68
68
|
"hoist-non-react-statics": "^3.3.0",
|
|
69
|
-
"invariant": "^2.2.4"
|
|
70
|
-
"prop-types": "^15.7.2"
|
|
69
|
+
"invariant": "^2.2.4"
|
|
71
70
|
},
|
|
72
71
|
"devDependencies": {
|
|
73
|
-
"@babel/core": "^7.
|
|
74
|
-
"@babel/
|
|
75
|
-
"@babel/preset-env": "^7.12.11",
|
|
72
|
+
"@babel/core": "^7.25.2",
|
|
73
|
+
"@babel/preset-env": "^7.25.3",
|
|
76
74
|
"@babel/preset-typescript": "^7.12.7",
|
|
77
|
-
"@babel
|
|
78
|
-
"@react-native/babel-preset": "^0.74.85",
|
|
79
|
-
"@testing-library/jest-native": "^5.4.3",
|
|
75
|
+
"@react-native/babel-preset": "0.77.0-rc.3",
|
|
80
76
|
"@testing-library/react-native": "^12.5.1",
|
|
81
|
-
"@types/hammerjs": "^2.0.38",
|
|
82
77
|
"@types/hoist-non-react-statics": "^3.3.1",
|
|
78
|
+
"@types/invariant": "^2.2.37",
|
|
83
79
|
"@types/jest": "^27.0.3",
|
|
84
80
|
"@types/react": "^18.2.6",
|
|
85
81
|
"@types/react-test-renderer": "^17.0.0",
|
|
86
82
|
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
|
87
83
|
"@typescript-eslint/parser": "^4.33.0",
|
|
88
|
-
"babel-
|
|
84
|
+
"babel-plugin-module-resolver": "^5.0.2",
|
|
89
85
|
"clang-format": "^1.8.0",
|
|
90
86
|
"eslint": "^7.32.0",
|
|
91
87
|
"eslint-config-satya164": "^3.1.8",
|
|
92
88
|
"eslint-import-resolver-babel-module": "^5.2.0",
|
|
93
|
-
"eslint-plugin-import": "^2.22.1",
|
|
94
89
|
"eslint-plugin-jest": "^26.0.0",
|
|
90
|
+
"eslint-plugin-prettier": "^5.2.1",
|
|
95
91
|
"expo": "^35.0.1",
|
|
96
92
|
"husky": "^8.0.1",
|
|
97
93
|
"jest": "^28.1.0",
|
|
98
94
|
"lint-staged": "^12.3.2",
|
|
99
95
|
"madge": "^6.1.0",
|
|
100
|
-
"prettier": "
|
|
101
|
-
"react": "18.
|
|
102
|
-
"react-
|
|
103
|
-
"react-native": "0.74.3",
|
|
96
|
+
"prettier": "3.3.3",
|
|
97
|
+
"react": "18.3.1",
|
|
98
|
+
"react-native": "0.77.0-rc.3",
|
|
104
99
|
"react-native-builder-bob": "^0.17.1",
|
|
105
100
|
"react-native-reanimated": "^3.12.0",
|
|
106
|
-
"react-native-web": "^0.11.7",
|
|
107
101
|
"react-test-renderer": "18.2.0",
|
|
108
102
|
"release-it": "^13.6.5",
|
|
109
103
|
"typescript": "5.0.4"
|
|
@@ -150,6 +144,11 @@
|
|
|
150
144
|
"jsSrcsDir": "./src/specs",
|
|
151
145
|
"android": {
|
|
152
146
|
"javaPackageName": "com.swmansion.gesturehandler"
|
|
147
|
+
},
|
|
148
|
+
"ios": {
|
|
149
|
+
"componentProvider": {
|
|
150
|
+
"RNGestureHandlerButton": "RNGestureHandlerButtonComponentView"
|
|
151
|
+
}
|
|
153
152
|
}
|
|
154
153
|
},
|
|
155
154
|
"packageManager": "yarn@1.22.22"
|
package/src/ActionType.ts
CHANGED
|
@@ -6,4 +6,4 @@ export const ActionType = {
|
|
|
6
6
|
} as const;
|
|
7
7
|
|
|
8
8
|
// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; it can be used as a type and as a value
|
|
9
|
-
export type ActionType = typeof ActionType[keyof typeof ActionType];
|
|
9
|
+
export type ActionType = (typeof ActionType)[keyof typeof ActionType];
|
package/src/Directions.ts
CHANGED
|
@@ -20,7 +20,7 @@ export const DiagonalDirections = {
|
|
|
20
20
|
} as const;
|
|
21
21
|
|
|
22
22
|
// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; it can be used as a type and as a value
|
|
23
|
-
export type Directions = typeof Directions[keyof typeof Directions];
|
|
23
|
+
export type Directions = (typeof Directions)[keyof typeof Directions];
|
|
24
24
|
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
25
25
|
export type DiagonalDirections =
|
|
26
|
-
typeof DiagonalDirections[keyof typeof DiagonalDirections];
|
|
26
|
+
(typeof DiagonalDirections)[keyof typeof DiagonalDirections];
|
|
@@ -1,17 +1,35 @@
|
|
|
1
1
|
import { Platform } from 'react-native';
|
|
2
|
+
import { tagMessage } from './utils';
|
|
2
3
|
|
|
3
4
|
let useNewWebImplementation = true;
|
|
4
5
|
let getWasCalled = false;
|
|
5
6
|
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated new web implementation is enabled by default. This function will be removed in Gesture Handler 3
|
|
9
|
+
*/
|
|
6
10
|
export function enableExperimentalWebImplementation(
|
|
7
11
|
_shouldEnable = true
|
|
8
12
|
): void {
|
|
9
13
|
// NO-OP since the new implementation is now the default
|
|
14
|
+
console.warn(
|
|
15
|
+
tagMessage(
|
|
16
|
+
'New web implementation is enabled by default. This function will be removed in Gesture Handler 3.'
|
|
17
|
+
)
|
|
18
|
+
);
|
|
10
19
|
}
|
|
11
20
|
|
|
21
|
+
/**
|
|
22
|
+
* @deprecated legacy implementation is no longer supported. This function will be removed in Gesture Handler 3
|
|
23
|
+
*/
|
|
12
24
|
export function enableLegacyWebImplementation(
|
|
13
25
|
shouldUseLegacyImplementation = true
|
|
14
26
|
): void {
|
|
27
|
+
console.warn(
|
|
28
|
+
tagMessage(
|
|
29
|
+
'Legacy web implementation is deprecated. This function will be removed in Gesture Handler 3.'
|
|
30
|
+
)
|
|
31
|
+
);
|
|
32
|
+
|
|
15
33
|
if (
|
|
16
34
|
Platform.OS !== 'web' ||
|
|
17
35
|
useNewWebImplementation === !shouldUseLegacyImplementation
|
package/src/State.ts
CHANGED
|
@@ -10,4 +10,4 @@ export const State = {
|
|
|
10
10
|
} as const;
|
|
11
11
|
|
|
12
12
|
// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; it can be used as a type and as a value
|
|
13
|
-
export type State = typeof State[keyof typeof State];
|
|
13
|
+
export type State = (typeof State)[keyof typeof State];
|
package/src/TouchEventType.ts
CHANGED
|
@@ -7,4 +7,5 @@ export const TouchEventType = {
|
|
|
7
7
|
} as const;
|
|
8
8
|
|
|
9
9
|
// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; it can be used as a type and as a value
|
|
10
|
-
export type TouchEventType =
|
|
10
|
+
export type TouchEventType =
|
|
11
|
+
(typeof TouchEventType)[keyof typeof TouchEventType];
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { StyleProp, ViewStyle } from 'react-native';
|
|
2
|
+
import { AccessibilityProps, StyleProp, ViewStyle } from 'react-native';
|
|
3
3
|
import type { NativeViewGestureHandlerProps } from '../handlers/NativeViewGestureHandler';
|
|
4
4
|
|
|
5
|
-
export interface RawButtonProps
|
|
5
|
+
export interface RawButtonProps
|
|
6
|
+
extends NativeViewGestureHandlerProps,
|
|
7
|
+
AccessibilityProps {
|
|
6
8
|
/**
|
|
7
9
|
* Defines if more than one button could be pressed simultaneously. By default
|
|
8
10
|
* set true.
|
|
@@ -58,7 +58,7 @@ export default function Pressable(props: PressableProps) {
|
|
|
58
58
|
|
|
59
59
|
const normalizedHitSlop: Insets = useMemo(
|
|
60
60
|
() =>
|
|
61
|
-
typeof hitSlop === 'number' ? numberAsInset(hitSlop) : hitSlop ?? {},
|
|
61
|
+
typeof hitSlop === 'number' ? numberAsInset(hitSlop) : (hitSlop ?? {}),
|
|
62
62
|
[hitSlop]
|
|
63
63
|
);
|
|
64
64
|
|
|
@@ -66,7 +66,7 @@ export default function Pressable(props: PressableProps) {
|
|
|
66
66
|
() =>
|
|
67
67
|
typeof pressRetentionOffset === 'number'
|
|
68
68
|
? numberAsInset(pressRetentionOffset)
|
|
69
|
-
: pressRetentionOffset ?? {},
|
|
69
|
+
: (pressRetentionOffset ?? {}),
|
|
70
70
|
[pressRetentionOffset]
|
|
71
71
|
);
|
|
72
72
|
|
|
@@ -352,7 +352,7 @@ export default function Pressable(props: PressableProps) {
|
|
|
352
352
|
|
|
353
353
|
const isPressableEnabled = disabled !== true;
|
|
354
354
|
|
|
355
|
-
const gestures = [pressAndTouchGesture, hoverGesture
|
|
355
|
+
const gestures = [buttonGesture, pressAndTouchGesture, hoverGesture];
|
|
356
356
|
|
|
357
357
|
for (const gesture of gestures) {
|
|
358
358
|
gesture.enabled(isPressableEnabled);
|
|
@@ -280,8 +280,8 @@ const Swipeable = forwardRef<SwipeableMethods, SwipeableProps>(
|
|
|
280
280
|
rowState.value === 1
|
|
281
281
|
? leftWidth.value
|
|
282
282
|
: rowState.value === -1
|
|
283
|
-
|
|
284
|
-
|
|
283
|
+
? -rightWidth.value
|
|
284
|
+
: 0;
|
|
285
285
|
|
|
286
286
|
const offsetDrag = userDrag.value / friction + startOffset;
|
|
287
287
|
|
|
@@ -387,8 +387,8 @@ const Swipeable = forwardRef<SwipeableMethods, SwipeableProps>(
|
|
|
387
387
|
? rightWidth.value
|
|
388
388
|
: leftWidth.value
|
|
389
389
|
: moveToRight
|
|
390
|
-
|
|
391
|
-
|
|
390
|
+
? leftWidth.value
|
|
391
|
+
: rightWidth.value;
|
|
392
392
|
|
|
393
393
|
const progressSpringConfig = {
|
|
394
394
|
...translationSpringConfig,
|
|
@@ -614,10 +614,10 @@ const Swipeable = forwardRef<SwipeableMethods, SwipeableProps>(
|
|
|
614
614
|
rowState.value === -1
|
|
615
615
|
? SwipeDirection.RIGHT
|
|
616
616
|
: rowState.value === 1
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
617
|
+
? SwipeDirection.LEFT
|
|
618
|
+
: event.translationX > 0
|
|
619
|
+
? SwipeDirection.RIGHT
|
|
620
|
+
: SwipeDirection.LEFT;
|
|
621
621
|
|
|
622
622
|
if (!dragStarted.value) {
|
|
623
623
|
dragStarted.value = true;
|
|
@@ -362,10 +362,10 @@ export default class Swipeable extends Component<
|
|
|
362
362
|
rowState === -1
|
|
363
363
|
? 'right'
|
|
364
364
|
: rowState === 1
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
365
|
+
? 'left'
|
|
366
|
+
: translationX > 0
|
|
367
|
+
? 'left'
|
|
368
|
+
: 'right';
|
|
369
369
|
|
|
370
370
|
if (rowState === 0) {
|
|
371
371
|
this.props.onSwipeableOpenStartDrag?.(direction);
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React, {
|
|
2
|
+
ForwardedRef,
|
|
3
|
+
forwardRef,
|
|
4
|
+
RefObject,
|
|
5
|
+
useEffect,
|
|
6
|
+
useRef,
|
|
7
|
+
} from 'react';
|
|
8
|
+
import {
|
|
9
|
+
Platform,
|
|
10
|
+
Text as RNText,
|
|
11
|
+
TextProps as RNTextProps,
|
|
12
|
+
} from 'react-native';
|
|
13
|
+
|
|
14
|
+
import { Gesture, GestureDetector } from '../';
|
|
15
|
+
|
|
16
|
+
export const Text = forwardRef(
|
|
17
|
+
(props: RNTextProps, ref: ForwardedRef<RNText>) => {
|
|
18
|
+
const { onPress, ...rest } = props;
|
|
19
|
+
const textRef = useRef<RNText | null>(null);
|
|
20
|
+
const native = Gesture.Native().runOnJS(true);
|
|
21
|
+
|
|
22
|
+
const refHandler = (node: any) => {
|
|
23
|
+
textRef.current = node;
|
|
24
|
+
|
|
25
|
+
if (ref === null) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (typeof ref === 'function') {
|
|
30
|
+
ref(node);
|
|
31
|
+
} else {
|
|
32
|
+
ref.current = node;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
if (Platform.OS !== 'web') {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const textElement = ref
|
|
42
|
+
? (ref as RefObject<RNText>).current
|
|
43
|
+
: textRef.current;
|
|
44
|
+
|
|
45
|
+
// At this point we are sure that textElement is div in HTML tree
|
|
46
|
+
(textElement as unknown as HTMLDivElement)?.setAttribute(
|
|
47
|
+
'rnghtext',
|
|
48
|
+
'true'
|
|
49
|
+
);
|
|
50
|
+
}, []);
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<GestureDetector gesture={native}>
|
|
54
|
+
<RNText onPress={onPress} ref={refHandler} {...rest} />
|
|
55
|
+
</GestureDetector>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
60
|
+
export type Text = typeof Text & RNText;
|
|
@@ -26,7 +26,7 @@ export const TOUCHABLE_STATE = {
|
|
|
26
26
|
MOVED_OUTSIDE: 2,
|
|
27
27
|
} as const;
|
|
28
28
|
|
|
29
|
-
type TouchableState = typeof TOUCHABLE_STATE[keyof typeof TOUCHABLE_STATE];
|
|
29
|
+
type TouchableState = (typeof TOUCHABLE_STATE)[keyof typeof TOUCHABLE_STATE];
|
|
30
30
|
|
|
31
31
|
interface InternalProps {
|
|
32
32
|
extraButtonProps: TouchableNativeFeedbackExtraProps;
|
|
@@ -11,10 +11,16 @@ export function getShadowNodeFromRef(ref: unknown) {
|
|
|
11
11
|
// Load findHostInstance_DEPRECATED lazily because it may not be available before render
|
|
12
12
|
if (findHostInstance_DEPRECATED === undefined) {
|
|
13
13
|
try {
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-unsafe-assignment
|
|
15
|
+
const ReactFabric = require('react-native/Libraries/Renderer/shims/ReactFabric');
|
|
16
|
+
// Since RN 0.77 ReactFabric exports findHostInstance_DEPRECATED in default object so we're trying to
|
|
17
|
+
// access it first, then fallback on named export
|
|
14
18
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
15
19
|
findHostInstance_DEPRECATED =
|
|
16
|
-
// eslint-disable-next-line @typescript-eslint/no-
|
|
17
|
-
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
21
|
+
ReactFabric?.default?.findHostInstance_DEPRECATED ||
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
23
|
+
ReactFabric?.findHostInstance_DEPRECATED;
|
|
18
24
|
} catch (e) {
|
|
19
25
|
findHostInstance_DEPRECATED = (_ref: unknown) => null;
|
|
20
26
|
}
|
package/src/ghQueueMicrotask.ts
CHANGED
|
@@ -4,5 +4,5 @@ export const ghQueueMicrotask =
|
|
|
4
4
|
typeof setImmediate === 'function'
|
|
5
5
|
? setImmediate.bind(null)
|
|
6
6
|
: typeof requestAnimationFrame === 'function'
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
? requestAnimationFrame.bind(null)
|
|
8
|
+
: queueMicrotask.bind(null);
|
|
@@ -126,7 +126,7 @@ export type PanGestureHandlerEventPayload = {
|
|
|
126
126
|
/**
|
|
127
127
|
* Object containing additional stylus data.
|
|
128
128
|
*/
|
|
129
|
-
stylusData
|
|
129
|
+
stylusData?: StylusData;
|
|
130
130
|
};
|
|
131
131
|
|
|
132
132
|
export type PinchGestureHandlerEventPayload = {
|
|
@@ -222,5 +222,5 @@ export type HoverGestureHandlerEventPayload = {
|
|
|
222
222
|
/**
|
|
223
223
|
* Object containing additional stylus data.
|
|
224
224
|
*/
|
|
225
|
-
stylusData
|
|
225
|
+
stylusData?: StylusData;
|
|
226
226
|
};
|
|
@@ -24,6 +24,7 @@ import { ActionType } from '../ActionType';
|
|
|
24
24
|
import { PressabilityDebugView } from './PressabilityDebugView';
|
|
25
25
|
import GestureHandlerRootViewContext from '../GestureHandlerRootViewContext';
|
|
26
26
|
import { ghQueueMicrotask } from '../ghQueueMicrotask';
|
|
27
|
+
import { MountRegistry } from '../mountRegistry';
|
|
27
28
|
|
|
28
29
|
const UIManagerAny = UIManager as any;
|
|
29
30
|
|
|
@@ -160,7 +161,7 @@ const UNRESOLVED_REFS_RETRY_LIMIT = 1;
|
|
|
160
161
|
// TODO(TS) - make sure that BaseGestureHandlerProps doesn't need other generic parameter to work with custom properties.
|
|
161
162
|
export default function createHandler<
|
|
162
163
|
T extends BaseGestureHandlerProps<U>,
|
|
163
|
-
U extends Record<string, unknown
|
|
164
|
+
U extends Record<string, unknown>,
|
|
164
165
|
>({
|
|
165
166
|
name,
|
|
166
167
|
allowedProps = [],
|
|
@@ -234,6 +235,12 @@ export default function createHandler<
|
|
|
234
235
|
)
|
|
235
236
|
);
|
|
236
237
|
|
|
238
|
+
if (!this.viewNode) {
|
|
239
|
+
throw new Error(
|
|
240
|
+
`[Gesture Handler] Failed to obtain view for ${Handler.displayName}. Note that old API doesn't support functional components.`
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
|
|
237
244
|
this.attachGestureHandler(findNodeHandle(this.viewNode) as number); // TODO(TS) - check if this can be null
|
|
238
245
|
}
|
|
239
246
|
|
|
@@ -256,6 +263,8 @@ export default function createHandler<
|
|
|
256
263
|
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
|
257
264
|
delete handlerIDToTag[handlerID];
|
|
258
265
|
}
|
|
266
|
+
|
|
267
|
+
MountRegistry.gestureHandlerWillUnmount(this);
|
|
259
268
|
}
|
|
260
269
|
|
|
261
270
|
private onGestureHandlerEvent = (event: GestureEvent<U>) => {
|
|
@@ -367,6 +376,10 @@ export default function createHandler<
|
|
|
367
376
|
}
|
|
368
377
|
|
|
369
378
|
scheduleFlushOperations();
|
|
379
|
+
|
|
380
|
+
ghQueueMicrotask(() => {
|
|
381
|
+
MountRegistry.gestureHandlerWillMount(this);
|
|
382
|
+
});
|
|
370
383
|
};
|
|
371
384
|
|
|
372
385
|
private updateGestureHandler = (
|
|
@@ -142,7 +142,7 @@ export interface GestureEvent<ExtraEventPayloadT = Record<string, unknown>> {
|
|
|
142
142
|
nativeEvent: Readonly<GestureEventPayload & ExtraEventPayloadT>;
|
|
143
143
|
}
|
|
144
144
|
export interface HandlerStateChangeEvent<
|
|
145
|
-
ExtraEventPayloadT = Record<string, unknown
|
|
145
|
+
ExtraEventPayloadT = Record<string, unknown>,
|
|
146
146
|
> {
|
|
147
147
|
nativeEvent: Readonly<HandlerStateChangeEventPayload & ExtraEventPayloadT>;
|
|
148
148
|
}
|
|
@@ -169,7 +169,7 @@ export type GestureUpdateEvent<GestureEventPayloadT = Record<string, unknown>> =
|
|
|
169
169
|
GestureEventPayload & GestureEventPayloadT;
|
|
170
170
|
|
|
171
171
|
export type GestureStateChangeEvent<
|
|
172
|
-
GestureStateChangeEventPayloadT = Record<string, unknown
|
|
172
|
+
GestureStateChangeEventPayloadT = Record<string, unknown>,
|
|
173
173
|
> = HandlerStateChangeEventPayload & GestureStateChangeEventPayloadT;
|
|
174
174
|
|
|
175
175
|
export type CommonGestureConfig = {
|
|
@@ -186,7 +186,7 @@ export type CommonGestureConfig = {
|
|
|
186
186
|
// Events payloads are types instead of interfaces due to TS limitation.
|
|
187
187
|
// See https://github.com/microsoft/TypeScript/issues/15300 for more info.
|
|
188
188
|
export type BaseGestureHandlerProps<
|
|
189
|
-
ExtraEventPayloadT extends Record<string, unknown> = Record<string, unknown
|
|
189
|
+
ExtraEventPayloadT extends Record<string, unknown> = Record<string, unknown>,
|
|
190
190
|
> = CommonGestureConfig & {
|
|
191
191
|
id?: string;
|
|
192
192
|
waitFor?: React.Ref<unknown> | React.Ref<unknown>[];
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
checkGestureCallbacksForWorklets,
|
|
15
15
|
ALLOWED_PROPS,
|
|
16
16
|
} from './utils';
|
|
17
|
+
import { MountRegistry } from '../../../mountRegistry';
|
|
17
18
|
|
|
18
19
|
interface AttachHandlersConfig {
|
|
19
20
|
preparedGesture: AttachedGestureState;
|
|
@@ -93,6 +94,8 @@ export function attachHandlers({
|
|
|
93
94
|
actionType
|
|
94
95
|
);
|
|
95
96
|
}
|
|
97
|
+
|
|
98
|
+
MountRegistry.gestureWillMount(gesture);
|
|
96
99
|
}
|
|
97
100
|
|
|
98
101
|
preparedGesture.attachedGestures = gesturesToAttach;
|
|
@@ -2,12 +2,15 @@ import { unregisterHandler } from '../../handlersRegistry';
|
|
|
2
2
|
import RNGestureHandlerModule from '../../../RNGestureHandlerModule';
|
|
3
3
|
import { scheduleFlushOperations } from '../../utils';
|
|
4
4
|
import { AttachedGestureState } from './types';
|
|
5
|
+
import { MountRegistry } from '../../../mountRegistry';
|
|
5
6
|
|
|
6
7
|
export function dropHandlers(preparedGesture: AttachedGestureState) {
|
|
7
8
|
for (const handler of preparedGesture.attachedGestures) {
|
|
8
9
|
RNGestureHandlerModule.dropGestureHandler(handler.handlerTag);
|
|
9
10
|
|
|
10
11
|
unregisterHandler(handler.handlerTag, handler.config.testId);
|
|
12
|
+
|
|
13
|
+
MountRegistry.gestureWillUnmount(handler);
|
|
11
14
|
}
|
|
12
15
|
|
|
13
16
|
scheduleFlushOperations();
|