react-native-gesture-handler 2.15.0 → 2.16.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 +2 -23
- package/android/build.gradle +1 -1
- package/android/noreanimated/src/main/java/com/swmansion/gesturehandler/ReanimatedEventDispatcher.kt +2 -0
- package/android/paper/src/main/java/com/facebook/react/viewmanagers/RNGestureHandlerButtonManagerDelegate.java +9 -0
- package/android/paper/src/main/java/com/facebook/react/viewmanagers/RNGestureHandlerButtonManagerInterface.java +3 -0
- package/android/src/main/java/com/swmansion/gesturehandler/RNGestureHandlerPackage.kt +11 -6
- package/android/src/main/java/com/swmansion/gesturehandler/core/DiagonalDirections.kt +8 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/FlingGestureHandler.kt +65 -24
- package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandler.kt +86 -22
- package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt +54 -29
- package/android/src/main/java/com/swmansion/gesturehandler/core/GestureUtils.kt +3 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/LongPressGestureHandler.kt +5 -1
- package/android/src/main/java/com/swmansion/gesturehandler/core/PanGestureHandler.kt +5 -1
- package/android/src/main/java/com/swmansion/gesturehandler/core/TapGestureHandler.kt +7 -3
- package/android/src/main/java/com/swmansion/gesturehandler/core/Vector.kt +66 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt +119 -19
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEnabledRootView.kt +2 -2
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEvent.kt +1 -4
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.kt +8 -5
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootHelper.kt +7 -4
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootView.kt +1 -1
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerStateChangeEvent.kt +1 -4
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerTouchEvent.kt +4 -7
- package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/GestureHandlerEventDataBuilder.kt +3 -0
- package/android/src/main/jni/cpp-adapter.cpp +18 -22
- package/apple/Handlers/RNFlingHandler.m +5 -4
- package/apple/Handlers/RNForceTouchHandler.m +3 -1
- package/apple/Handlers/RNHoverHandler.m +2 -1
- package/apple/Handlers/RNLongPressHandler.m +8 -14
- package/apple/Handlers/RNManualHandler.m +1 -0
- package/apple/Handlers/RNNativeViewHandler.mm +9 -7
- package/apple/Handlers/RNPanHandler.m +7 -2
- package/apple/Handlers/RNPinchHandler.m +50 -26
- package/apple/Handlers/RNRotationHandler.m +43 -29
- package/apple/Handlers/RNTapHandler.m +6 -4
- package/apple/RNGestureHandler.h +9 -0
- package/apple/RNGestureHandler.m +41 -4
- package/apple/RNGestureHandlerEvents.h +18 -9
- package/apple/RNGestureHandlerEvents.m +29 -11
- package/apple/RNGestureHandlerManager.h +5 -0
- package/apple/RNGestureHandlerManager.mm +32 -6
- package/apple/RNGestureHandlerModule.h +5 -3
- package/apple/RNGestureHandlerModule.mm +33 -19
- package/apple/RNGestureHandlerPointerType.h +8 -0
- package/lib/commonjs/Directions.js +19 -6
- package/lib/commonjs/Directions.js.map +1 -1
- package/lib/commonjs/PointerType.js +16 -0
- package/lib/commonjs/PointerType.js.map +1 -0
- package/lib/commonjs/RNGestureHandlerModule.web.js +7 -61
- package/lib/commonjs/RNGestureHandlerModule.web.js.map +1 -1
- package/lib/commonjs/components/DrawerLayout.js.map +1 -1
- package/lib/commonjs/components/GestureHandlerRootView.android.js +17 -2
- package/lib/commonjs/components/GestureHandlerRootView.android.js.map +1 -1
- package/lib/commonjs/components/GestureHandlerRootView.js +15 -2
- package/lib/commonjs/components/GestureHandlerRootView.js.map +1 -1
- package/lib/commonjs/components/GestureHandlerRootView.web.js +15 -2
- package/lib/commonjs/components/GestureHandlerRootView.web.js.map +1 -1
- package/lib/commonjs/components/Swipeable.js +3 -1
- package/lib/commonjs/components/Swipeable.js.map +1 -1
- package/lib/commonjs/components/touchables/GenericTouchable.js +1 -0
- package/lib/commonjs/components/touchables/GenericTouchable.js.map +1 -1
- package/lib/commonjs/getShadowNodeFromRef.js +19 -2
- package/lib/commonjs/getShadowNodeFromRef.js.map +1 -1
- package/lib/commonjs/handlers/createHandler.js +5 -0
- package/lib/commonjs/handlers/createHandler.js.map +1 -1
- package/lib/commonjs/handlers/customDirectEventTypes.js +14 -0
- package/lib/commonjs/handlers/customDirectEventTypes.js.map +1 -0
- package/lib/commonjs/handlers/customDirectEventTypes.web.js +11 -0
- package/lib/commonjs/handlers/customDirectEventTypes.web.js.map +1 -0
- package/lib/commonjs/handlers/gestureHandlerCommon.js +13 -2
- package/lib/commonjs/handlers/gestureHandlerCommon.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector.js +10 -0
- package/lib/commonjs/handlers/gestures/GestureDetector.js.map +1 -1
- package/lib/commonjs/handlers/gestures/gesture.js.map +1 -1
- package/lib/commonjs/index.js +11 -3
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/mocks.js +2 -0
- package/lib/commonjs/mocks.js.map +1 -1
- package/lib/commonjs/specs/NativeRNGestureHandlerModule.js.map +1 -1
- package/lib/commonjs/specs/RNGestureHandlerButtonNativeComponent.js.map +1 -1
- package/lib/commonjs/web/Gestures.js +66 -0
- package/lib/commonjs/web/Gestures.js.map +1 -0
- package/lib/commonjs/web/constants.js +3 -8
- package/lib/commonjs/web/constants.js.map +1 -1
- package/lib/commonjs/web/handlers/FlingGestureHandler.js +36 -12
- package/lib/commonjs/web/handlers/FlingGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/GestureHandler.js +10 -5
- package/lib/commonjs/web/handlers/GestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/IGestureHandler.js +2 -0
- package/lib/commonjs/web/handlers/IGestureHandler.js.map +1 -0
- package/lib/commonjs/web/handlers/NativeViewGestureHandler.js +5 -6
- package/lib/commonjs/web/handlers/NativeViewGestureHandler.js.map +1 -1
- package/lib/commonjs/web/interfaces.js +1 -23
- package/lib/commonjs/web/interfaces.js.map +1 -1
- package/lib/commonjs/web/tools/EventManager.js.map +1 -1
- package/lib/commonjs/web/tools/GestureHandlerOrchestrator.js +117 -118
- package/lib/commonjs/web/tools/GestureHandlerOrchestrator.js.map +1 -1
- package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js +10 -5
- package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js.map +1 -1
- package/lib/commonjs/web/tools/InteractionManager.js +12 -3
- package/lib/commonjs/web/tools/InteractionManager.js.map +1 -1
- package/lib/commonjs/web/tools/NodeManager.js.map +1 -1
- package/lib/commonjs/web/tools/PointerEventManager.js +77 -27
- package/lib/commonjs/web/tools/PointerEventManager.js.map +1 -1
- package/lib/commonjs/web/tools/TouchEventManager.js +29 -6
- package/lib/commonjs/web/tools/TouchEventManager.js.map +1 -1
- package/lib/commonjs/web/tools/Vector.js +58 -0
- package/lib/commonjs/web/tools/Vector.js.map +1 -0
- package/lib/commonjs/web/utils.js +14 -0
- package/lib/commonjs/web/utils.js.map +1 -1
- package/lib/commonjs/web_hammer/NodeManager.js.map +1 -1
- package/lib/module/Directions.js +16 -4
- package/lib/module/Directions.js.map +1 -1
- package/lib/module/PointerType.js +9 -0
- package/lib/module/PointerType.js.map +1 -0
- package/lib/module/RNGestureHandlerModule.web.js +2 -39
- package/lib/module/RNGestureHandlerModule.web.js.map +1 -1
- package/lib/module/components/DrawerLayout.js.map +1 -1
- package/lib/module/components/GestureHandlerRootView.android.js +15 -2
- package/lib/module/components/GestureHandlerRootView.android.js.map +1 -1
- package/lib/module/components/GestureHandlerRootView.js +15 -3
- package/lib/module/components/GestureHandlerRootView.js.map +1 -1
- package/lib/module/components/GestureHandlerRootView.web.js +15 -3
- package/lib/module/components/GestureHandlerRootView.web.js.map +1 -1
- package/lib/module/components/Swipeable.js +3 -1
- package/lib/module/components/Swipeable.js.map +1 -1
- package/lib/module/components/touchables/GenericTouchable.js +1 -0
- package/lib/module/components/touchables/GenericTouchable.js.map +1 -1
- package/lib/module/getShadowNodeFromRef.js +19 -2
- package/lib/module/getShadowNodeFromRef.js.map +1 -1
- package/lib/module/handlers/createHandler.js +5 -1
- package/lib/module/handlers/createHandler.js.map +1 -1
- package/lib/module/handlers/customDirectEventTypes.js +3 -0
- package/lib/module/handlers/customDirectEventTypes.js.map +1 -0
- package/lib/module/handlers/customDirectEventTypes.web.js +5 -0
- package/lib/module/handlers/customDirectEventTypes.web.js.map +1 -0
- package/lib/module/handlers/gestureHandlerCommon.js +11 -1
- package/lib/module/handlers/gestureHandlerCommon.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector.js +10 -0
- package/lib/module/handlers/gestures/GestureDetector.js.map +1 -1
- package/lib/module/handlers/gestures/gesture.js.map +1 -1
- package/lib/module/index.js +2 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/mocks.js +2 -0
- package/lib/module/mocks.js.map +1 -1
- package/lib/module/specs/NativeRNGestureHandlerModule.js.map +1 -1
- package/lib/module/specs/RNGestureHandlerButtonNativeComponent.js.map +1 -1
- package/lib/module/web/Gestures.js +39 -0
- package/lib/module/web/Gestures.js.map +1 -0
- package/lib/module/web/constants.js +1 -6
- package/lib/module/web/constants.js.map +1 -1
- package/lib/module/web/handlers/FlingGestureHandler.js +34 -12
- package/lib/module/web/handlers/FlingGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/GestureHandler.js +7 -4
- package/lib/module/web/handlers/GestureHandler.js.map +1 -1
- package/lib/module/web/handlers/IGestureHandler.js +2 -0
- package/lib/module/web/handlers/IGestureHandler.js.map +1 -0
- package/lib/module/web/handlers/NativeViewGestureHandler.js +5 -6
- package/lib/module/web/handlers/NativeViewGestureHandler.js.map +1 -1
- package/lib/module/web/interfaces.js +0 -20
- package/lib/module/web/interfaces.js.map +1 -1
- package/lib/module/web/tools/EventManager.js.map +1 -1
- package/lib/module/web/tools/GestureHandlerOrchestrator.js +116 -117
- package/lib/module/web/tools/GestureHandlerOrchestrator.js.map +1 -1
- package/lib/module/web/tools/GestureHandlerWebDelegate.js +9 -4
- package/lib/module/web/tools/GestureHandlerWebDelegate.js.map +1 -1
- package/lib/module/web/tools/InteractionManager.js +9 -3
- package/lib/module/web/tools/InteractionManager.js.map +1 -1
- package/lib/module/web/tools/NodeManager.js.map +1 -1
- package/lib/module/web/tools/PointerEventManager.js +75 -27
- package/lib/module/web/tools/PointerEventManager.js.map +1 -1
- package/lib/module/web/tools/TouchEventManager.js +28 -6
- package/lib/module/web/tools/TouchEventManager.js.map +1 -1
- package/lib/module/web/tools/Vector.js +47 -0
- package/lib/module/web/tools/Vector.js.map +1 -0
- package/lib/module/web/utils.js +4 -0
- package/lib/module/web/utils.js.map +1 -1
- package/lib/module/web_hammer/NodeManager.js.map +1 -1
- package/lib/typescript/Directions.d.ts +7 -0
- package/lib/typescript/PointerType.d.ts +6 -0
- package/lib/typescript/RNGestureHandlerModule.web.d.ts +4 -39
- package/lib/typescript/components/DrawerLayout.d.ts +1 -2
- package/lib/typescript/components/GestureHandlerRootView.android.d.ts +1 -1
- package/lib/typescript/components/GestureHandlerRootView.d.ts +1 -1
- package/lib/typescript/components/GestureHandlerRootView.web.d.ts +1 -1
- package/lib/typescript/components/touchables/GenericTouchable.d.ts +2 -1
- package/lib/typescript/getShadowNodeFromRef.d.ts +1 -1
- package/lib/typescript/handlers/NativeViewGestureHandler.d.ts +1 -1
- package/lib/typescript/handlers/customDirectEventTypes.d.ts +1 -0
- package/lib/typescript/handlers/customDirectEventTypes.web.d.ts +2 -0
- package/lib/typescript/handlers/gestureHandlerCommon.d.ts +13 -2
- package/lib/typescript/handlers/gestures/GestureDetector.d.ts +2 -1
- package/lib/typescript/handlers/gestures/gesture.d.ts +1 -2
- package/lib/typescript/index.d.ts +2 -1
- package/lib/typescript/mocks.d.ts +1 -0
- package/lib/typescript/specs/NativeRNGestureHandlerModule.d.ts +6 -6
- package/lib/typescript/specs/RNGestureHandlerButtonNativeComponent.d.ts +4 -1
- package/lib/typescript/web/Gestures.d.ts +36 -0
- package/lib/typescript/web/constants.d.ts +1 -6
- package/lib/typescript/web/handlers/FlingGestureHandler.d.ts +3 -3
- package/lib/typescript/web/handlers/GestureHandler.d.ts +12 -9
- package/lib/typescript/web/handlers/IGestureHandler.d.ts +38 -0
- package/lib/typescript/web/handlers/NativeViewGestureHandler.d.ts +1 -0
- package/lib/typescript/web/interfaces.d.ts +9 -16
- package/lib/typescript/web/tools/EventManager.d.ts +15 -12
- package/lib/typescript/web/tools/GestureHandlerDelegate.d.ts +3 -4
- package/lib/typescript/web/tools/GestureHandlerOrchestrator.d.ts +7 -5
- package/lib/typescript/web/tools/GestureHandlerWebDelegate.d.ts +3 -3
- package/lib/typescript/web/tools/InteractionManager.d.ts +6 -6
- package/lib/typescript/web/tools/NodeManager.d.ts +4 -3
- package/lib/typescript/web/tools/PointerEventManager.d.ts +11 -2
- package/lib/typescript/web/tools/TouchEventManager.d.ts +6 -1
- package/lib/typescript/web/tools/Vector.d.ts +15 -0
- package/lib/typescript/web/utils.d.ts +6 -4
- package/lib/typescript/web_hammer/NodeManager.d.ts +1 -1
- package/package.json +2 -1
- package/src/Directions.ts +21 -4
- package/src/PointerType.ts +6 -0
- package/src/RNGestureHandlerModule.web.ts +3 -44
- package/src/components/DrawerLayout.tsx +1 -1
- package/src/components/GestureHandlerRootView.android.tsx +13 -5
- package/src/components/GestureHandlerRootView.tsx +10 -5
- package/src/components/GestureHandlerRootView.web.tsx +10 -5
- package/src/components/Swipeable.tsx +2 -0
- package/src/components/touchables/GenericTouchable.tsx +3 -0
- package/src/getShadowNodeFromRef.ts +28 -6
- package/src/handlers/createHandler.tsx +14 -2
- package/src/handlers/customDirectEventTypes.ts +2 -0
- package/src/handlers/customDirectEventTypes.web.ts +5 -0
- package/src/handlers/gestureHandlerCommon.ts +30 -1
- package/src/handlers/gestures/GestureDetector.tsx +15 -0
- package/src/handlers/gestures/gesture.ts +1 -1
- package/src/index.ts +2 -1
- package/src/mocks.ts +2 -0
- package/src/specs/NativeRNGestureHandlerModule.ts +8 -8
- package/src/specs/RNGestureHandlerButtonNativeComponent.ts +4 -0
- package/src/web/Gestures.ts +41 -0
- package/src/web/constants.ts +1 -7
- package/src/web/handlers/FlingGestureHandler.ts +54 -24
- package/src/web/handlers/GestureHandler.ts +17 -12
- package/src/web/handlers/IGestureHandler.ts +50 -0
- package/src/web/handlers/NativeViewGestureHandler.ts +5 -6
- package/src/web/interfaces.ts +15 -17
- package/src/web/tools/EventManager.ts +16 -14
- package/src/web/tools/GestureHandlerDelegate.ts +3 -4
- package/src/web/tools/GestureHandlerOrchestrator.ts +162 -147
- package/src/web/tools/GestureHandlerWebDelegate.ts +14 -9
- package/src/web/tools/InteractionManager.ts +18 -12
- package/src/web/tools/NodeManager.ts +4 -3
- package/src/web/tools/PointerEventManager.ts +189 -154
- package/src/web/tools/TouchEventManager.ts +128 -120
- package/src/web/tools/Vector.ts +60 -0
- package/src/web/utils.ts +16 -4
- package/src/web_hammer/NodeManager.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-gesture-handler",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.16.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",
|
|
@@ -98,6 +98,7 @@
|
|
|
98
98
|
"husky": "^8.0.1",
|
|
99
99
|
"jest": "^26.6.3",
|
|
100
100
|
"lint-staged": "^12.3.2",
|
|
101
|
+
"madge": "^6.1.0",
|
|
101
102
|
"prettier": "^2.7.1",
|
|
102
103
|
"react": "18.2.0",
|
|
103
104
|
"react-dom": "^16.12.0",
|
package/src/Directions.ts
CHANGED
|
@@ -1,9 +1,26 @@
|
|
|
1
|
+
const RIGHT = 1;
|
|
2
|
+
const LEFT = 2;
|
|
3
|
+
const UP = 4;
|
|
4
|
+
const DOWN = 8;
|
|
5
|
+
|
|
6
|
+
// public interface
|
|
1
7
|
export const Directions = {
|
|
2
|
-
RIGHT:
|
|
3
|
-
LEFT:
|
|
4
|
-
UP:
|
|
5
|
-
DOWN:
|
|
8
|
+
RIGHT: RIGHT,
|
|
9
|
+
LEFT: LEFT,
|
|
10
|
+
UP: UP,
|
|
11
|
+
DOWN: DOWN,
|
|
12
|
+
} as const;
|
|
13
|
+
|
|
14
|
+
// internal interface
|
|
15
|
+
export const DiagonalDirections = {
|
|
16
|
+
UP_RIGHT: UP | RIGHT,
|
|
17
|
+
DOWN_RIGHT: DOWN | RIGHT,
|
|
18
|
+
UP_LEFT: UP | LEFT,
|
|
19
|
+
DOWN_LEFT: DOWN | LEFT,
|
|
6
20
|
} as const;
|
|
7
21
|
|
|
8
22
|
// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; it can be used as a type and as a value
|
|
9
23
|
export type Directions = typeof Directions[keyof typeof Directions];
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
25
|
+
export type DiagonalDirections =
|
|
26
|
+
typeof DiagonalDirections[keyof typeof DiagonalDirections];
|
|
@@ -1,55 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import { ActionType } from './ActionType';
|
|
3
|
+
import type { ActionType } from './ActionType';
|
|
4
4
|
import { isNewWebImplementationEnabled } from './EnableNewWebImplementation';
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import { Gestures, HammerGestures } from './web/Gestures';
|
|
6
|
+
import type { Config } from './web/interfaces';
|
|
7
7
|
import InteractionManager from './web/tools/InteractionManager';
|
|
8
8
|
import NodeManager from './web/tools/NodeManager';
|
|
9
|
-
import PanGestureHandler from './web/handlers/PanGestureHandler';
|
|
10
|
-
import TapGestureHandler from './web/handlers/TapGestureHandler';
|
|
11
|
-
import LongPressGestureHandler from './web/handlers/LongPressGestureHandler';
|
|
12
|
-
import PinchGestureHandler from './web/handlers/PinchGestureHandler';
|
|
13
|
-
import RotationGestureHandler from './web/handlers/RotationGestureHandler';
|
|
14
|
-
import FlingGestureHandler from './web/handlers/FlingGestureHandler';
|
|
15
|
-
import NativeViewGestureHandler from './web/handlers/NativeViewGestureHandler';
|
|
16
|
-
import ManualGestureHandler from './web/handlers/ManualGestureHandler';
|
|
17
|
-
import HoverGestureHandler from './web/handlers/HoverGestureHandler';
|
|
18
|
-
|
|
19
|
-
//Hammer Handlers
|
|
20
9
|
import * as HammerNodeManager from './web_hammer/NodeManager';
|
|
21
|
-
import HammerNativeViewGestureHandler from './web_hammer/NativeViewGestureHandler';
|
|
22
|
-
import HammerPanGestureHandler from './web_hammer/PanGestureHandler';
|
|
23
|
-
import HammerTapGestureHandler from './web_hammer/TapGestureHandler';
|
|
24
|
-
import HammerLongPressGestureHandler from './web_hammer/LongPressGestureHandler';
|
|
25
|
-
import HammerPinchGestureHandler from './web_hammer/PinchGestureHandler';
|
|
26
|
-
import HammerRotationGestureHandler from './web_hammer/RotationGestureHandler';
|
|
27
|
-
import HammerFlingGestureHandler from './web_hammer/FlingGestureHandler';
|
|
28
|
-
import { Config } from './web/interfaces';
|
|
29
10
|
import { GestureHandlerWebDelegate } from './web/tools/GestureHandlerWebDelegate';
|
|
30
11
|
|
|
31
|
-
export const Gestures = {
|
|
32
|
-
NativeViewGestureHandler,
|
|
33
|
-
PanGestureHandler,
|
|
34
|
-
TapGestureHandler,
|
|
35
|
-
LongPressGestureHandler,
|
|
36
|
-
PinchGestureHandler,
|
|
37
|
-
RotationGestureHandler,
|
|
38
|
-
FlingGestureHandler,
|
|
39
|
-
ManualGestureHandler,
|
|
40
|
-
HoverGestureHandler,
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export const HammerGestures = {
|
|
44
|
-
NativeViewGestureHandler: HammerNativeViewGestureHandler,
|
|
45
|
-
PanGestureHandler: HammerPanGestureHandler,
|
|
46
|
-
TapGestureHandler: HammerTapGestureHandler,
|
|
47
|
-
LongPressGestureHandler: HammerLongPressGestureHandler,
|
|
48
|
-
PinchGestureHandler: HammerPinchGestureHandler,
|
|
49
|
-
RotationGestureHandler: HammerRotationGestureHandler,
|
|
50
|
-
FlingGestureHandler: HammerFlingGestureHandler,
|
|
51
|
-
};
|
|
52
|
-
|
|
53
12
|
export default {
|
|
54
13
|
handleSetJSResponder(tag: number, blockNativeResponder: boolean) {
|
|
55
14
|
console.warn('handleSetJSResponder: ', tag, blockNativeResponder);
|
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
HandlerStateChangeEvent,
|
|
29
29
|
UserSelect,
|
|
30
30
|
ActiveCursor,
|
|
31
|
+
MouseButton,
|
|
31
32
|
} from '../handlers/gestureHandlerCommon';
|
|
32
33
|
import {
|
|
33
34
|
PanGestureHandler,
|
|
@@ -38,7 +39,6 @@ import {
|
|
|
38
39
|
TapGestureHandlerEventPayload,
|
|
39
40
|
} from '../handlers/TapGestureHandler';
|
|
40
41
|
import { State } from '../State';
|
|
41
|
-
import { MouseButton } from '../web/interfaces';
|
|
42
42
|
|
|
43
43
|
const DRAG_TOSS = 0.05;
|
|
44
44
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { PropsWithChildren } from 'react';
|
|
3
|
-
import { ViewProps } from 'react-native';
|
|
3
|
+
import { ViewProps, StyleSheet } from 'react-native';
|
|
4
4
|
import { maybeInitializeFabric } from '../init';
|
|
5
5
|
import GestureHandlerRootViewContext from '../GestureHandlerRootViewContext';
|
|
6
6
|
import GestureHandlerRootViewNativeComponent from '../specs/RNGestureHandlerRootViewNativeComponent';
|
|
@@ -8,9 +8,10 @@ import GestureHandlerRootViewNativeComponent from '../specs/RNGestureHandlerRoot
|
|
|
8
8
|
export interface GestureHandlerRootViewProps
|
|
9
9
|
extends PropsWithChildren<ViewProps> {}
|
|
10
10
|
|
|
11
|
-
export default function GestureHandlerRootView(
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
export default function GestureHandlerRootView({
|
|
12
|
+
style,
|
|
13
|
+
...rest
|
|
14
|
+
}: GestureHandlerRootViewProps) {
|
|
14
15
|
// try initialize fabric on the first render, at this point we can
|
|
15
16
|
// reliably check if fabric is enabled (the function contains a flag
|
|
16
17
|
// to make sure it's called only once)
|
|
@@ -18,7 +19,14 @@ export default function GestureHandlerRootView(
|
|
|
18
19
|
|
|
19
20
|
return (
|
|
20
21
|
<GestureHandlerRootViewContext.Provider value>
|
|
21
|
-
<GestureHandlerRootViewNativeComponent
|
|
22
|
+
<GestureHandlerRootViewNativeComponent
|
|
23
|
+
style={style ?? styles.container}
|
|
24
|
+
{...rest}
|
|
25
|
+
/>
|
|
22
26
|
</GestureHandlerRootViewContext.Provider>
|
|
23
27
|
);
|
|
24
28
|
}
|
|
29
|
+
|
|
30
|
+
const styles = StyleSheet.create({
|
|
31
|
+
container: { flex: 1 },
|
|
32
|
+
});
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { PropsWithChildren } from 'react';
|
|
3
|
-
import { View, ViewProps } from 'react-native';
|
|
3
|
+
import { View, ViewProps, StyleSheet } from 'react-native';
|
|
4
4
|
import { maybeInitializeFabric } from '../init';
|
|
5
5
|
import GestureHandlerRootViewContext from '../GestureHandlerRootViewContext';
|
|
6
6
|
|
|
7
7
|
export interface GestureHandlerRootViewProps
|
|
8
8
|
extends PropsWithChildren<ViewProps> {}
|
|
9
9
|
|
|
10
|
-
export default function GestureHandlerRootView(
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
export default function GestureHandlerRootView({
|
|
11
|
+
style,
|
|
12
|
+
...rest
|
|
13
|
+
}: GestureHandlerRootViewProps) {
|
|
13
14
|
// try initialize fabric on the first render, at this point we can
|
|
14
15
|
// reliably check if fabric is enabled (the function contains a flag
|
|
15
16
|
// to make sure it's called only once)
|
|
@@ -17,7 +18,11 @@ export default function GestureHandlerRootView(
|
|
|
17
18
|
|
|
18
19
|
return (
|
|
19
20
|
<GestureHandlerRootViewContext.Provider value>
|
|
20
|
-
<View {...
|
|
21
|
+
<View style={style ?? styles.container} {...rest} />
|
|
21
22
|
</GestureHandlerRootViewContext.Provider>
|
|
22
23
|
);
|
|
23
24
|
}
|
|
25
|
+
|
|
26
|
+
const styles = StyleSheet.create({
|
|
27
|
+
container: { flex: 1 },
|
|
28
|
+
});
|
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { PropsWithChildren } from 'react';
|
|
3
|
-
import { View, ViewProps } from 'react-native';
|
|
3
|
+
import { View, ViewProps, StyleSheet } from 'react-native';
|
|
4
4
|
import GestureHandlerRootViewContext from '../GestureHandlerRootViewContext';
|
|
5
5
|
|
|
6
6
|
export interface GestureHandlerRootViewProps
|
|
7
7
|
extends PropsWithChildren<ViewProps> {}
|
|
8
8
|
|
|
9
|
-
export default function GestureHandlerRootView(
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
export default function GestureHandlerRootView({
|
|
10
|
+
style,
|
|
11
|
+
...rest
|
|
12
|
+
}: GestureHandlerRootViewProps) {
|
|
12
13
|
return (
|
|
13
14
|
<GestureHandlerRootViewContext.Provider value>
|
|
14
|
-
<View {...
|
|
15
|
+
<View style={style ?? styles.container} {...rest} />
|
|
15
16
|
</GestureHandlerRootViewContext.Provider>
|
|
16
17
|
);
|
|
17
18
|
}
|
|
19
|
+
|
|
20
|
+
const styles = StyleSheet.create({
|
|
21
|
+
container: { flex: 1 },
|
|
22
|
+
});
|
|
@@ -541,6 +541,7 @@ export default class Swipeable extends Component<
|
|
|
541
541
|
return (
|
|
542
542
|
<PanGestureHandler
|
|
543
543
|
activeOffsetX={[-dragOffsetFromRightEdge, dragOffsetFromLeftEdge]}
|
|
544
|
+
touchAction="pan-y"
|
|
544
545
|
{...this.props}
|
|
545
546
|
onGestureEvent={this.onGestureEvent}
|
|
546
547
|
onHandlerStateChange={this.onHandlerStateChange}>
|
|
@@ -551,6 +552,7 @@ export default class Swipeable extends Component<
|
|
|
551
552
|
{right}
|
|
552
553
|
<TapGestureHandler
|
|
553
554
|
enabled={rowState !== 0}
|
|
555
|
+
touchAction="pan-y"
|
|
554
556
|
onHandlerStateChange={this.onTapHandlerStateChange}>
|
|
555
557
|
<Animated.View
|
|
556
558
|
pointerEvents={rowState === 0 ? 'auto' : 'box-only'}
|
|
@@ -15,6 +15,7 @@ import { BaseButton } from '../GestureButtons';
|
|
|
15
15
|
import {
|
|
16
16
|
GestureEvent,
|
|
17
17
|
HandlerStateChangeEvent,
|
|
18
|
+
UserSelect,
|
|
18
19
|
} from '../../handlers/gestureHandlerCommon';
|
|
19
20
|
import { NativeViewGestureHandlerPayload } from '../../handlers/NativeViewGestureHandler';
|
|
20
21
|
import { TouchableNativeFeedbackExtraProps } from './TouchableNativeFeedback.android';
|
|
@@ -51,6 +52,7 @@ export interface GenericTouchableProps
|
|
|
51
52
|
|
|
52
53
|
containerStyle?: StyleProp<ViewStyle>;
|
|
53
54
|
hitSlop?: Insets | number;
|
|
55
|
+
userSelect?: UserSelect;
|
|
54
56
|
}
|
|
55
57
|
|
|
56
58
|
interface InternalProps {
|
|
@@ -286,6 +288,7 @@ export default class GenericTouchable extends Component<
|
|
|
286
288
|
}
|
|
287
289
|
onGestureEvent={this.onGestureEvent}
|
|
288
290
|
hitSlop={hitSlop}
|
|
291
|
+
userSelect={this.props.userSelect}
|
|
289
292
|
shouldActivateOnStart={this.props.shouldActivateOnStart}
|
|
290
293
|
disallowInterruption={this.props.disallowInterruption}
|
|
291
294
|
testID={this.props.testID}
|
|
@@ -2,21 +2,43 @@
|
|
|
2
2
|
// attached view may get flattened on Fabric. This implementation causes errors
|
|
3
3
|
// on web due to the static resolution of `require` statements by webpack breaking
|
|
4
4
|
// the conditional importing. Solved by making .web file.
|
|
5
|
-
let findHostInstance_DEPRECATED: (ref:
|
|
5
|
+
let findHostInstance_DEPRECATED: (ref: unknown) => void;
|
|
6
|
+
let getInternalInstanceHandleFromPublicInstance: (ref: unknown) => {
|
|
7
|
+
stateNode: { node: unknown };
|
|
8
|
+
};
|
|
6
9
|
|
|
7
|
-
export function getShadowNodeFromRef(ref:
|
|
10
|
+
export function getShadowNodeFromRef(ref: unknown) {
|
|
8
11
|
// load findHostInstance_DEPRECATED lazily because it may not be available before render
|
|
9
12
|
if (findHostInstance_DEPRECATED === undefined) {
|
|
10
13
|
try {
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
11
15
|
findHostInstance_DEPRECATED =
|
|
12
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-unsafe-member-access
|
|
13
17
|
require('react-native/Libraries/Renderer/shims/ReactFabric').findHostInstance_DEPRECATED;
|
|
14
18
|
} catch (e) {
|
|
15
|
-
findHostInstance_DEPRECATED = (_ref:
|
|
19
|
+
findHostInstance_DEPRECATED = (_ref: unknown) => null;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// load findHostInstance_DEPRECATED lazily because it may not be available before render
|
|
24
|
+
if (getInternalInstanceHandleFromPublicInstance === undefined) {
|
|
25
|
+
try {
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
27
|
+
getInternalInstanceHandleFromPublicInstance =
|
|
28
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-unsafe-member-access
|
|
29
|
+
require('react-native/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance')
|
|
30
|
+
.getInternalInstanceHandleFromPublicInstance ??
|
|
31
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return
|
|
32
|
+
((ref: any) => ref._internalInstanceHandle);
|
|
33
|
+
} catch (e) {
|
|
34
|
+
getInternalInstanceHandleFromPublicInstance = (ref: any) =>
|
|
35
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return
|
|
36
|
+
ref._internalInstanceHandle;
|
|
16
37
|
}
|
|
17
38
|
}
|
|
18
39
|
|
|
19
40
|
// @ts-ignore Fabric
|
|
20
|
-
return
|
|
21
|
-
|
|
41
|
+
return getInternalInstanceHandleFromPublicInstance(
|
|
42
|
+
findHostInstance_DEPRECATED(ref)
|
|
43
|
+
).stateNode.node;
|
|
22
44
|
}
|
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
DeviceEventEmitter,
|
|
6
6
|
EmitterSubscription,
|
|
7
7
|
} from 'react-native';
|
|
8
|
+
import { customDirectEventTypes } from './customDirectEventTypes';
|
|
8
9
|
// @ts-ignore - it isn't typed by TS & don't have definitelyTyped types
|
|
9
10
|
import deepEqual from 'lodash/isEqual';
|
|
10
11
|
import RNGestureHandlerModule from '../RNGestureHandlerModule';
|
|
11
|
-
import type RNGestureHandlerModuleWeb from '../RNGestureHandlerModule.web';
|
|
12
12
|
import { State } from '../State';
|
|
13
13
|
import {
|
|
14
14
|
handlerIDToTag,
|
|
@@ -33,6 +33,10 @@ import { ghQueueMicrotask } from '../ghQueueMicrotask';
|
|
|
33
33
|
|
|
34
34
|
const UIManagerAny = UIManager as any;
|
|
35
35
|
|
|
36
|
+
customDirectEventTypes.topGestureHandlerEvent = {
|
|
37
|
+
registrationName: 'onGestureHandlerEvent',
|
|
38
|
+
};
|
|
39
|
+
|
|
36
40
|
const customGHEventsConfigFabricAndroid = {
|
|
37
41
|
topOnGestureHandlerEvent: { registrationName: 'onGestureHandlerEvent' },
|
|
38
42
|
topOnGestureHandlerStateChange: {
|
|
@@ -149,6 +153,14 @@ type InternalEventHandlers = {
|
|
|
149
153
|
onGestureHandlerStateChange?: (event: any) => void;
|
|
150
154
|
};
|
|
151
155
|
|
|
156
|
+
type AttachGestureHandlerWeb = (
|
|
157
|
+
handlerTag: number,
|
|
158
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
159
|
+
newView: any,
|
|
160
|
+
_actionType: ActionType,
|
|
161
|
+
propsRef: React.RefObject<unknown>
|
|
162
|
+
) => void;
|
|
163
|
+
|
|
152
164
|
const UNRESOLVED_REFS_RETRY_LIMIT = 1;
|
|
153
165
|
|
|
154
166
|
// TODO(TS) - make sure that BaseGestureHandlerProps doesn't need other generic parameter to work with custom properties.
|
|
@@ -315,7 +327,7 @@ export default function createHandler<
|
|
|
315
327
|
if (Platform.OS === 'web') {
|
|
316
328
|
// typecast due to dynamic resolution, attachGestureHandler should have web version signature in this branch
|
|
317
329
|
(
|
|
318
|
-
RNGestureHandlerModule.attachGestureHandler as
|
|
330
|
+
RNGestureHandlerModule.attachGestureHandler as AttachGestureHandlerWeb
|
|
319
331
|
)(
|
|
320
332
|
this.handlerTag,
|
|
321
333
|
newViewTag,
|
|
@@ -12,7 +12,7 @@ import { handlerIDToTag } from './handlersRegistry';
|
|
|
12
12
|
import { toArray } from '../utils';
|
|
13
13
|
import RNGestureHandlerModule from '../RNGestureHandlerModule';
|
|
14
14
|
import { ghQueueMicrotask } from '../ghQueueMicrotask';
|
|
15
|
-
import {
|
|
15
|
+
import { PointerType } from '../PointerType';
|
|
16
16
|
|
|
17
17
|
const commonProps = [
|
|
18
18
|
'id',
|
|
@@ -24,6 +24,7 @@ const commonProps = [
|
|
|
24
24
|
'activeCursor',
|
|
25
25
|
'mouseButton',
|
|
26
26
|
'enableContextMenu',
|
|
27
|
+
'touchAction',
|
|
27
28
|
] as const;
|
|
28
29
|
|
|
29
30
|
const componentInteractionProps = [
|
|
@@ -54,6 +55,7 @@ export interface GestureEventPayload {
|
|
|
54
55
|
handlerTag: number;
|
|
55
56
|
numberOfPointers: number;
|
|
56
57
|
state: ValueOf<typeof State>;
|
|
58
|
+
pointerType: PointerType;
|
|
57
59
|
}
|
|
58
60
|
export interface HandlerStateChangeEventPayload extends GestureEventPayload {
|
|
59
61
|
oldState: ValueOf<typeof State>;
|
|
@@ -111,6 +113,32 @@ export type ActiveCursor =
|
|
|
111
113
|
| 'zoom-in'
|
|
112
114
|
| 'zoom-out';
|
|
113
115
|
|
|
116
|
+
export enum MouseButton {
|
|
117
|
+
LEFT = 1,
|
|
118
|
+
RIGHT = 2,
|
|
119
|
+
MIDDLE = 4,
|
|
120
|
+
BUTTON_4 = 8,
|
|
121
|
+
BUTTON_5 = 16,
|
|
122
|
+
ALL = 31,
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export type TouchAction =
|
|
126
|
+
| 'auto'
|
|
127
|
+
| 'none'
|
|
128
|
+
| 'pan-x'
|
|
129
|
+
| 'pan-left'
|
|
130
|
+
| 'pan-right'
|
|
131
|
+
| 'pan-y'
|
|
132
|
+
| 'pan-up'
|
|
133
|
+
| 'pan-down'
|
|
134
|
+
| 'pinch-zoom'
|
|
135
|
+
| 'manipulation'
|
|
136
|
+
| 'inherit'
|
|
137
|
+
| 'initial'
|
|
138
|
+
| 'revert'
|
|
139
|
+
| 'revert-layer'
|
|
140
|
+
| 'unset';
|
|
141
|
+
|
|
114
142
|
//TODO(TS) events in handlers
|
|
115
143
|
|
|
116
144
|
export interface GestureEvent<ExtraEventPayloadT = Record<string, unknown>> {
|
|
@@ -154,6 +182,7 @@ export type CommonGestureConfig = {
|
|
|
154
182
|
activeCursor?: ActiveCursor;
|
|
155
183
|
mouseButton?: MouseButton;
|
|
156
184
|
enableContextMenu?: boolean;
|
|
185
|
+
touchAction?: TouchAction;
|
|
157
186
|
};
|
|
158
187
|
|
|
159
188
|
// Events payloads are types instead of interfaces due to TS limitation.
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
HandlerStateChangeEvent,
|
|
20
20
|
scheduleFlushOperations,
|
|
21
21
|
UserSelect,
|
|
22
|
+
TouchAction,
|
|
22
23
|
} from '../gestureHandlerCommon';
|
|
23
24
|
import {
|
|
24
25
|
GestureStateManager,
|
|
@@ -614,11 +615,21 @@ const applyEnableContextMenuProp = (
|
|
|
614
615
|
}
|
|
615
616
|
};
|
|
616
617
|
|
|
618
|
+
const applyTouchActionProp = (
|
|
619
|
+
touchAction: TouchAction,
|
|
620
|
+
gesture: ComposedGesture | GestureType
|
|
621
|
+
): void => {
|
|
622
|
+
for (const g of gesture.toGestureArray()) {
|
|
623
|
+
g.config.touchAction = touchAction;
|
|
624
|
+
}
|
|
625
|
+
};
|
|
626
|
+
|
|
617
627
|
interface GestureDetectorProps {
|
|
618
628
|
gesture: ComposedGesture | GestureType;
|
|
619
629
|
children?: React.ReactNode;
|
|
620
630
|
userSelect?: UserSelect;
|
|
621
631
|
enableContextMenu?: boolean;
|
|
632
|
+
touchAction?: TouchAction;
|
|
622
633
|
}
|
|
623
634
|
interface GestureDetectorState {
|
|
624
635
|
firstRender: boolean;
|
|
@@ -644,6 +655,10 @@ export const GestureDetector = (props: GestureDetectorProps) => {
|
|
|
644
655
|
applyEnableContextMenuProp(props.enableContextMenu, gestureConfig);
|
|
645
656
|
}
|
|
646
657
|
|
|
658
|
+
if (props.touchAction !== undefined) {
|
|
659
|
+
applyTouchActionProp(props.touchAction, gestureConfig);
|
|
660
|
+
}
|
|
661
|
+
|
|
647
662
|
const gesture = gestureConfig.toGestureArray();
|
|
648
663
|
const useReanimatedHook = gesture.some((g) => g.shouldUseReanimated);
|
|
649
664
|
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
GestureStateChangeEvent,
|
|
8
8
|
GestureUpdateEvent,
|
|
9
9
|
ActiveCursor,
|
|
10
|
+
MouseButton,
|
|
10
11
|
} from '../gestureHandlerCommon';
|
|
11
12
|
import { getNextHandlerTag } from '../handlersRegistry';
|
|
12
13
|
import { GestureStateManagerType } from './gestureStateManager';
|
|
@@ -17,7 +18,6 @@ import { RotationGestureHandlerEventPayload } from '../RotationGestureHandler';
|
|
|
17
18
|
import { TapGestureHandlerEventPayload } from '../TapGestureHandler';
|
|
18
19
|
import { NativeViewGestureHandlerPayload } from '../NativeViewGestureHandler';
|
|
19
20
|
import { isRemoteDebuggingEnabled } from '../../utils';
|
|
20
|
-
import { MouseButton } from '../../web/interfaces';
|
|
21
21
|
|
|
22
22
|
export type GestureType =
|
|
23
23
|
| BaseGesture<Record<string, unknown>>
|
package/src/index.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { initialize } from './init';
|
|
|
2
2
|
|
|
3
3
|
export { Directions } from './Directions';
|
|
4
4
|
export { State } from './State';
|
|
5
|
-
export {
|
|
5
|
+
export { PointerType } from './PointerType';
|
|
6
6
|
export { default as gestureHandlerRootHOC } from './components/gestureHandlerRootHOC';
|
|
7
7
|
export { default as GestureHandlerRootView } from './components/GestureHandlerRootView';
|
|
8
8
|
export type {
|
|
@@ -19,6 +19,7 @@ export type {
|
|
|
19
19
|
GestureUpdateEvent,
|
|
20
20
|
GestureStateChangeEvent,
|
|
21
21
|
} from './handlers/gestureHandlerCommon';
|
|
22
|
+
export { MouseButton } from './handlers/gestureHandlerCommon';
|
|
22
23
|
export type { GestureType } from './handlers/gestures/gesture';
|
|
23
24
|
export type {
|
|
24
25
|
TapGestureHandlerEventPayload,
|
package/src/mocks.ts
CHANGED
|
@@ -22,6 +22,7 @@ const createGestureHandler = NOOP;
|
|
|
22
22
|
const dropGestureHandler = NOOP;
|
|
23
23
|
const updateGestureHandler = NOOP;
|
|
24
24
|
const flushOperations = NOOP;
|
|
25
|
+
const install = NOOP;
|
|
25
26
|
const NativeViewGestureHandler = View;
|
|
26
27
|
const TapGestureHandler = View;
|
|
27
28
|
const ForceTouchGestureHandler = View;
|
|
@@ -61,6 +62,7 @@ export default {
|
|
|
61
62
|
dropGestureHandler,
|
|
62
63
|
updateGestureHandler,
|
|
63
64
|
flushOperations,
|
|
65
|
+
install,
|
|
64
66
|
// probably can be removed
|
|
65
67
|
Directions,
|
|
66
68
|
State,
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { TurboModuleRegistry, TurboModule } from 'react-native';
|
|
2
|
-
import {
|
|
2
|
+
import { Double } from 'react-native/Libraries/Types/CodegenTypes';
|
|
3
3
|
|
|
4
4
|
export interface Spec extends TurboModule {
|
|
5
|
-
handleSetJSResponder: (tag:
|
|
5
|
+
handleSetJSResponder: (tag: Double, blockNativeResponder: boolean) => void;
|
|
6
6
|
handleClearJSResponder: () => void;
|
|
7
7
|
createGestureHandler: (
|
|
8
8
|
handlerName: string,
|
|
9
|
-
handlerTag:
|
|
9
|
+
handlerTag: Double,
|
|
10
10
|
// Record<> is not supported by codegen
|
|
11
11
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
12
12
|
config: Object
|
|
13
13
|
) => void;
|
|
14
14
|
attachGestureHandler: (
|
|
15
|
-
handlerTag:
|
|
16
|
-
newView:
|
|
17
|
-
actionType:
|
|
15
|
+
handlerTag: Double,
|
|
16
|
+
newView: Double,
|
|
17
|
+
actionType: Double
|
|
18
18
|
) => void;
|
|
19
19
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
20
|
-
updateGestureHandler: (handlerTag:
|
|
21
|
-
dropGestureHandler: (handlerTag:
|
|
20
|
+
updateGestureHandler: (handlerTag: Double, newConfig: Object) => void;
|
|
21
|
+
dropGestureHandler: (handlerTag: Double) => void;
|
|
22
22
|
install: () => boolean;
|
|
23
23
|
flushOperations: () => void;
|
|
24
24
|
}
|
|
@@ -2,6 +2,7 @@ import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNati
|
|
|
2
2
|
import type {
|
|
3
3
|
Int32,
|
|
4
4
|
WithDefault,
|
|
5
|
+
Float,
|
|
5
6
|
} from 'react-native/Libraries/Types/CodegenTypes';
|
|
6
7
|
import type { ViewProps, ColorValue } from 'react-native';
|
|
7
8
|
|
|
@@ -13,6 +14,9 @@ interface NativeProps extends ViewProps {
|
|
|
13
14
|
rippleColor?: ColorValue;
|
|
14
15
|
rippleRadius?: Int32;
|
|
15
16
|
touchSoundDisabled?: WithDefault<boolean, false>;
|
|
17
|
+
borderWidth?: Float;
|
|
18
|
+
borderColor?: ColorValue;
|
|
19
|
+
borderStyle?: WithDefault<string, 'solid'>;
|
|
16
20
|
}
|
|
17
21
|
|
|
18
22
|
export default codegenNativeComponent<NativeProps>('RNGestureHandlerButton');
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// Gesture Handlers
|
|
2
|
+
import PanGestureHandler from './handlers/PanGestureHandler';
|
|
3
|
+
import TapGestureHandler from './handlers/TapGestureHandler';
|
|
4
|
+
import LongPressGestureHandler from './handlers/LongPressGestureHandler';
|
|
5
|
+
import PinchGestureHandler from './handlers/PinchGestureHandler';
|
|
6
|
+
import RotationGestureHandler from './handlers/RotationGestureHandler';
|
|
7
|
+
import FlingGestureHandler from './handlers/FlingGestureHandler';
|
|
8
|
+
import NativeViewGestureHandler from './handlers/NativeViewGestureHandler';
|
|
9
|
+
import ManualGestureHandler from './handlers/ManualGestureHandler';
|
|
10
|
+
import HoverGestureHandler from './handlers/HoverGestureHandler';
|
|
11
|
+
|
|
12
|
+
//Hammer Handlers
|
|
13
|
+
import HammerNativeViewGestureHandler from '../web_hammer/NativeViewGestureHandler';
|
|
14
|
+
import HammerPanGestureHandler from '../web_hammer/PanGestureHandler';
|
|
15
|
+
import HammerTapGestureHandler from '../web_hammer/TapGestureHandler';
|
|
16
|
+
import HammerLongPressGestureHandler from '../web_hammer/LongPressGestureHandler';
|
|
17
|
+
import HammerPinchGestureHandler from '../web_hammer/PinchGestureHandler';
|
|
18
|
+
import HammerRotationGestureHandler from '../web_hammer/RotationGestureHandler';
|
|
19
|
+
import HammerFlingGestureHandler from '../web_hammer/FlingGestureHandler';
|
|
20
|
+
|
|
21
|
+
export const Gestures = {
|
|
22
|
+
NativeViewGestureHandler,
|
|
23
|
+
PanGestureHandler,
|
|
24
|
+
TapGestureHandler,
|
|
25
|
+
LongPressGestureHandler,
|
|
26
|
+
PinchGestureHandler,
|
|
27
|
+
RotationGestureHandler,
|
|
28
|
+
FlingGestureHandler,
|
|
29
|
+
ManualGestureHandler,
|
|
30
|
+
HoverGestureHandler,
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const HammerGestures = {
|
|
34
|
+
NativeViewGestureHandler: HammerNativeViewGestureHandler,
|
|
35
|
+
PanGestureHandler: HammerPanGestureHandler,
|
|
36
|
+
TapGestureHandler: HammerTapGestureHandler,
|
|
37
|
+
LongPressGestureHandler: HammerLongPressGestureHandler,
|
|
38
|
+
PinchGestureHandler: HammerPinchGestureHandler,
|
|
39
|
+
RotationGestureHandler: HammerRotationGestureHandler,
|
|
40
|
+
FlingGestureHandler: HammerFlingGestureHandler,
|
|
41
|
+
};
|