react-native-gesture-handler 2.13.3 → 2.14.0
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/RNGestureHandler.podspec +19 -25
- package/android/build.gradle +3 -2
- package/android/gradle.properties +2 -2
- package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt +36 -72
- package/android/src/main/java/com/swmansion/gesturehandler/react/Extensions.kt +1 -1
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt +13 -9
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEvent.kt +12 -14
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerInteractionManager.kt +8 -1
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.kt +34 -88
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootView.kt +1 -1
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerStateChangeEvent.kt +18 -12
- package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/FlingGestureHandlerEventDataBuilder.kt +30 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/GestureHandlerEventDataBuilder.kt +22 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/HoverGestureHandlerEventDataBuilder.kt +30 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/LongPressGestureHandlerEventDataBuilder.kt +33 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/ManualGestureHandlerEventDataBuilder.kt +5 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/NativeGestureHandlerEventDataBuilder.kt +18 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/PanGestureHandlerEventDataBuilder.kt +42 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/PinchGestureHandlerEventDataBuilder.kt +30 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/RotationGestureHandlerEventDataBuilder.kt +30 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/TapGestureHandlerEventDataBuilder.kt +30 -0
- package/android/src/main/jni/CMakeLists.txt +14 -2
- package/ios/Handlers/RNHoverHandler.m +15 -14
- package/ios/RNGestureHandler.m +11 -0
- package/ios/RNGestureHandlerButtonComponentView.mm +2 -0
- package/lib/commonjs/components/touchables/TouchableNativeFeedback.android.js +1 -1
- package/lib/commonjs/components/touchables/TouchableNativeFeedback.android.js.map +1 -1
- package/lib/commonjs/getReactNativeVersion.js +22 -0
- package/lib/commonjs/getReactNativeVersion.js.map +1 -0
- package/lib/commonjs/getReactNativeVersion.web.js +11 -0
- package/lib/commonjs/getReactNativeVersion.web.js.map +1 -0
- package/lib/commonjs/handlers/gestureHandlerCommon.js +1 -1
- package/lib/commonjs/handlers/gestureHandlerCommon.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector.js +13 -3
- package/lib/commonjs/handlers/gestures/GestureDetector.js.map +1 -1
- package/lib/commonjs/handlers/gestures/gesture.js +8 -0
- package/lib/commonjs/handlers/gestures/gesture.js.map +1 -1
- package/lib/commonjs/utils.js +0 -13
- package/lib/commonjs/utils.js.map +1 -1
- package/lib/commonjs/web/handlers/GestureHandler.js.map +1 -1
- package/lib/commonjs/web/interfaces.js.map +1 -1
- package/lib/commonjs/web/tools/GestureHandlerOrchestrator.js +4 -15
- package/lib/commonjs/web/tools/GestureHandlerOrchestrator.js.map +1 -1
- package/lib/commonjs/web/tools/InteractionManager.js +27 -29
- package/lib/commonjs/web/tools/InteractionManager.js.map +1 -1
- package/lib/commonjs/web/tools/PointerEventManager.js +11 -3
- package/lib/commonjs/web/tools/PointerEventManager.js.map +1 -1
- package/lib/module/components/touchables/TouchableNativeFeedback.android.js +1 -1
- package/lib/module/components/touchables/TouchableNativeFeedback.android.js.map +1 -1
- package/lib/module/getReactNativeVersion.js +10 -0
- package/lib/module/getReactNativeVersion.js.map +1 -0
- package/lib/module/getReactNativeVersion.web.js +4 -0
- package/lib/module/getReactNativeVersion.web.js.map +1 -0
- package/lib/module/handlers/gestureHandlerCommon.js +1 -1
- package/lib/module/handlers/gestureHandlerCommon.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector.js +12 -3
- package/lib/module/handlers/gestures/GestureDetector.js.map +1 -1
- package/lib/module/handlers/gestures/gesture.js +8 -0
- package/lib/module/handlers/gestures/gesture.js.map +1 -1
- package/lib/module/utils.js +0 -6
- package/lib/module/utils.js.map +1 -1
- package/lib/module/web/handlers/GestureHandler.js.map +1 -1
- package/lib/module/web/interfaces.js.map +1 -1
- package/lib/module/web/tools/GestureHandlerOrchestrator.js +4 -15
- package/lib/module/web/tools/GestureHandlerOrchestrator.js.map +1 -1
- package/lib/module/web/tools/InteractionManager.js +27 -29
- package/lib/module/web/tools/InteractionManager.js.map +1 -1
- package/lib/module/web/tools/PointerEventManager.js +11 -3
- package/lib/module/web/tools/PointerEventManager.js.map +1 -1
- package/lib/typescript/ActionType.d.ts +1 -1
- package/lib/typescript/Directions.d.ts +1 -1
- package/lib/typescript/PlatformConstants.d.ts +1 -1
- package/lib/typescript/RNGestureHandlerModule.d.ts +1 -1
- package/lib/typescript/State.d.ts +1 -1
- package/lib/typescript/TouchEventType.d.ts +1 -1
- package/lib/typescript/components/DrawerLayout.d.ts +9 -9
- package/lib/typescript/components/GestureButtons.d.ts +3 -3
- package/lib/typescript/components/GestureComponents.d.ts +6 -6
- package/lib/typescript/components/GestureComponents.web.d.ts +1 -1
- package/lib/typescript/components/GestureHandlerRootView.android.d.ts +2 -1
- package/lib/typescript/components/GestureHandlerRootView.d.ts +2 -1
- package/lib/typescript/components/GestureHandlerRootView.web.d.ts +2 -1
- package/lib/typescript/components/Swipeable.d.ts +4 -4
- package/lib/typescript/components/touchables/GenericTouchable.d.ts +4 -3
- package/lib/typescript/components/touchables/TouchableHighlight.d.ts +4 -3
- package/lib/typescript/components/touchables/TouchableNativeFeedback.android.d.ts +7 -6
- package/lib/typescript/components/touchables/TouchableOpacity.d.ts +3 -2
- package/lib/typescript/components/touchables/TouchableWithoutFeedback.d.ts +1 -1
- package/lib/typescript/getReactNativeVersion.d.ts +4 -0
- package/lib/typescript/getReactNativeVersion.web.d.ts +1 -0
- package/lib/typescript/handlers/FlingGestureHandler.d.ts +2 -2
- package/lib/typescript/handlers/ForceTouchGestureHandler.d.ts +2 -2
- package/lib/typescript/handlers/LongPressGestureHandler.d.ts +2 -2
- package/lib/typescript/handlers/NativeViewGestureHandler.d.ts +3 -3
- package/lib/typescript/handlers/PanGestureHandler.d.ts +2 -2
- package/lib/typescript/handlers/PinchGestureHandler.d.ts +2 -2
- package/lib/typescript/handlers/RotationGestureHandler.d.ts +2 -2
- package/lib/typescript/handlers/TapGestureHandler.d.ts +2 -2
- package/lib/typescript/handlers/createHandler.d.ts +1 -1
- package/lib/typescript/handlers/gestureHandlerCommon.d.ts +11 -10
- package/lib/typescript/handlers/gestureHandlerTypesCompat.d.ts +32 -32
- package/lib/typescript/handlers/gestures/GestureDetector.d.ts +2 -2
- package/lib/typescript/handlers/gestures/flingGesture.d.ts +1 -1
- package/lib/typescript/handlers/gestures/forceTouchGesture.d.ts +2 -2
- package/lib/typescript/handlers/gestures/gesture.d.ts +7 -5
- package/lib/typescript/handlers/gestures/gestureComposition.d.ts +4 -4
- package/lib/typescript/handlers/gestures/hoverGesture.d.ts +3 -3
- package/lib/typescript/handlers/gestures/longPressGesture.d.ts +1 -1
- package/lib/typescript/handlers/gestures/manualGesture.d.ts +1 -1
- package/lib/typescript/handlers/gestures/nativeGesture.d.ts +1 -1
- package/lib/typescript/handlers/gestures/panGesture.d.ts +2 -2
- package/lib/typescript/handlers/gestures/pinchGesture.d.ts +2 -2
- package/lib/typescript/handlers/gestures/rotationGesture.d.ts +2 -2
- package/lib/typescript/handlers/gestures/tapGesture.d.ts +1 -1
- package/lib/typescript/jestUtils/jestUtils.d.ts +6 -6
- package/lib/typescript/typeUtils.d.ts +1 -1
- package/lib/typescript/utils.d.ts +1 -5
- package/lib/typescript/web/interfaces.d.ts +4 -3
- package/lib/typescript/web/tools/GestureHandlerOrchestrator.d.ts +0 -1
- package/lib/typescript/web/tools/InteractionManager.d.ts +2 -1
- package/lib/typescript/web_hammer/GestureHandler.d.ts +2 -2
- package/package.json +7 -7
- package/src/components/touchables/TouchableNativeFeedback.android.tsx +2 -1
- package/src/getReactNativeVersion.ts +11 -0
- package/src/getReactNativeVersion.web.ts +3 -0
- package/src/handlers/gestureHandlerCommon.ts +6 -1
- package/src/handlers/gestures/GestureDetector.tsx +9 -6
- package/src/handlers/gestures/gesture.ts +9 -1
- package/src/utils.ts +0 -8
- package/src/web/handlers/GestureHandler.ts +1 -1
- package/src/web/interfaces.ts +1 -0
- package/src/web/tools/GestureHandlerOrchestrator.ts +4 -13
- package/src/web/tools/InteractionManager.ts +37 -30
- package/src/web/tools/PointerEventManager.ts +12 -3
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEventDataExtractor.kt +0 -8
- /package/android/{src/fabric → fabric/src/main}/java/com/swmansion/gesturehandler/RNGestureHandlerComponentsRegistry.java +0 -0
- /package/android/{src/fabric → fabric/src/main}/java/com/swmansion/gesturehandler/ReactContextExtensions.kt +0 -0
- /package/android/{src/paper → paper/src/main}/java/com/facebook/react/viewmanagers/RNGestureHandlerButtonManagerDelegate.java +0 -0
- /package/android/{src/paper → paper/src/main}/java/com/facebook/react/viewmanagers/RNGestureHandlerButtonManagerInterface.java +0 -0
- /package/android/{src/paper → paper/src/main}/java/com/facebook/react/viewmanagers/RNGestureHandlerRootViewManagerDelegate.java +0 -0
- /package/android/{src/paper → paper/src/main}/java/com/facebook/react/viewmanagers/RNGestureHandlerRootViewManagerInterface.java +0 -0
- /package/android/{src/paper → paper/src/main}/java/com/swmansion/gesturehandler/ReactContextExtensions.kt +0 -0
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { State } from '../State';
|
|
3
3
|
import { TouchEventType } from '../TouchEventType';
|
|
4
4
|
import { ValueOf } from '../typeUtils';
|
|
5
|
-
export declare const baseGestureHandlerProps: readonly ["id", "enabled", "shouldCancelWhenOutside", "hitSlop", "cancelsTouchesInView", "userSelect", "activeCursor", "waitFor", "simultaneousHandlers", "onBegan", "onFailed", "onCancelled", "onActivated", "onEnded", "onGestureEvent", "onHandlerStateChange"];
|
|
5
|
+
export declare const baseGestureHandlerProps: readonly ["id", "enabled", "shouldCancelWhenOutside", "hitSlop", "cancelsTouchesInView", "userSelect", "activeCursor", "waitFor", "simultaneousHandlers", "blocksHandlers", "onBegan", "onFailed", "onCancelled", "onActivated", "onEnded", "onGestureEvent", "onHandlerStateChange"];
|
|
6
6
|
export declare const baseGestureHandlerWithMonitorProps: string[];
|
|
7
7
|
export interface GestureEventPayload {
|
|
8
8
|
handlerTag: number;
|
|
@@ -12,23 +12,23 @@ export interface GestureEventPayload {
|
|
|
12
12
|
export interface HandlerStateChangeEventPayload extends GestureEventPayload {
|
|
13
13
|
oldState: ValueOf<typeof State>;
|
|
14
14
|
}
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export
|
|
15
|
+
export type HitSlop = number | Partial<Record<'left' | 'right' | 'top' | 'bottom' | 'vertical' | 'horizontal', number>> | Record<'width' | 'left', number> | Record<'width' | 'right', number> | Record<'height' | 'top', number> | Record<'height' | 'bottom', number>;
|
|
16
|
+
export type UserSelect = 'none' | 'auto' | 'text';
|
|
17
|
+
export type ActiveCursor = 'auto' | 'default' | 'none' | 'context-menu' | 'help' | 'pointer' | 'progress' | 'wait' | 'cell' | 'crosshair' | 'text' | 'vertical-text' | 'alias' | 'copy' | 'move' | 'no-drop' | 'not-allowed' | 'grab' | 'grabbing' | 'e-resize' | 'n-resize' | 'ne-resize' | 'nw-resize' | 's-resize' | 'se-resize' | 'sw-resize' | 'w-resize' | 'ew-resize' | 'ns-resize' | 'nesw-resize' | 'nwse-resize' | 'col-resize' | 'row-resize' | 'all-scroll' | 'zoom-in' | 'zoom-out';
|
|
18
18
|
export interface GestureEvent<ExtraEventPayloadT = Record<string, unknown>> {
|
|
19
19
|
nativeEvent: Readonly<GestureEventPayload & ExtraEventPayloadT>;
|
|
20
20
|
}
|
|
21
21
|
export interface HandlerStateChangeEvent<ExtraEventPayloadT = Record<string, unknown>> {
|
|
22
22
|
nativeEvent: Readonly<HandlerStateChangeEventPayload & ExtraEventPayloadT>;
|
|
23
23
|
}
|
|
24
|
-
export
|
|
24
|
+
export type TouchData = {
|
|
25
25
|
id: number;
|
|
26
26
|
x: number;
|
|
27
27
|
y: number;
|
|
28
28
|
absoluteX: number;
|
|
29
29
|
absoluteY: number;
|
|
30
30
|
};
|
|
31
|
-
export
|
|
31
|
+
export type GestureTouchEvent = {
|
|
32
32
|
handlerTag: number;
|
|
33
33
|
numberOfTouches: number;
|
|
34
34
|
state: ValueOf<typeof State>;
|
|
@@ -36,19 +36,20 @@ export declare type GestureTouchEvent = {
|
|
|
36
36
|
allTouches: TouchData[];
|
|
37
37
|
changedTouches: TouchData[];
|
|
38
38
|
};
|
|
39
|
-
export
|
|
40
|
-
export
|
|
41
|
-
export
|
|
39
|
+
export type GestureUpdateEvent<GestureEventPayloadT = Record<string, unknown>> = GestureEventPayload & GestureEventPayloadT;
|
|
40
|
+
export type GestureStateChangeEvent<GestureStateChangeEventPayloadT = Record<string, unknown>> = HandlerStateChangeEventPayload & GestureStateChangeEventPayloadT;
|
|
41
|
+
export type CommonGestureConfig = {
|
|
42
42
|
enabled?: boolean;
|
|
43
43
|
shouldCancelWhenOutside?: boolean;
|
|
44
44
|
hitSlop?: HitSlop;
|
|
45
45
|
userSelect?: UserSelect;
|
|
46
46
|
activeCursor?: ActiveCursor;
|
|
47
47
|
};
|
|
48
|
-
export
|
|
48
|
+
export type BaseGestureHandlerProps<ExtraEventPayloadT extends Record<string, unknown> = Record<string, unknown>> = CommonGestureConfig & {
|
|
49
49
|
id?: string;
|
|
50
50
|
waitFor?: React.Ref<unknown> | React.Ref<unknown>[];
|
|
51
51
|
simultaneousHandlers?: React.Ref<unknown> | React.Ref<unknown>[];
|
|
52
|
+
blocksHandlers?: React.Ref<unknown> | React.Ref<unknown>[];
|
|
52
53
|
testID?: string;
|
|
53
54
|
cancelsTouchesInView?: boolean;
|
|
54
55
|
onBegan?: (event: HandlerStateChangeEvent) => void;
|
|
@@ -8,35 +8,35 @@ import { PinchGestureHandlerEventPayload, PinchGestureHandlerProps } from './Pin
|
|
|
8
8
|
import { RotationGestureHandlerEventPayload, RotationGestureHandlerProps } from './RotationGestureHandler';
|
|
9
9
|
import { TapGestureHandlerEventPayload, TapGestureHandlerProps } from './TapGestureHandler';
|
|
10
10
|
import { NativeViewGestureHandlerPayload, NativeViewGestureHandlerProps } from './NativeViewGestureHandler';
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export
|
|
18
|
-
export
|
|
19
|
-
export
|
|
20
|
-
export
|
|
21
|
-
export
|
|
22
|
-
export
|
|
23
|
-
export
|
|
24
|
-
export
|
|
25
|
-
export
|
|
26
|
-
export
|
|
27
|
-
export
|
|
28
|
-
export
|
|
29
|
-
export
|
|
30
|
-
export
|
|
31
|
-
export
|
|
32
|
-
export
|
|
33
|
-
export
|
|
34
|
-
export
|
|
35
|
-
export
|
|
36
|
-
export
|
|
37
|
-
export
|
|
38
|
-
export
|
|
39
|
-
export
|
|
40
|
-
export
|
|
41
|
-
export
|
|
42
|
-
export
|
|
11
|
+
export type GestureHandlerGestureEventNativeEvent = GestureEventPayload;
|
|
12
|
+
export type GestureHandlerStateChangeNativeEvent = HandlerStateChangeEventPayload;
|
|
13
|
+
export type GestureHandlerGestureEvent = GestureEvent;
|
|
14
|
+
export type GestureHandlerStateChangeEvent = HandlerStateChangeEvent;
|
|
15
|
+
export type NativeViewGestureHandlerGestureEvent = GestureEvent<NativeViewGestureHandlerPayload>;
|
|
16
|
+
export type NativeViewGestureHandlerStateChangeEvent = HandlerStateChangeEvent<NativeViewGestureHandlerPayload>;
|
|
17
|
+
export type TapGestureHandlerGestureEvent = GestureEvent<TapGestureHandlerEventPayload>;
|
|
18
|
+
export type TapGestureHandlerStateChangeEvent = HandlerStateChangeEvent<TapGestureHandlerEventPayload>;
|
|
19
|
+
export type ForceTouchGestureHandlerGestureEvent = GestureEvent<ForceTouchGestureHandlerEventPayload>;
|
|
20
|
+
export type ForceTouchGestureHandlerStateChangeEvent = HandlerStateChangeEvent<ForceTouchGestureHandlerEventPayload>;
|
|
21
|
+
export type LongPressGestureHandlerGestureEvent = GestureEvent<LongPressGestureHandlerEventPayload>;
|
|
22
|
+
export type LongPressGestureHandlerStateChangeEvent = HandlerStateChangeEvent<LongPressGestureHandlerEventPayload>;
|
|
23
|
+
export type PanGestureHandlerGestureEvent = GestureEvent<PanGestureHandlerEventPayload>;
|
|
24
|
+
export type PanGestureHandlerStateChangeEvent = HandlerStateChangeEvent<PanGestureHandlerEventPayload>;
|
|
25
|
+
export type PinchGestureHandlerGestureEvent = GestureEvent<PinchGestureHandlerEventPayload>;
|
|
26
|
+
export type PinchGestureHandlerStateChangeEvent = HandlerStateChangeEvent<PinchGestureHandlerEventPayload>;
|
|
27
|
+
export type RotationGestureHandlerGestureEvent = GestureEvent<RotationGestureHandlerEventPayload>;
|
|
28
|
+
export type RotationGestureHandlerStateChangeEvent = HandlerStateChangeEvent<RotationGestureHandlerEventPayload>;
|
|
29
|
+
export type FlingGestureHandlerGestureEvent = GestureEvent<FlingGestureHandlerEventPayload>;
|
|
30
|
+
export type FlingGestureHandlerStateChangeEvent = HandlerStateChangeEvent<FlingGestureHandlerEventPayload>;
|
|
31
|
+
export type NativeViewGestureHandlerProperties = NativeViewGestureHandlerProps;
|
|
32
|
+
export type TapGestureHandlerProperties = TapGestureHandlerProps;
|
|
33
|
+
export type LongPressGestureHandlerProperties = LongPressGestureHandlerProps;
|
|
34
|
+
export type PanGestureHandlerProperties = PanGestureHandlerProps;
|
|
35
|
+
export type PinchGestureHandlerProperties = PinchGestureHandlerProps;
|
|
36
|
+
export type RotationGestureHandlerProperties = RotationGestureHandlerProps;
|
|
37
|
+
export type FlingGestureHandlerProperties = FlingGestureHandlerProps;
|
|
38
|
+
export type ForceTouchGestureHandlerProperties = ForceTouchGestureHandlerProps;
|
|
39
|
+
export type RawButtonProperties = RawButtonProps;
|
|
40
|
+
export type BaseButtonProperties = BaseButtonProps;
|
|
41
|
+
export type RectButtonProperties = RectButtonProps;
|
|
42
|
+
export type BorderlessButtonProperties = BorderlessButtonProps;
|
|
@@ -3,7 +3,7 @@ import { GestureType, HandlerCallbacks } from './gesture';
|
|
|
3
3
|
import { SharedValue } from './reanimatedWrapper';
|
|
4
4
|
import { UserSelect } from '../gestureHandlerCommon';
|
|
5
5
|
import { ComposedGesture } from './gestureComposition';
|
|
6
|
-
export
|
|
6
|
+
export type GestureConfigReference = {
|
|
7
7
|
config: GestureType[];
|
|
8
8
|
animatedEventHandler: unknown;
|
|
9
9
|
animatedHandlers: SharedValue<HandlerCallbacks<Record<string, unknown>>[] | null> | null;
|
|
@@ -15,5 +15,5 @@ interface GestureDetectorProps {
|
|
|
15
15
|
userSelect?: UserSelect;
|
|
16
16
|
children?: React.ReactNode;
|
|
17
17
|
}
|
|
18
|
-
export declare const GestureDetector: (props: GestureDetectorProps) => JSX.Element;
|
|
18
|
+
export declare const GestureDetector: (props: GestureDetectorProps) => React.JSX.Element;
|
|
19
19
|
export {};
|
|
@@ -6,4 +6,4 @@ export declare class FlingGesture extends BaseGesture<FlingGestureHandlerEventPa
|
|
|
6
6
|
numberOfPointers(pointers: number): this;
|
|
7
7
|
direction(direction: number): this;
|
|
8
8
|
}
|
|
9
|
-
export
|
|
9
|
+
export type FlingGestureType = InstanceType<typeof FlingGesture>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseGestureConfig, ContinousBaseGesture } from './gesture';
|
|
2
2
|
import { ForceTouchGestureConfig, ForceTouchGestureHandlerEventPayload } from '../ForceTouchGestureHandler';
|
|
3
3
|
import { GestureUpdateEvent } from '../gestureHandlerCommon';
|
|
4
|
-
export
|
|
4
|
+
export type ForceTouchGestureChangeEventPayload = {
|
|
5
5
|
forceChange: number;
|
|
6
6
|
};
|
|
7
7
|
export declare class ForceTouchGesture extends ContinousBaseGesture<ForceTouchGestureHandlerEventPayload, ForceTouchGestureChangeEventPayload> {
|
|
@@ -12,4 +12,4 @@ export declare class ForceTouchGesture extends ContinousBaseGesture<ForceTouchGe
|
|
|
12
12
|
feedbackOnActivation(value: boolean): this;
|
|
13
13
|
onChange(callback: (event: GestureUpdateEvent<GestureUpdateEvent<ForceTouchGestureHandlerEventPayload & ForceTouchGestureChangeEventPayload>>) => void): this;
|
|
14
14
|
}
|
|
15
|
-
export
|
|
15
|
+
export type ForceTouchGestureType = InstanceType<typeof ForceTouchGesture>;
|
|
@@ -8,20 +8,21 @@ import { PinchGestureHandlerEventPayload } from '../PinchGestureHandler';
|
|
|
8
8
|
import { RotationGestureHandlerEventPayload } from '../RotationGestureHandler';
|
|
9
9
|
import { TapGestureHandlerEventPayload } from '../TapGestureHandler';
|
|
10
10
|
import { NativeViewGestureHandlerPayload } from '../NativeViewGestureHandler';
|
|
11
|
-
export
|
|
12
|
-
export
|
|
11
|
+
export type GestureType = BaseGesture<Record<string, unknown>> | BaseGesture<Record<string, never>> | BaseGesture<TapGestureHandlerEventPayload> | BaseGesture<PanGestureHandlerEventPayload> | BaseGesture<LongPressGestureHandlerEventPayload> | BaseGesture<RotationGestureHandlerEventPayload> | BaseGesture<PinchGestureHandlerEventPayload> | BaseGesture<FlingGestureHandlerEventPayload> | BaseGesture<ForceTouchGestureHandlerEventPayload> | BaseGesture<NativeViewGestureHandlerPayload>;
|
|
12
|
+
export type GestureRef = number | GestureType | React.RefObject<GestureType | undefined> | React.RefObject<React.ComponentType | undefined>;
|
|
13
13
|
export interface BaseGestureConfig extends CommonGestureConfig, Record<string, unknown> {
|
|
14
14
|
ref?: React.MutableRefObject<GestureType | undefined>;
|
|
15
15
|
requireToFail?: GestureRef[];
|
|
16
16
|
simultaneousWith?: GestureRef[];
|
|
17
|
+
blocksHandlers?: GestureRef[];
|
|
17
18
|
needsPointerData?: boolean;
|
|
18
19
|
manualActivation?: boolean;
|
|
19
20
|
runOnJS?: boolean;
|
|
20
21
|
testId?: string;
|
|
21
22
|
cancelsTouchesInView?: boolean;
|
|
22
23
|
}
|
|
23
|
-
|
|
24
|
-
export
|
|
24
|
+
type TouchEventHandlerType = (event: GestureTouchEvent, stateManager: GestureStateManagerType) => void;
|
|
25
|
+
export type HandlerCallbacks<EventPayloadT extends Record<string, unknown>> = {
|
|
25
26
|
gestureId: number;
|
|
26
27
|
handlerTag: number;
|
|
27
28
|
onBegin?: (event: GestureStateChangeEvent<EventPayloadT>) => void;
|
|
@@ -50,7 +51,7 @@ export declare const CALLBACK_TYPE: {
|
|
|
50
51
|
readonly TOUCHES_UP: 9;
|
|
51
52
|
readonly TOUCHES_CANCELLED: 10;
|
|
52
53
|
};
|
|
53
|
-
export
|
|
54
|
+
export type CALLBACK_TYPE = typeof CALLBACK_TYPE[keyof typeof CALLBACK_TYPE];
|
|
54
55
|
export declare abstract class Gesture {
|
|
55
56
|
/**
|
|
56
57
|
* Return array of gestures, providing the same interface for creating and updating
|
|
@@ -93,6 +94,7 @@ export declare abstract class BaseGesture<EventPayloadT extends Record<string, u
|
|
|
93
94
|
runOnJS(runOnJS: boolean): this;
|
|
94
95
|
simultaneousWithExternalGesture(...gestures: Exclude<GestureRef, number>[]): this;
|
|
95
96
|
requireExternalGestureToFail(...gestures: Exclude<GestureRef, number>[]): this;
|
|
97
|
+
blocksExternalGesture(...gestures: Exclude<GestureRef, number>[]): this;
|
|
96
98
|
withTestId(id: string): this;
|
|
97
99
|
cancelsTouchesInView(value: boolean): this;
|
|
98
100
|
initialize(): void;
|
|
@@ -15,7 +15,7 @@ export declare class SimultaneousGesture extends ComposedGesture {
|
|
|
15
15
|
export declare class ExclusiveGesture extends ComposedGesture {
|
|
16
16
|
prepare(): void;
|
|
17
17
|
}
|
|
18
|
-
export
|
|
19
|
-
export
|
|
20
|
-
export
|
|
21
|
-
export
|
|
18
|
+
export type ComposedGestureType = InstanceType<typeof ComposedGesture>;
|
|
19
|
+
export type RaceGestureType = ComposedGestureType;
|
|
20
|
+
export type SimultaneousGestureType = InstanceType<typeof SimultaneousGesture>;
|
|
21
|
+
export type ExclusiveGestureType = InstanceType<typeof ExclusiveGesture>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { BaseGestureConfig, ContinousBaseGesture } from './gesture';
|
|
2
2
|
import { GestureUpdateEvent } from '../gestureHandlerCommon';
|
|
3
|
-
export
|
|
3
|
+
export type HoverGestureHandlerEventPayload = {
|
|
4
4
|
x: number;
|
|
5
5
|
y: number;
|
|
6
6
|
absoluteX: number;
|
|
7
7
|
absoluteY: number;
|
|
8
8
|
};
|
|
9
|
-
export
|
|
9
|
+
export type HoverGestureChangeEventPayload = {
|
|
10
10
|
changeX: number;
|
|
11
11
|
changeY: number;
|
|
12
12
|
};
|
|
@@ -29,4 +29,4 @@ export declare class HoverGesture extends ContinousBaseGesture<HoverGestureHandl
|
|
|
29
29
|
effect(effect: HoverEffect): this;
|
|
30
30
|
onChange(callback: (event: GestureUpdateEvent<HoverGestureHandlerEventPayload & HoverGestureChangeEventPayload>) => void): this;
|
|
31
31
|
}
|
|
32
|
-
export
|
|
32
|
+
export type HoverGestureType = InstanceType<typeof HoverGesture>;
|
|
@@ -6,4 +6,4 @@ export declare class LongPressGesture extends BaseGesture<LongPressGestureHandle
|
|
|
6
6
|
minDuration(duration: number): this;
|
|
7
7
|
maxDistance(distance: number): this;
|
|
8
8
|
}
|
|
9
|
-
export
|
|
9
|
+
export type LongPressGestureType = InstanceType<typeof LongPressGesture>;
|
|
@@ -4,4 +4,4 @@ export declare class ManualGesture extends ContinousBaseGesture<Record<string, n
|
|
|
4
4
|
constructor();
|
|
5
5
|
onChange(callback: (event: GestureUpdateEvent<Record<string, never>>) => void): this;
|
|
6
6
|
}
|
|
7
|
-
export
|
|
7
|
+
export type ManualGestureType = InstanceType<typeof ManualGesture>;
|
|
@@ -6,4 +6,4 @@ export declare class NativeGesture extends BaseGesture<NativeViewGestureHandlerP
|
|
|
6
6
|
shouldActivateOnStart(value: boolean): this;
|
|
7
7
|
disallowInterruption(value: boolean): this;
|
|
8
8
|
}
|
|
9
|
-
export
|
|
9
|
+
export type NativeGestureType = InstanceType<typeof NativeGesture>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseGestureConfig, ContinousBaseGesture } from './gesture';
|
|
2
2
|
import { GestureUpdateEvent } from '../gestureHandlerCommon';
|
|
3
3
|
import { PanGestureConfig, PanGestureHandlerEventPayload } from '../PanGestureHandler';
|
|
4
|
-
export
|
|
4
|
+
export type PanGestureChangeEventPayload = {
|
|
5
5
|
changeX: number;
|
|
6
6
|
changeY: number;
|
|
7
7
|
};
|
|
@@ -23,4 +23,4 @@ export declare class PanGesture extends ContinousBaseGesture<PanGestureHandlerEv
|
|
|
23
23
|
activateAfterLongPress(duration: number): this;
|
|
24
24
|
onChange(callback: (event: GestureUpdateEvent<PanGestureHandlerEventPayload & PanGestureChangeEventPayload>) => void): this;
|
|
25
25
|
}
|
|
26
|
-
export
|
|
26
|
+
export type PanGestureType = InstanceType<typeof PanGesture>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ContinousBaseGesture } from './gesture';
|
|
2
2
|
import { PinchGestureHandlerEventPayload } from '../PinchGestureHandler';
|
|
3
3
|
import { GestureUpdateEvent } from '../gestureHandlerCommon';
|
|
4
|
-
export
|
|
4
|
+
export type PinchGestureChangeEventPayload = {
|
|
5
5
|
scaleChange: number;
|
|
6
6
|
};
|
|
7
7
|
export declare class PinchGesture extends ContinousBaseGesture<PinchGestureHandlerEventPayload, PinchGestureChangeEventPayload> {
|
|
8
8
|
constructor();
|
|
9
9
|
onChange(callback: (event: GestureUpdateEvent<PinchGestureHandlerEventPayload & PinchGestureChangeEventPayload>) => void): this;
|
|
10
10
|
}
|
|
11
|
-
export
|
|
11
|
+
export type PinchGestureType = InstanceType<typeof PinchGesture>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { ContinousBaseGesture } from './gesture';
|
|
2
2
|
import { RotationGestureHandlerEventPayload } from '../RotationGestureHandler';
|
|
3
3
|
import { GestureUpdateEvent } from '../gestureHandlerCommon';
|
|
4
|
-
|
|
4
|
+
type RotationGestureChangeEventPayload = {
|
|
5
5
|
rotationChange: number;
|
|
6
6
|
};
|
|
7
7
|
export declare class RotationGesture extends ContinousBaseGesture<RotationGestureHandlerEventPayload, RotationGestureChangeEventPayload> {
|
|
8
8
|
constructor();
|
|
9
9
|
onChange(callback: (event: GestureUpdateEvent<RotationGestureHandlerEventPayload & RotationGestureChangeEventPayload>) => void): this;
|
|
10
10
|
}
|
|
11
|
-
export
|
|
11
|
+
export type RotationGestureType = InstanceType<typeof RotationGesture>;
|
|
12
12
|
export {};
|
|
@@ -11,4 +11,4 @@ export declare class TapGesture extends BaseGesture<TapGestureHandlerEventPayloa
|
|
|
11
11
|
maxDeltaX(delta: number): this;
|
|
12
12
|
maxDeltaY(delta: number): this;
|
|
13
13
|
}
|
|
14
|
-
export
|
|
14
|
+
export type TapGestureType = InstanceType<typeof TapGesture>;
|
|
@@ -17,12 +17,12 @@ import { PanGestureHandler, PanGestureHandlerEventPayload } from '../handlers/Pa
|
|
|
17
17
|
import { PinchGestureHandler, PinchGestureHandlerEventPayload } from '../handlers/PinchGestureHandler';
|
|
18
18
|
import { RotationGestureHandler, RotationGestureHandlerEventPayload } from '../handlers/RotationGestureHandler';
|
|
19
19
|
import { TapGestureHandler, TapGestureHandlerEventPayload } from '../handlers/TapGestureHandler';
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
type GestureHandlerTestEvent<TEventPayload extends Record<string, unknown> = Record<string, unknown>> = (GestureEvent<TEventPayload> | HandlerStateChangeEvent<TEventPayload>)['nativeEvent'];
|
|
21
|
+
type AllGestures = TapGesture | PanGesture | LongPressGesture | RotationGesture | PinchGesture | FlingGesture | ForceTouchGesture | NativeGesture;
|
|
22
|
+
type AllHandlers = TapGestureHandler | PanGestureHandler | LongPressGestureHandler | RotationGestureHandler | PinchGestureHandler | FlingGestureHandler | ForceTouchGestureHandler | NativeViewGestureHandler;
|
|
23
|
+
type ClassComponentConstructor<P> = new (props: P) => React.Component<P, any, any>;
|
|
24
|
+
type ExtractPayloadFromProps<T> = T extends BaseGestureHandlerProps<infer TPayload> ? TPayload : never;
|
|
25
|
+
type ExtractConfig<T> = T extends BaseGesture<infer TGesturePayload> ? TGesturePayload : T extends ClassComponentConstructor<infer THandlerProps> ? ExtractPayloadFromProps<THandlerProps> : Record<string, unknown>;
|
|
26
26
|
export declare function fireGestureHandler<THandler extends AllGestures | AllHandlers>(componentOrGesture: ReactTestInstance | GestureType, eventList?: Partial<GestureHandlerTestEvent<ExtractConfig<THandler>>>[]): void;
|
|
27
27
|
export declare function getByGestureTestId(testID: string): BaseGesture<Record<string, unknown>> | BaseGesture<Record<string, never>> | BaseGesture<TapGestureHandlerEventPayload> | BaseGesture<PanGestureHandlerEventPayload> | BaseGesture<LongPressGestureHandlerEventPayload> | BaseGesture<RotationGestureHandlerEventPayload> | BaseGesture<PinchGestureHandlerEventPayload> | BaseGesture<ForceTouchGestureHandlerEventPayload> | BaseGesture<NativeViewGestureHandlerPayload>;
|
|
28
28
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type ValueOf<T> = T[keyof T];
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
export declare const REACT_NATIVE_VERSION: {
|
|
2
|
-
major: number;
|
|
3
|
-
minor: number;
|
|
4
|
-
};
|
|
5
1
|
export declare function toArray<T>(object: T | T[]): T[];
|
|
6
|
-
export
|
|
2
|
+
export type withPrevAndCurrentMapFn<T, Transformed> = (previous: Transformed | null, current: T) => Transformed;
|
|
7
3
|
export declare function withPrevAndCurrent<T, Transformed>(array: T[], mapFn: withPrevAndCurrentMapFn<T, Transformed>): Transformed[];
|
|
8
4
|
export declare function hasProperty(object: object, key: string): boolean;
|
|
9
5
|
export declare function isJestEnv(): boolean;
|
|
@@ -14,11 +14,12 @@ export interface HitSlop {
|
|
|
14
14
|
export interface Handler {
|
|
15
15
|
handlerTag: number;
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
type ConfigArgs = number | boolean | HitSlop | UserSelect | ActiveCursor | Directions | Handler[] | null | undefined;
|
|
18
18
|
export interface Config extends Record<string, ConfigArgs> {
|
|
19
19
|
enabled?: boolean;
|
|
20
20
|
simultaneousHandlers?: Handler[] | null;
|
|
21
21
|
waitFor?: Handler[] | null;
|
|
22
|
+
blocksHandlers?: Handler[] | null;
|
|
22
23
|
hitSlop?: HitSlop;
|
|
23
24
|
shouldCancelWhenOutside?: boolean;
|
|
24
25
|
userSelect?: UserSelect;
|
|
@@ -53,7 +54,7 @@ export interface Config extends Record<string, ConfigArgs> {
|
|
|
53
54
|
disallowInterruption?: boolean;
|
|
54
55
|
direction?: Directions;
|
|
55
56
|
}
|
|
56
|
-
|
|
57
|
+
type NativeEventArgs = number | State | boolean | undefined;
|
|
57
58
|
interface NativeEvent extends Record<string, NativeEventArgs> {
|
|
58
59
|
numberOfPointers: number;
|
|
59
60
|
state: State;
|
|
@@ -69,7 +70,7 @@ export interface PointerData {
|
|
|
69
70
|
absoluteX: number;
|
|
70
71
|
absoluteY: number;
|
|
71
72
|
}
|
|
72
|
-
|
|
73
|
+
type TouchNativeArgs = number | State | TouchEventType | PointerData[];
|
|
73
74
|
interface NativeTouchEvent extends Record<string, TouchNativeArgs> {
|
|
74
75
|
handlerTag: number;
|
|
75
76
|
state: State;
|
|
@@ -4,11 +4,12 @@ export default class InteractionManager {
|
|
|
4
4
|
private static instance;
|
|
5
5
|
private readonly waitForRelations;
|
|
6
6
|
private readonly simultaneousRelations;
|
|
7
|
+
private readonly blocksHandlersRelations;
|
|
7
8
|
private constructor();
|
|
8
9
|
configureInteractions(handler: GestureHandler, config: Config): void;
|
|
9
10
|
shouldWaitForHandlerFailure(handler: GestureHandler, otherHandler: GestureHandler): boolean;
|
|
10
11
|
shouldRecognizeSimultaneously(handler: GestureHandler, otherHandler: GestureHandler): boolean;
|
|
11
|
-
shouldRequireHandlerToWaitForFailure(
|
|
12
|
+
shouldRequireHandlerToWaitForFailure(handler: GestureHandler, otherHandler: GestureHandler): boolean;
|
|
12
13
|
shouldHandlerBeCancelledBy(_handler: GestureHandler, _otherHandler: GestureHandler): boolean;
|
|
13
14
|
dropRelationsForHandlerWithTag(handlerTag: number): void;
|
|
14
15
|
reset(): void;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { findNodeHandle } from 'react-native';
|
|
2
2
|
import { State } from '../State';
|
|
3
3
|
import { EventMap } from './constants';
|
|
4
|
-
export
|
|
5
|
-
export
|
|
4
|
+
export type HammerInputExt = Omit<HammerInput, 'destroy' | 'handler' | 'init'>;
|
|
5
|
+
export type Config = Partial<{
|
|
6
6
|
enabled: boolean;
|
|
7
7
|
minPointers: number;
|
|
8
8
|
maxPointers: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-gesture-handler",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.14.0",
|
|
4
4
|
"description": "Experimental implementation of a new declarative API for gesture handling in react-native",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"prepare": "bob build && husky install",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"android/src/main/AndroidManifest.xml",
|
|
32
32
|
"android/src/main/java/",
|
|
33
33
|
"android/src/main/jni/",
|
|
34
|
-
"android/src/
|
|
35
|
-
"android/src/
|
|
34
|
+
"android/fabric/src/main/java",
|
|
35
|
+
"android/paper/src/main/java",
|
|
36
36
|
"android/common/src/main/java/",
|
|
37
37
|
"android/reanimated/src/main/java/",
|
|
38
38
|
"android/noreanimated/src/main/java/",
|
|
@@ -77,12 +77,13 @@
|
|
|
77
77
|
"@babel/preset-env": "^7.12.11",
|
|
78
78
|
"@babel/preset-typescript": "^7.12.7",
|
|
79
79
|
"@babel/runtime": "^7.12.5",
|
|
80
|
+
"@react-native/babel-preset": "^0.73.18",
|
|
80
81
|
"@testing-library/jest-native": "^4.0.4",
|
|
81
82
|
"@testing-library/react-native": "^9.0.0",
|
|
82
83
|
"@types/hammerjs": "^2.0.38",
|
|
83
84
|
"@types/hoist-non-react-statics": "^3.3.1",
|
|
84
85
|
"@types/jest": "^27.0.3",
|
|
85
|
-
"@types/react": "^18.
|
|
86
|
+
"@types/react": "^18.2.6",
|
|
86
87
|
"@types/react-test-renderer": "^17.0.0",
|
|
87
88
|
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
|
88
89
|
"@typescript-eslint/parser": "^4.33.0",
|
|
@@ -97,17 +98,16 @@
|
|
|
97
98
|
"husky": "^8.0.1",
|
|
98
99
|
"jest": "^26.6.3",
|
|
99
100
|
"lint-staged": "^12.3.2",
|
|
100
|
-
"metro-react-native-babel-preset": "^0.64.0",
|
|
101
101
|
"prettier": "^2.7.1",
|
|
102
102
|
"react": "18.2.0",
|
|
103
103
|
"react-dom": "^16.12.0",
|
|
104
|
-
"react-native": "0.
|
|
104
|
+
"react-native": "0.73.0-rc.5",
|
|
105
105
|
"react-native-builder-bob": "^0.17.1",
|
|
106
106
|
"react-native-reanimated": "^2.3.1",
|
|
107
107
|
"react-native-web": "^0.11.7",
|
|
108
108
|
"react-test-renderer": "17.0.2",
|
|
109
109
|
"release-it": "^13.6.5",
|
|
110
|
-
"typescript": "
|
|
110
|
+
"typescript": "5.0.4"
|
|
111
111
|
},
|
|
112
112
|
"peerDependencies": {
|
|
113
113
|
"react": "*",
|
|
@@ -56,7 +56,8 @@ export default class TouchableNativeFeedback extends Component<TouchableNativeFe
|
|
|
56
56
|
rippleRadius,
|
|
57
57
|
});
|
|
58
58
|
|
|
59
|
-
static canUseNativeForeground = () =>
|
|
59
|
+
static canUseNativeForeground = () =>
|
|
60
|
+
Platform.OS === 'android' && Platform.Version >= 23;
|
|
60
61
|
|
|
61
62
|
getExtraButtonProps() {
|
|
62
63
|
const extraProps: TouchableNativeFeedbackExtraProps = {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import pack from 'react-native/package.json';
|
|
2
|
+
|
|
3
|
+
const [majorStr, minorStr] = pack.version.split('.');
|
|
4
|
+
const REACT_NATIVE_VERSION = {
|
|
5
|
+
major: parseInt(majorStr, 10),
|
|
6
|
+
minor: parseInt(minorStr, 10),
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export function getReactNativeVersion() {
|
|
10
|
+
return REACT_NATIVE_VERSION;
|
|
11
|
+
}
|
|
@@ -23,7 +23,11 @@ const commonProps = [
|
|
|
23
23
|
'activeCursor',
|
|
24
24
|
] as const;
|
|
25
25
|
|
|
26
|
-
const componentInteractionProps = [
|
|
26
|
+
const componentInteractionProps = [
|
|
27
|
+
'waitFor',
|
|
28
|
+
'simultaneousHandlers',
|
|
29
|
+
'blocksHandlers',
|
|
30
|
+
] as const;
|
|
27
31
|
|
|
28
32
|
export const baseGestureHandlerProps = [
|
|
29
33
|
...commonProps,
|
|
@@ -155,6 +159,7 @@ export type BaseGestureHandlerProps<
|
|
|
155
159
|
id?: string;
|
|
156
160
|
waitFor?: React.Ref<unknown> | React.Ref<unknown>[];
|
|
157
161
|
simultaneousHandlers?: React.Ref<unknown> | React.Ref<unknown>[];
|
|
162
|
+
blocksHandlers?: React.Ref<unknown> | React.Ref<unknown>[];
|
|
158
163
|
testID?: string;
|
|
159
164
|
cancelsTouchesInView?: boolean;
|
|
160
165
|
// TODO(TS) - fix event types
|
|
@@ -37,12 +37,8 @@ import { State } from '../../State';
|
|
|
37
37
|
import { TouchEventType } from '../../TouchEventType';
|
|
38
38
|
import { ComposedGesture } from './gestureComposition';
|
|
39
39
|
import { ActionType } from '../../ActionType';
|
|
40
|
-
import {
|
|
41
|
-
|
|
42
|
-
isJestEnv,
|
|
43
|
-
REACT_NATIVE_VERSION,
|
|
44
|
-
tagMessage,
|
|
45
|
-
} from '../../utils';
|
|
40
|
+
import { isFabric, isJestEnv, tagMessage } from '../../utils';
|
|
41
|
+
import { getReactNativeVersion } from '../../getReactNativeVersion';
|
|
46
42
|
import { getShadowNodeFromRef } from '../../getShadowNodeFromRef';
|
|
47
43
|
import { Platform } from 'react-native';
|
|
48
44
|
import type RNGestureHandlerModuleWeb from '../../RNGestureHandlerModule.web';
|
|
@@ -197,11 +193,17 @@ function attachHandlers({
|
|
|
197
193
|
);
|
|
198
194
|
}
|
|
199
195
|
|
|
196
|
+
let blocksHandlers: number[] = [];
|
|
197
|
+
if (handler.config.blocksHandlers) {
|
|
198
|
+
blocksHandlers = extractValidHandlerTags(handler.config.blocksHandlers);
|
|
199
|
+
}
|
|
200
|
+
|
|
200
201
|
RNGestureHandlerModule.updateGestureHandler(
|
|
201
202
|
handler.handlerTag,
|
|
202
203
|
filterConfig(handler.config, ALLOWED_PROPS, {
|
|
203
204
|
simultaneousHandlers: simultaneousWith,
|
|
204
205
|
waitFor: requireToFail,
|
|
206
|
+
blocksHandlers: blocksHandlers,
|
|
205
207
|
})
|
|
206
208
|
);
|
|
207
209
|
}
|
|
@@ -565,6 +567,7 @@ function validateDetectorChildren(ref: any) {
|
|
|
565
567
|
// / \
|
|
566
568
|
// NativeView NativeView
|
|
567
569
|
if (__DEV__ && Platform.OS !== 'web') {
|
|
570
|
+
const REACT_NATIVE_VERSION = getReactNativeVersion();
|
|
568
571
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
569
572
|
const wrapType =
|
|
570
573
|
REACT_NATIVE_VERSION.minor > 63 || REACT_NATIVE_VERSION.major > 0
|
|
@@ -41,6 +41,7 @@ export interface BaseGestureConfig
|
|
|
41
41
|
ref?: React.MutableRefObject<GestureType | undefined>;
|
|
42
42
|
requireToFail?: GestureRef[];
|
|
43
43
|
simultaneousWith?: GestureRef[];
|
|
44
|
+
blocksHandlers?: GestureRef[];
|
|
44
45
|
needsPointerData?: boolean;
|
|
45
46
|
manualActivation?: boolean;
|
|
46
47
|
runOnJS?: boolean;
|
|
@@ -144,7 +145,7 @@ export abstract class BaseGesture<
|
|
|
144
145
|
}
|
|
145
146
|
|
|
146
147
|
private addDependency(
|
|
147
|
-
key: 'simultaneousWith' | 'requireToFail',
|
|
148
|
+
key: 'simultaneousWith' | 'requireToFail' | 'blocksHandlers',
|
|
148
149
|
gesture: Exclude<GestureRef, number>
|
|
149
150
|
) {
|
|
150
151
|
const value = this.config[key];
|
|
@@ -275,6 +276,13 @@ export abstract class BaseGesture<
|
|
|
275
276
|
return this;
|
|
276
277
|
}
|
|
277
278
|
|
|
279
|
+
blocksExternalGesture(...gestures: Exclude<GestureRef, number>[]) {
|
|
280
|
+
for (const gesture of gestures) {
|
|
281
|
+
this.addDependency('blocksHandlers', gesture);
|
|
282
|
+
}
|
|
283
|
+
return this;
|
|
284
|
+
}
|
|
285
|
+
|
|
278
286
|
withTestId(id: string) {
|
|
279
287
|
this.config.testId = id;
|
|
280
288
|
return this;
|