react-native-gesture-handler 2.8.0 → 2.10.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +1 -0
- package/RNGestureHandler.podspec +2 -2
- package/android/build.gradle +107 -65
- package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandler.kt +1 -1
- package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt +2 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/NativeViewGestureHandler.kt +39 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt +9 -2
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEvent.kt +14 -2
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.kt +5 -1
- package/android/src/main/jni/CMakeLists.txt +10 -44
- package/android/src/main/jni/cpp-adapter.cpp +16 -13
- package/ios/Handlers/RNFlingHandler.m +39 -37
- package/ios/Handlers/RNForceTouchHandler.m +19 -17
- package/ios/Handlers/RNLongPressHandler.m +20 -22
- package/ios/Handlers/RNManualHandler.m +2 -3
- package/ios/Handlers/RNNativeViewHandler.mm +96 -92
- package/ios/Handlers/RNPanHandler.m +28 -32
- package/ios/Handlers/RNPinchHandler.m +9 -10
- package/ios/Handlers/RNRotationHandler.m +11 -14
- package/ios/Handlers/RNTapHandler.m +26 -26
- package/ios/RNGestureHandler.h +31 -24
- package/ios/RNGestureHandler.m +278 -273
- package/ios/RNGestureHandlerActionType.h +6 -4
- package/ios/RNGestureHandlerButton.m +11 -12
- package/ios/RNGestureHandlerButtonComponentView.h +2 -2
- package/ios/RNGestureHandlerButtonComponentView.mm +2 -2
- package/ios/RNGestureHandlerButtonManager.m +6 -5
- package/ios/RNGestureHandlerDirection.h +4 -4
- package/ios/RNGestureHandlerEvents.h +3 -4
- package/ios/RNGestureHandlerEvents.m +114 -119
- package/ios/RNGestureHandlerManager.h +1 -2
- package/ios/RNGestureHandlerManager.mm +9 -9
- package/ios/RNGestureHandlerModule.h +1 -2
- package/ios/RNGestureHandlerModule.mm +142 -138
- package/ios/RNGestureHandlerPointerTracker.h +1 -1
- package/ios/RNGestureHandlerPointerTracker.m +40 -37
- package/ios/RNGestureHandlerRegistry.h +3 -1
- package/ios/RNGestureHandlerRegistry.m +24 -22
- package/ios/RNGestureHandlerRootViewComponentView.mm +2 -2
- package/ios/RNGestureHandlerState.h +6 -6
- package/ios/RNGestureHandlerStateManager.h +1 -1
- package/ios/RNManualActivationRecognizer.m +9 -9
- package/ios/RNRootViewGestureRecognizer.m +39 -42
- package/lib/commonjs/EnableNewWebImplementation.js +35 -0
- package/lib/commonjs/EnableNewWebImplementation.js.map +1 -0
- package/lib/commonjs/GestureHandlerRootViewContext.js +15 -0
- package/lib/commonjs/GestureHandlerRootViewContext.js.map +1 -0
- package/lib/commonjs/RNGestureHandlerModule.macos.js +6 -6
- package/lib/commonjs/RNGestureHandlerModule.macos.js.map +1 -1
- package/lib/commonjs/RNGestureHandlerModule.web.js +6 -6
- package/lib/commonjs/RNGestureHandlerModule.web.js.map +1 -1
- package/lib/commonjs/RNGestureHandlerModule.windows.js +6 -6
- package/lib/commonjs/RNGestureHandlerModule.windows.js.map +1 -1
- package/lib/commonjs/components/DrawerLayout.js.map +1 -1
- package/lib/commonjs/components/GestureComponents.web.js +6 -5
- package/lib/commonjs/components/GestureComponents.web.js.map +1 -1
- package/lib/commonjs/components/GestureHandlerButton.js +3 -5
- package/lib/commonjs/components/GestureHandlerButton.js.map +1 -1
- package/lib/commonjs/{GestureHandlerRootView.android.js → components/GestureHandlerRootView.android.js} +8 -7
- package/lib/commonjs/components/GestureHandlerRootView.android.js.map +1 -0
- package/lib/commonjs/{GestureHandlerRootView.js → components/GestureHandlerRootView.js} +8 -2
- package/lib/commonjs/components/GestureHandlerRootView.js.map +1 -0
- package/lib/commonjs/{GestureHandlerRootView.web.js → components/GestureHandlerRootView.web.js} +7 -1
- package/lib/commonjs/components/GestureHandlerRootView.web.js.map +1 -0
- package/lib/commonjs/components/Swipeable.js +17 -3
- package/lib/commonjs/components/Swipeable.js.map +1 -1
- package/lib/commonjs/{gestureHandlerRootHOC.js → components/gestureHandlerRootHOC.js} +2 -1
- package/lib/commonjs/components/gestureHandlerRootHOC.js.map +1 -0
- package/lib/commonjs/handlers/LongPressGestureHandler.js +3 -1
- package/lib/commonjs/handlers/LongPressGestureHandler.js.map +1 -1
- package/lib/commonjs/handlers/TapGestureHandler.js +3 -1
- package/lib/commonjs/handlers/TapGestureHandler.js.map +1 -1
- package/lib/commonjs/handlers/createHandler.js +21 -13
- package/lib/commonjs/handlers/createHandler.js.map +1 -1
- package/lib/commonjs/handlers/gestureHandlerCommon.js +5 -4
- package/lib/commonjs/handlers/gestureHandlerCommon.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector.js +89 -37
- package/lib/commonjs/handlers/gestures/GestureDetector.js.map +1 -1
- package/lib/commonjs/handlers/gestures/longPressGesture.js +1 -0
- package/lib/commonjs/handlers/gestures/longPressGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/reanimatedWrapper.js +22 -19
- package/lib/commonjs/handlers/gestures/reanimatedWrapper.js.map +1 -1
- package/lib/commonjs/handlers/gestures/tapGesture.js +1 -0
- package/lib/commonjs/handlers/gestures/tapGesture.js.map +1 -1
- package/lib/commonjs/index.js +16 -4
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/utils.js +0 -6
- package/lib/commonjs/utils.js.map +1 -1
- package/lib/commonjs/web/handlers/FlingGestureHandler.js +0 -5
- package/lib/commonjs/web/handlers/FlingGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/GestureHandler.js +3 -0
- package/lib/commonjs/web/handlers/GestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/LongPressGestureHandler.js +0 -1
- package/lib/commonjs/web/handlers/LongPressGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/ManualGestureHandler.js +0 -5
- package/lib/commonjs/web/handlers/ManualGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/NativeViewGestureHandler.js +0 -6
- package/lib/commonjs/web/handlers/NativeViewGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/PanGestureHandler.js +2 -12
- package/lib/commonjs/web/handlers/PanGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/PinchGestureHandler.js +0 -5
- package/lib/commonjs/web/handlers/PinchGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/RotationGestureHandler.js +0 -6
- package/lib/commonjs/web/handlers/RotationGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/TapGestureHandler.js +0 -7
- package/lib/commonjs/web/handlers/TapGestureHandler.js.map +1 -1
- package/lib/commonjs/web/tools/CircularBuffer.js +59 -0
- package/lib/commonjs/web/tools/CircularBuffer.js.map +1 -0
- package/lib/commonjs/web/tools/LeastSquareSolver.js +204 -0
- package/lib/commonjs/web/tools/LeastSquareSolver.js.map +1 -0
- package/lib/commonjs/web/tools/PointerEventManager.js +27 -0
- package/lib/commonjs/web/tools/PointerEventManager.js.map +1 -1
- package/lib/commonjs/web/tools/PointerTracker.js +11 -7
- package/lib/commonjs/web/tools/PointerTracker.js.map +1 -1
- package/lib/commonjs/web/tools/VelocityTracker.js +111 -0
- package/lib/commonjs/web/tools/VelocityTracker.js.map +1 -0
- package/lib/commonjs/web_hammer/GestureHandler.js +1 -1
- package/lib/commonjs/web_hammer/GestureHandler.js.map +1 -1
- package/lib/module/EnableNewWebImplementation.js +22 -0
- package/lib/module/EnableNewWebImplementation.js.map +1 -0
- package/lib/module/GestureHandlerRootViewContext.js +3 -0
- package/lib/module/GestureHandlerRootViewContext.js.map +1 -0
- package/lib/module/RNGestureHandlerModule.macos.js +6 -6
- package/lib/module/RNGestureHandlerModule.macos.js.map +1 -1
- package/lib/module/RNGestureHandlerModule.web.js +6 -6
- package/lib/module/RNGestureHandlerModule.web.js.map +1 -1
- package/lib/module/RNGestureHandlerModule.windows.js +6 -6
- package/lib/module/RNGestureHandlerModule.windows.js.map +1 -1
- package/lib/module/components/DrawerLayout.js.map +1 -1
- package/lib/module/components/GestureComponents.web.js +5 -6
- package/lib/module/components/GestureComponents.web.js.map +1 -1
- package/lib/module/components/GestureHandlerButton.js +1 -4
- package/lib/module/components/GestureHandlerButton.js.map +1 -1
- package/lib/module/components/GestureHandlerRootView.android.js +14 -0
- package/lib/module/components/GestureHandlerRootView.android.js.map +1 -0
- package/lib/module/{GestureHandlerRootView.js → components/GestureHandlerRootView.js} +5 -2
- package/lib/module/components/GestureHandlerRootView.js.map +1 -0
- package/lib/module/components/GestureHandlerRootView.web.js +9 -0
- package/lib/module/components/GestureHandlerRootView.web.js.map +1 -0
- package/lib/module/components/Swipeable.js +17 -3
- package/lib/module/components/Swipeable.js.map +1 -1
- package/lib/module/{gestureHandlerRootHOC.js → components/gestureHandlerRootHOC.js} +2 -1
- package/lib/module/components/gestureHandlerRootHOC.js.map +1 -0
- package/lib/module/handlers/LongPressGestureHandler.js +3 -1
- package/lib/module/handlers/LongPressGestureHandler.js.map +1 -1
- package/lib/module/handlers/TapGestureHandler.js +3 -1
- package/lib/module/handlers/TapGestureHandler.js.map +1 -1
- package/lib/module/handlers/createHandler.js +20 -13
- package/lib/module/handlers/createHandler.js.map +1 -1
- package/lib/module/handlers/gestureHandlerCommon.js +5 -4
- package/lib/module/handlers/gestureHandlerCommon.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector.js +89 -38
- package/lib/module/handlers/gestures/GestureDetector.js.map +1 -1
- package/lib/module/handlers/gestures/longPressGesture.js +1 -0
- package/lib/module/handlers/gestures/longPressGesture.js.map +1 -1
- package/lib/module/handlers/gestures/reanimatedWrapper.js +19 -16
- package/lib/module/handlers/gestures/reanimatedWrapper.js.map +1 -1
- package/lib/module/handlers/gestures/tapGesture.js +1 -0
- package/lib/module/handlers/gestures/tapGesture.js.map +1 -1
- package/lib/module/index.js +4 -4
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils.js +0 -4
- package/lib/module/utils.js.map +1 -1
- package/lib/module/web/handlers/FlingGestureHandler.js +0 -5
- package/lib/module/web/handlers/FlingGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/GestureHandler.js +3 -0
- package/lib/module/web/handlers/GestureHandler.js.map +1 -1
- package/lib/module/web/handlers/LongPressGestureHandler.js +0 -1
- package/lib/module/web/handlers/LongPressGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/ManualGestureHandler.js +0 -5
- package/lib/module/web/handlers/ManualGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/NativeViewGestureHandler.js +0 -6
- package/lib/module/web/handlers/NativeViewGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/PanGestureHandler.js +2 -9
- package/lib/module/web/handlers/PanGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/PinchGestureHandler.js +0 -5
- package/lib/module/web/handlers/PinchGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/RotationGestureHandler.js +0 -6
- package/lib/module/web/handlers/RotationGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/TapGestureHandler.js +0 -7
- package/lib/module/web/handlers/TapGestureHandler.js.map +1 -1
- package/lib/module/web/tools/CircularBuffer.js +50 -0
- package/lib/module/web/tools/CircularBuffer.js.map +1 -0
- package/lib/module/web/tools/LeastSquareSolver.js +195 -0
- package/lib/module/web/tools/LeastSquareSolver.js.map +1 -0
- package/lib/module/web/tools/PointerEventManager.js +27 -0
- package/lib/module/web/tools/PointerEventManager.js.map +1 -1
- package/lib/module/web/tools/PointerTracker.js +8 -7
- package/lib/module/web/tools/PointerTracker.js.map +1 -1
- package/lib/module/web/tools/VelocityTracker.js +98 -0
- package/lib/module/web/tools/VelocityTracker.js.map +1 -0
- package/lib/module/web_hammer/GestureHandler.js +1 -1
- package/lib/module/web_hammer/GestureHandler.js.map +1 -1
- package/lib/typescript/EnableNewWebImplementation.d.ts +3 -0
- package/lib/typescript/GestureHandlerRootViewContext.d.ts +3 -0
- package/lib/typescript/components/DrawerLayout.d.ts +3 -1
- package/lib/typescript/components/GestureComponents.web.d.ts +1 -1
- package/lib/typescript/components/Swipeable.d.ts +14 -2
- package/lib/typescript/components/gestureHandlerRootHOC.d.ts +3 -0
- package/lib/typescript/index.d.ts +4 -4
- package/lib/typescript/{fabric → specs}/RNGestureHandlerButtonNativeComponent.d.ts +1 -1
- package/lib/typescript/{fabric → specs}/RNGestureHandlerRootViewNativeComponent.d.ts +1 -1
- package/lib/typescript/utils.d.ts +0 -1
- package/lib/typescript/web/handlers/FlingGestureHandler.d.ts +0 -1
- package/lib/typescript/web/handlers/ManualGestureHandler.d.ts +0 -1
- package/lib/typescript/web/handlers/NativeViewGestureHandler.d.ts +0 -1
- package/lib/typescript/web/handlers/PanGestureHandler.d.ts +0 -1
- package/lib/typescript/web/handlers/PinchGestureHandler.d.ts +0 -1
- package/lib/typescript/web/handlers/RotationGestureHandler.d.ts +0 -1
- package/lib/typescript/web/handlers/TapGestureHandler.d.ts +0 -1
- package/lib/typescript/web/tools/CircularBuffer.d.ts +11 -0
- package/lib/typescript/web/tools/LeastSquareSolver.d.ts +12 -0
- package/lib/typescript/web/tools/PointerEventManager.d.ts +2 -0
- package/lib/typescript/web/tools/PointerTracker.d.ts +1 -0
- package/lib/typescript/web/tools/VelocityTracker.d.ts +13 -0
- package/package.json +6 -7
- package/src/EnableNewWebImplementation.ts +35 -0
- package/src/GestureHandlerRootViewContext.ts +3 -0
- package/src/RNGestureHandlerModule.macos.ts +6 -6
- package/src/RNGestureHandlerModule.web.ts +6 -6
- package/src/RNGestureHandlerModule.windows.ts +6 -6
- package/src/components/DrawerLayout.tsx +8 -4
- package/src/components/GestureComponents.web.tsx +5 -6
- package/src/components/GestureHandlerButton.tsx +2 -7
- package/src/components/GestureHandlerRootView.android.tsx +24 -0
- package/src/{GestureHandlerRootView.tsx → components/GestureHandlerRootView.tsx} +7 -2
- package/src/{GestureHandlerRootView.web.tsx → components/GestureHandlerRootView.web.tsx} +6 -1
- package/src/components/Swipeable.tsx +43 -12
- package/src/{gestureHandlerRootHOC.tsx → components/gestureHandlerRootHOC.tsx} +4 -1
- package/src/handlers/LongPressGestureHandler.ts +3 -1
- package/src/handlers/TapGestureHandler.ts +3 -1
- package/src/handlers/createHandler.tsx +20 -9
- package/src/handlers/gestureHandlerCommon.ts +5 -6
- package/src/handlers/gestures/GestureDetector.tsx +99 -36
- package/src/handlers/gestures/longPressGesture.ts +1 -0
- package/src/handlers/gestures/reanimatedWrapper.ts +21 -20
- package/src/handlers/gestures/tapGesture.ts +1 -0
- package/src/index.ts +7 -3
- package/src/utils.ts +0 -5
- package/src/web/handlers/FlingGestureHandler.ts +0 -5
- package/src/web/handlers/GestureHandler.ts +3 -0
- package/src/web/handlers/LongPressGestureHandler.ts +0 -1
- package/src/web/handlers/ManualGestureHandler.ts +0 -5
- package/src/web/handlers/NativeViewGestureHandler.ts +0 -6
- package/src/web/handlers/PanGestureHandler.ts +2 -9
- package/src/web/handlers/PinchGestureHandler.ts +0 -5
- package/src/web/handlers/RotationGestureHandler.ts +0 -7
- package/src/web/handlers/TapGestureHandler.ts +0 -7
- package/src/web/tools/CircularBuffer.ts +42 -0
- package/src/web/tools/LeastSquareSolver.ts +182 -0
- package/src/web/tools/PointerEventManager.ts +29 -0
- package/src/web/tools/PointerTracker.ts +7 -7
- package/src/web/tools/VelocityTracker.ts +98 -0
- package/src/web_hammer/GestureHandler.ts +1 -1
- package/lib/commonjs/EnableExperimentalWebImplementation.js +0 -31
- package/lib/commonjs/EnableExperimentalWebImplementation.js.map +0 -1
- package/lib/commonjs/GestureHandlerRootView.android.js.map +0 -1
- package/lib/commonjs/GestureHandlerRootView.js.map +0 -1
- package/lib/commonjs/GestureHandlerRootView.web.js.map +0 -1
- package/lib/commonjs/gestureHandlerRootHOC.js.map +0 -1
- package/lib/module/EnableExperimentalWebImplementation.js +0 -20
- package/lib/module/EnableExperimentalWebImplementation.js.map +0 -1
- package/lib/module/GestureHandlerRootView.android.js +0 -14
- package/lib/module/GestureHandlerRootView.android.js.map +0 -1
- package/lib/module/GestureHandlerRootView.js.map +0 -1
- package/lib/module/GestureHandlerRootView.web.js +0 -6
- package/lib/module/GestureHandlerRootView.web.js.map +0 -1
- package/lib/module/gestureHandlerRootHOC.js.map +0 -1
- package/lib/typescript/EnableExperimentalWebImplementation.d.ts +0 -2
- package/lib/typescript/gestureHandlerRootHOC.d.ts +0 -3
- package/src/EnableExperimentalWebImplementation.ts +0 -27
- package/src/GestureHandlerRootView.android.tsx +0 -24
- /package/lib/commonjs/{fabric → specs}/RNGestureHandlerButtonNativeComponent.js +0 -0
- /package/lib/commonjs/{fabric → specs}/RNGestureHandlerButtonNativeComponent.js.map +0 -0
- /package/lib/commonjs/{fabric → specs}/RNGestureHandlerRootViewNativeComponent.js +0 -0
- /package/lib/commonjs/{fabric → specs}/RNGestureHandlerRootViewNativeComponent.js.map +0 -0
- /package/lib/module/{fabric → specs}/RNGestureHandlerButtonNativeComponent.js +0 -0
- /package/lib/module/{fabric → specs}/RNGestureHandlerButtonNativeComponent.js.map +0 -0
- /package/lib/module/{fabric → specs}/RNGestureHandlerRootViewNativeComponent.js +0 -0
- /package/lib/module/{fabric → specs}/RNGestureHandlerRootViewNativeComponent.js.map +0 -0
- /package/lib/typescript/{GestureHandlerRootView.android.d.ts → components/GestureHandlerRootView.android.d.ts} +0 -0
- /package/lib/typescript/{GestureHandlerRootView.d.ts → components/GestureHandlerRootView.d.ts} +0 -0
- /package/lib/typescript/{GestureHandlerRootView.web.d.ts → components/GestureHandlerRootView.web.d.ts} +0 -0
- /package/src/{fabric → specs}/RNGestureHandlerButtonNativeComponent.ts +0 -0
- /package/src/{fabric → specs}/RNGestureHandlerRootViewNativeComponent.ts +0 -0
@@ -11,51 +11,53 @@
|
|
11
11
|
#import <React/RCTAssert.h>
|
12
12
|
|
13
13
|
@implementation RNGestureHandlerRegistry {
|
14
|
-
|
14
|
+
NSMutableDictionary<NSNumber *, RNGestureHandler *> *_handlers;
|
15
15
|
}
|
16
16
|
|
17
17
|
- (instancetype)init
|
18
18
|
{
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
if ((self = [super init])) {
|
20
|
+
_handlers = [NSMutableDictionary new];
|
21
|
+
}
|
22
|
+
return self;
|
23
23
|
}
|
24
24
|
|
25
25
|
- (RNGestureHandler *)handlerWithTag:(NSNumber *)handlerTag
|
26
26
|
{
|
27
|
-
|
27
|
+
return _handlers[handlerTag];
|
28
28
|
}
|
29
29
|
|
30
30
|
- (void)registerGestureHandler:(RNGestureHandler *)gestureHandler
|
31
31
|
{
|
32
|
-
|
32
|
+
_handlers[gestureHandler.tag] = gestureHandler;
|
33
33
|
}
|
34
34
|
|
35
|
-
- (void)attachHandlerWithTag:(NSNumber *)handlerTag
|
35
|
+
- (void)attachHandlerWithTag:(NSNumber *)handlerTag
|
36
|
+
toView:(UIView *)view
|
37
|
+
withActionType:(RNGestureHandlerActionType)actionType
|
36
38
|
{
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
39
|
+
RNGestureHandler *handler = _handlers[handlerTag];
|
40
|
+
RCTAssert(handler != nil, @"Handler for tag %@ does not exists", handlerTag);
|
41
|
+
[handler unbindFromView];
|
42
|
+
handler.actionType = actionType;
|
43
|
+
[handler bindToView:view];
|
42
44
|
}
|
43
45
|
|
44
46
|
- (void)dropHandlerWithTag:(NSNumber *)handlerTag
|
45
47
|
{
|
46
|
-
|
47
|
-
|
48
|
-
|
48
|
+
RNGestureHandler *handler = _handlers[handlerTag];
|
49
|
+
[handler unbindFromView];
|
50
|
+
[_handlers removeObjectForKey:handlerTag];
|
49
51
|
}
|
50
52
|
|
51
53
|
- (void)dropAllHandlers
|
52
54
|
{
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
55
|
+
for (NSNumber *tag in _handlers) {
|
56
|
+
RNGestureHandler *handler = _handlers[tag];
|
57
|
+
[handler unbindFromView];
|
58
|
+
}
|
59
|
+
|
60
|
+
[_handlers removeAllObjects];
|
59
61
|
}
|
60
62
|
|
61
63
|
@end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#ifdef
|
1
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
2
2
|
|
3
3
|
#import <React/RCTFabricComponentsPlugins.h>
|
4
4
|
|
@@ -18,4 +18,4 @@ Class<RCTComponentViewProtocol> RNGestureHandlerRootViewCls(void)
|
|
18
18
|
return nil;
|
19
19
|
}
|
20
20
|
|
21
|
-
#endif //
|
21
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
@@ -1,10 +1,10 @@
|
|
1
1
|
#import <Foundation/Foundation.h>
|
2
2
|
|
3
3
|
typedef NS_ENUM(NSInteger, RNGestureHandlerState) {
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
4
|
+
RNGestureHandlerStateUndetermined = 0,
|
5
|
+
RNGestureHandlerStateFailed,
|
6
|
+
RNGestureHandlerStateBegan,
|
7
|
+
RNGestureHandlerStateCancelled,
|
8
|
+
RNGestureHandlerStateActive,
|
9
|
+
RNGestureHandlerStateEnd,
|
10
10
|
};
|
@@ -18,10 +18,10 @@
|
|
18
18
|
|
19
19
|
- (void)handleGesture:(UIGestureRecognizer *)recognizer
|
20
20
|
{
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
21
|
+
if (recognizer.state == UIGestureRecognizerStateBegan) {
|
22
|
+
self.state = UIGestureRecognizerStateEnded;
|
23
|
+
[self reset];
|
24
|
+
}
|
25
25
|
}
|
26
26
|
|
27
27
|
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
|
@@ -39,9 +39,9 @@
|
|
39
39
|
- (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
|
40
40
|
{
|
41
41
|
[super touchesEnded:touches withEvent:event];
|
42
|
-
|
42
|
+
|
43
43
|
_activePointers -= touches.count;
|
44
|
-
|
44
|
+
|
45
45
|
if (_activePointers == 0) {
|
46
46
|
self.state = UIGestureRecognizerStateBegan;
|
47
47
|
}
|
@@ -50,7 +50,7 @@
|
|
50
50
|
- (void)touchesCancelled:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
|
51
51
|
{
|
52
52
|
[super touchesCancelled:touches withEvent:event];
|
53
|
-
|
53
|
+
|
54
54
|
_activePointers = 0;
|
55
55
|
[self reset];
|
56
56
|
}
|
@@ -67,7 +67,7 @@
|
|
67
67
|
}
|
68
68
|
|
69
69
|
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer
|
70
|
-
shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
|
70
|
+
shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
|
71
71
|
{
|
72
72
|
return YES;
|
73
73
|
}
|
@@ -80,7 +80,7 @@ shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherG
|
|
80
80
|
return YES;
|
81
81
|
}
|
82
82
|
}
|
83
|
-
|
83
|
+
|
84
84
|
return NO;
|
85
85
|
}
|
86
86
|
|
@@ -10,46 +10,43 @@
|
|
10
10
|
|
11
11
|
#import <UIKit/UIGestureRecognizerSubclass.h>
|
12
12
|
|
13
|
-
#ifdef
|
13
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
14
14
|
#import <React/RCTSurfaceTouchHandler.h>
|
15
15
|
#else
|
16
16
|
#import <React/RCTTouchHandler.h>
|
17
|
-
#endif //
|
17
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
{
|
22
|
-
BOOL _active;
|
19
|
+
@implementation RNRootViewGestureRecognizer {
|
20
|
+
BOOL _active;
|
23
21
|
}
|
24
22
|
|
25
23
|
@dynamic delegate;
|
26
24
|
|
27
25
|
- (instancetype)init
|
28
26
|
{
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
27
|
+
if (self = [super init]) {
|
28
|
+
self.delaysTouchesEnded = NO;
|
29
|
+
self.delaysTouchesBegan = NO;
|
30
|
+
}
|
31
|
+
return self;
|
34
32
|
}
|
35
33
|
|
36
34
|
- (BOOL)shouldBeRequiredToFailByGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
|
37
35
|
{
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
return NO;
|
36
|
+
// This method is used to implement "enabled" feature for gesture handlers. We enforce gesture
|
37
|
+
// recognizers that are connected with "disabled" handlers to wait for the root gesture
|
38
|
+
// recognizer to fail and this way we block them from acting.
|
39
|
+
RNGestureHandler *otherHandler = [RNGestureHandler findGestureHandlerByRecognizer:otherGestureRecognizer];
|
40
|
+
if (otherHandler != nil && otherHandler.enabled == NO) {
|
41
|
+
return YES;
|
42
|
+
}
|
43
|
+
return NO;
|
47
44
|
}
|
48
45
|
|
49
46
|
- (BOOL)canPreventGestureRecognizer:(UIGestureRecognizer *)preventedGestureRecognizer
|
50
47
|
{
|
51
|
-
|
52
|
-
#ifdef
|
48
|
+
return ![preventedGestureRecognizer isKindOfClass:[
|
49
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
53
50
|
RCTSurfaceTouchHandler
|
54
51
|
#else
|
55
52
|
RCTTouchHandler
|
@@ -59,46 +56,46 @@
|
|
59
56
|
|
60
57
|
- (BOOL)canBePreventedByGestureRecognizer:(UIGestureRecognizer *)preventingGestureRecognizer
|
61
58
|
{
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
59
|
+
// When this method is called it means that one of handlers has activated, in this case we want
|
60
|
+
// to send an info to JS so that it cancells all JS responders
|
61
|
+
[self.delegate gestureRecognizer:preventingGestureRecognizer didActivateInViewWithTouchHandler:self.view];
|
62
|
+
return [super canBePreventedByGestureRecognizer:preventingGestureRecognizer];
|
66
63
|
}
|
67
64
|
|
68
65
|
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
|
69
66
|
{
|
70
|
-
|
71
|
-
|
67
|
+
_active = YES;
|
68
|
+
self.state = UIGestureRecognizerStatePossible;
|
72
69
|
}
|
73
70
|
|
74
71
|
- (void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
|
75
72
|
{
|
76
|
-
|
73
|
+
self.state = UIGestureRecognizerStatePossible;
|
77
74
|
}
|
78
75
|
|
79
76
|
- (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
|
80
77
|
{
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
78
|
+
if (self.state == UIGestureRecognizerStateBegan || self.state == UIGestureRecognizerStateChanged) {
|
79
|
+
self.state = UIGestureRecognizerStateEnded;
|
80
|
+
} else {
|
81
|
+
self.state = UIGestureRecognizerStateFailed;
|
82
|
+
}
|
83
|
+
[self reset];
|
84
|
+
_active = NO;
|
88
85
|
}
|
89
86
|
|
90
87
|
- (void)touchesCancelled:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
|
91
88
|
{
|
92
|
-
|
93
|
-
|
94
|
-
|
89
|
+
self.state = UIGestureRecognizerStateCancelled;
|
90
|
+
[self reset];
|
91
|
+
_active = NO;
|
95
92
|
}
|
96
93
|
|
97
94
|
- (void)blockOtherRecognizers
|
98
95
|
{
|
99
|
-
|
100
|
-
|
101
|
-
|
96
|
+
if (_active) {
|
97
|
+
self.state = UIGestureRecognizerStateBegan;
|
98
|
+
}
|
102
99
|
}
|
103
100
|
|
104
101
|
@end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.enableExperimentalWebImplementation = enableExperimentalWebImplementation;
|
7
|
+
exports.enableLegacyWebImplementation = enableLegacyWebImplementation;
|
8
|
+
exports.isNewWebImplementationEnabled = isNewWebImplementationEnabled;
|
9
|
+
|
10
|
+
var _reactNative = require("react-native");
|
11
|
+
|
12
|
+
let useNewWebImplementation = true;
|
13
|
+
let getWasCalled = false;
|
14
|
+
|
15
|
+
function enableExperimentalWebImplementation(_shouldEnable = true) {// NO-OP since the new implementation is now the default
|
16
|
+
}
|
17
|
+
|
18
|
+
function enableLegacyWebImplementation(shouldUseLegacyImplementation = true) {
|
19
|
+
if (_reactNative.Platform.OS !== 'web' || useNewWebImplementation === !shouldUseLegacyImplementation) {
|
20
|
+
return;
|
21
|
+
}
|
22
|
+
|
23
|
+
if (getWasCalled) {
|
24
|
+
console.error('Some parts of this application have already started using the new gesture handler implementation. No changes will be applied. You can try enabling legacy implementation earlier.');
|
25
|
+
return;
|
26
|
+
}
|
27
|
+
|
28
|
+
useNewWebImplementation = !shouldUseLegacyImplementation;
|
29
|
+
}
|
30
|
+
|
31
|
+
function isNewWebImplementationEnabled() {
|
32
|
+
getWasCalled = true;
|
33
|
+
return useNewWebImplementation;
|
34
|
+
}
|
35
|
+
//# sourceMappingURL=EnableNewWebImplementation.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["EnableNewWebImplementation.ts"],"names":["useNewWebImplementation","getWasCalled","enableExperimentalWebImplementation","_shouldEnable","enableLegacyWebImplementation","shouldUseLegacyImplementation","Platform","OS","console","error","isNewWebImplementationEnabled"],"mappings":";;;;;;;;;AAAA;;AAEA,IAAIA,uBAAuB,GAAG,IAA9B;AACA,IAAIC,YAAY,GAAG,KAAnB;;AAEO,SAASC,mCAAT,CACLC,aAAa,GAAG,IADX,EAEC,CACN;AACD;;AAEM,SAASC,6BAAT,CACLC,6BAA6B,GAAG,IAD3B,EAEC;AACN,MACEC,sBAASC,EAAT,KAAgB,KAAhB,IACAP,uBAAuB,KAAK,CAACK,6BAF/B,EAGE;AACA;AACD;;AAED,MAAIJ,YAAJ,EAAkB;AAChBO,IAAAA,OAAO,CAACC,KAAR,CACE,mLADF;AAGA;AACD;;AAEDT,EAAAA,uBAAuB,GAAG,CAACK,6BAA3B;AACD;;AAEM,SAASK,6BAAT,GAAkD;AACvDT,EAAAA,YAAY,GAAG,IAAf;AACA,SAAOD,uBAAP;AACD","sourcesContent":["import { Platform } from 'react-native';\n\nlet useNewWebImplementation = true;\nlet getWasCalled = false;\n\nexport function enableExperimentalWebImplementation(\n _shouldEnable = true\n): void {\n // NO-OP since the new implementation is now the default\n}\n\nexport function enableLegacyWebImplementation(\n shouldUseLegacyImplementation = true\n): void {\n if (\n Platform.OS !== 'web' ||\n useNewWebImplementation === !shouldUseLegacyImplementation\n ) {\n return;\n }\n\n if (getWasCalled) {\n console.error(\n 'Some parts of this application have already started using the new gesture handler implementation. No changes will be applied. You can try enabling legacy implementation earlier.'\n );\n return;\n }\n\n useNewWebImplementation = !shouldUseLegacyImplementation;\n}\n\nexport function isNewWebImplementationEnabled(): boolean {\n getWasCalled = true;\n return useNewWebImplementation;\n}\n"]}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
9
|
+
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
11
|
+
|
12
|
+
var _default = /*#__PURE__*/_react.default.createContext(false);
|
13
|
+
|
14
|
+
exports.default = _default;
|
15
|
+
//# sourceMappingURL=GestureHandlerRootViewContext.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["GestureHandlerRootViewContext.ts"],"names":["React","createContext"],"mappings":";;;;;;;AAAA;;;;4BAEeA,eAAMC,aAAN,CAAoB,KAApB,C","sourcesContent":["import React from 'react';\n\nexport default React.createContext(false);\n"]}
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.default = exports.HammerGestures = exports.Gestures = void 0;
|
7
7
|
|
8
|
-
var
|
8
|
+
var _EnableNewWebImplementation = require("./EnableNewWebImplementation");
|
9
9
|
|
10
10
|
var _InteractionManager = _interopRequireDefault(require("./web/tools/InteractionManager"));
|
11
11
|
|
@@ -80,7 +80,7 @@ var _default = {
|
|
80
80
|
},
|
81
81
|
|
82
82
|
createGestureHandler(handlerName, handlerTag, config) {
|
83
|
-
if ((0,
|
83
|
+
if ((0, _EnableNewWebImplementation.isNewWebImplementationEnabled)()) {
|
84
84
|
if (!(handlerName in Gestures)) {
|
85
85
|
throw new Error(`react-native-gesture-handler: ${handlerName} is not supported on web.`);
|
86
86
|
}
|
@@ -106,7 +106,7 @@ var _default = {
|
|
106
106
|
},
|
107
107
|
|
108
108
|
attachGestureHandler(handlerTag, newView, _actionType, propsRef) {
|
109
|
-
if ((0,
|
109
|
+
if ((0, _EnableNewWebImplementation.isNewWebImplementationEnabled)()) {
|
110
110
|
_NodeManager.default.getHandler(handlerTag).init(newView, propsRef);
|
111
111
|
} else {
|
112
112
|
HammerNodeManager.getHandler(handlerTag).setView(newView, propsRef);
|
@@ -114,7 +114,7 @@ var _default = {
|
|
114
114
|
},
|
115
115
|
|
116
116
|
updateGestureHandler(handlerTag, newConfig) {
|
117
|
-
if ((0,
|
117
|
+
if ((0, _EnableNewWebImplementation.isNewWebImplementationEnabled)()) {
|
118
118
|
_NodeManager.default.getHandler(handlerTag).updateGestureConfig(newConfig);
|
119
119
|
|
120
120
|
_InteractionManager.default.getInstance().configureInteractions(_NodeManager.default.getHandler(handlerTag), newConfig);
|
@@ -124,7 +124,7 @@ var _default = {
|
|
124
124
|
},
|
125
125
|
|
126
126
|
getGestureHandlerNode(handlerTag) {
|
127
|
-
if ((0,
|
127
|
+
if ((0, _EnableNewWebImplementation.isNewWebImplementationEnabled)()) {
|
128
128
|
return _NodeManager.default.getHandler(handlerTag);
|
129
129
|
} else {
|
130
130
|
return HammerNodeManager.getHandler(handlerTag);
|
@@ -132,7 +132,7 @@ var _default = {
|
|
132
132
|
},
|
133
133
|
|
134
134
|
dropGestureHandler(handlerTag) {
|
135
|
-
if ((0,
|
135
|
+
if ((0, _EnableNewWebImplementation.isNewWebImplementationEnabled)()) {
|
136
136
|
_NodeManager.default.dropGestureHandler(handlerTag);
|
137
137
|
} else {
|
138
138
|
HammerNodeManager.dropGestureHandler(handlerTag);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["RNGestureHandlerModule.macos.ts"],"names":["Gestures","NativeViewGestureHandler","PanGestureHandler","TapGestureHandler","LongPressGestureHandler","PinchGestureHandler","RotationGestureHandler","FlingGestureHandler","ManualGestureHandler","HammerGestures","HammerNativeViewGestureHandler","HammerPanGestureHandler","HammerTapGestureHandler","HammerLongPressGestureHandler","HammerPinchGestureHandler","HammerRotationGestureHandler","HammerFlingGestureHandler","handleSetJSResponder","_tag","_blockNativeResponder","handleClearJSResponder","createGestureHandler","handlerName","handlerTag","config","Error","GestureClass","NodeManager","InteractionManager","getInstance","configureInteractions","getHandler","HammerNodeManager","updateGestureHandler","attachGestureHandler","newView","_actionType","propsRef","init","setView","newConfig","updateGestureConfig","getGestureHandlerNode","dropGestureHandler","flushOperations"],"mappings":";;;;;;;AACA;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;AApBA;AAYA;AAWO,MAAMA,QAAQ,GAAG;AACtBC,EAAAA,wBAAwB,EAAxBA,iCADsB;AAEtBC,EAAAA,iBAAiB,EAAjBA,0BAFsB;AAGtBC,EAAAA,iBAAiB,EAAjBA,0BAHsB;AAItBC,EAAAA,uBAAuB,EAAvBA,gCAJsB;AAKtBC,EAAAA,mBAAmB,EAAnBA,4BALsB;AAMtBC,EAAAA,sBAAsB,EAAtBA,+BANsB;AAOtBC,EAAAA,mBAAmB,EAAnBA,4BAPsB;AAQtBC,EAAAA,oBAAoB,EAApBA;AARsB,CAAjB;;AAWA,MAAMC,cAAc,GAAG;AAC5BR,EAAAA,wBAAwB,EAAES,kCADE;AAE5BR,EAAAA,iBAAiB,EAAES,2BAFS;AAG5BR,EAAAA,iBAAiB,EAAES,2BAHS;AAI5BR,EAAAA,uBAAuB,EAAES,iCAJG;AAK5BR,EAAAA,mBAAmB,EAAES,6BALO;AAM5BR,EAAAA,sBAAsB,EAAES,gCANI;AAO5BR,EAAAA,mBAAmB,EAAES;AAPO,CAAvB;;eAUQ;AACbC,EAAAA,oBAAoB,CAACC,IAAD,EAAeC,qBAAf,EAA+C,CACjE;AACD,GAHY;;AAIbC,EAAAA,sBAAsB,GAAG,CACvB;AACD,GANY;;AAObC,EAAAA,oBAAoB,CAClBC,WADkB,EAElBC,UAFkB,EAGlBC,MAHkB,EAIlB;AACA,QAAI,
|
1
|
+
{"version":3,"sources":["RNGestureHandlerModule.macos.ts"],"names":["Gestures","NativeViewGestureHandler","PanGestureHandler","TapGestureHandler","LongPressGestureHandler","PinchGestureHandler","RotationGestureHandler","FlingGestureHandler","ManualGestureHandler","HammerGestures","HammerNativeViewGestureHandler","HammerPanGestureHandler","HammerTapGestureHandler","HammerLongPressGestureHandler","HammerPinchGestureHandler","HammerRotationGestureHandler","HammerFlingGestureHandler","handleSetJSResponder","_tag","_blockNativeResponder","handleClearJSResponder","createGestureHandler","handlerName","handlerTag","config","Error","GestureClass","NodeManager","InteractionManager","getInstance","configureInteractions","getHandler","HammerNodeManager","updateGestureHandler","attachGestureHandler","newView","_actionType","propsRef","init","setView","newConfig","updateGestureConfig","getGestureHandlerNode","dropGestureHandler","flushOperations"],"mappings":"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","sourcesContent":["import { ActionType } from './ActionType';\nimport { isNewWebImplementationEnabled } from './EnableNewWebImplementation';\n\n//GestureHandlers\nimport InteractionManager from './web/tools/InteractionManager';\nimport NodeManager from './web/tools/NodeManager';\nimport PanGestureHandler from './web/handlers/PanGestureHandler';\nimport TapGestureHandler from './web/handlers/TapGestureHandler';\nimport LongPressGestureHandler from './web/handlers/LongPressGestureHandler';\nimport PinchGestureHandler from './web/handlers/PinchGestureHandler';\nimport RotationGestureHandler from './web/handlers/RotationGestureHandler';\nimport FlingGestureHandler from './web/handlers/FlingGestureHandler';\nimport NativeViewGestureHandler from './web/handlers/NativeViewGestureHandler';\nimport ManualGestureHandler from './web/handlers/ManualGestureHandler';\n\n//Hammer Handlers\nimport * as HammerNodeManager from './web_hammer/NodeManager';\nimport HammerNativeViewGestureHandler from './web_hammer/NativeViewGestureHandler';\nimport HammerPanGestureHandler from './web_hammer/PanGestureHandler';\nimport HammerTapGestureHandler from './web_hammer/TapGestureHandler';\nimport HammerLongPressGestureHandler from './web_hammer/LongPressGestureHandler';\nimport HammerPinchGestureHandler from './web_hammer/PinchGestureHandler';\nimport HammerRotationGestureHandler from './web_hammer/RotationGestureHandler';\nimport HammerFlingGestureHandler from './web_hammer/FlingGestureHandler';\nimport { Config } from './web/interfaces';\n\nexport const Gestures = {\n NativeViewGestureHandler,\n PanGestureHandler,\n TapGestureHandler,\n LongPressGestureHandler,\n PinchGestureHandler,\n RotationGestureHandler,\n FlingGestureHandler,\n ManualGestureHandler,\n};\n\nexport const HammerGestures = {\n NativeViewGestureHandler: HammerNativeViewGestureHandler,\n PanGestureHandler: HammerPanGestureHandler,\n TapGestureHandler: HammerTapGestureHandler,\n LongPressGestureHandler: HammerLongPressGestureHandler,\n PinchGestureHandler: HammerPinchGestureHandler,\n RotationGestureHandler: HammerRotationGestureHandler,\n FlingGestureHandler: HammerFlingGestureHandler,\n};\n\nexport default {\n handleSetJSResponder(_tag: number, _blockNativeResponder: boolean) {\n // NO-OP\n },\n handleClearJSResponder() {\n // NO-OP\n },\n createGestureHandler<T>(\n handlerName: keyof typeof Gestures,\n handlerTag: number,\n config: T\n ) {\n if (isNewWebImplementationEnabled()) {\n if (!(handlerName in Gestures)) {\n throw new Error(\n `react-native-gesture-handler: ${handlerName} is not supported on web.`\n );\n }\n\n const GestureClass = Gestures[handlerName];\n NodeManager.createGestureHandler(handlerTag, new GestureClass());\n InteractionManager.getInstance().configureInteractions(\n NodeManager.getHandler(handlerTag),\n config as unknown as Config\n );\n } else {\n if (!(handlerName in HammerGestures)) {\n throw new Error(\n `react-native-gesture-handler: ${handlerName} is not supported on web.`\n );\n }\n\n // @ts-ignore If it doesn't exist, the error is thrown\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const GestureClass = HammerGestures[handlerName];\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n HammerNodeManager.createGestureHandler(handlerTag, new GestureClass());\n }\n\n this.updateGestureHandler(handlerTag, config as unknown as Config);\n },\n attachGestureHandler(\n handlerTag: number,\n newView: number,\n _actionType: ActionType,\n propsRef: React.RefObject<unknown>\n ) {\n if (isNewWebImplementationEnabled()) {\n NodeManager.getHandler(handlerTag).init(newView, propsRef);\n } else {\n HammerNodeManager.getHandler(handlerTag).setView(newView, propsRef);\n }\n },\n updateGestureHandler(handlerTag: number, newConfig: Config) {\n if (isNewWebImplementationEnabled()) {\n NodeManager.getHandler(handlerTag).updateGestureConfig(newConfig);\n\n InteractionManager.getInstance().configureInteractions(\n NodeManager.getHandler(handlerTag),\n newConfig\n );\n } else {\n HammerNodeManager.getHandler(handlerTag).updateGestureConfig(newConfig);\n }\n },\n getGestureHandlerNode(handlerTag: number) {\n if (isNewWebImplementationEnabled()) {\n return NodeManager.getHandler(handlerTag);\n } else {\n return HammerNodeManager.getHandler(handlerTag);\n }\n },\n dropGestureHandler(handlerTag: number) {\n if (isNewWebImplementationEnabled()) {\n NodeManager.dropGestureHandler(handlerTag);\n } else {\n HammerNodeManager.dropGestureHandler(handlerTag);\n }\n },\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n flushOperations() {},\n};\n"]}
|
@@ -7,7 +7,7 @@ exports.default = exports.HammerGestures = exports.Gestures = void 0;
|
|
7
7
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
9
9
|
|
10
|
-
var
|
10
|
+
var _EnableNewWebImplementation = require("./EnableNewWebImplementation");
|
11
11
|
|
12
12
|
var _InteractionManager = _interopRequireDefault(require("./web/tools/InteractionManager"));
|
13
13
|
|
@@ -84,7 +84,7 @@ var _default = {
|
|
84
84
|
},
|
85
85
|
|
86
86
|
createGestureHandler(handlerName, handlerTag, config) {
|
87
|
-
if ((0,
|
87
|
+
if ((0, _EnableNewWebImplementation.isNewWebImplementationEnabled)()) {
|
88
88
|
if (!(handlerName in Gestures)) {
|
89
89
|
throw new Error(`react-native-gesture-handler: ${handlerName} is not supported on web.`);
|
90
90
|
}
|
@@ -115,7 +115,7 @@ var _default = {
|
|
115
115
|
return;
|
116
116
|
}
|
117
117
|
|
118
|
-
if ((0,
|
118
|
+
if ((0, _EnableNewWebImplementation.isNewWebImplementationEnabled)()) {
|
119
119
|
//@ts-ignore Types should be HTMLElement or React.Component
|
120
120
|
_NodeManager.default.getHandler(handlerTag).init(newView, propsRef);
|
121
121
|
} else {
|
@@ -125,7 +125,7 @@ var _default = {
|
|
125
125
|
},
|
126
126
|
|
127
127
|
updateGestureHandler(handlerTag, newConfig) {
|
128
|
-
if ((0,
|
128
|
+
if ((0, _EnableNewWebImplementation.isNewWebImplementationEnabled)()) {
|
129
129
|
_NodeManager.default.getHandler(handlerTag).updateGestureConfig(newConfig);
|
130
130
|
|
131
131
|
_InteractionManager.default.getInstance().configureInteractions(_NodeManager.default.getHandler(handlerTag), newConfig);
|
@@ -135,7 +135,7 @@ var _default = {
|
|
135
135
|
},
|
136
136
|
|
137
137
|
getGestureHandlerNode(handlerTag) {
|
138
|
-
if ((0,
|
138
|
+
if ((0, _EnableNewWebImplementation.isNewWebImplementationEnabled)()) {
|
139
139
|
return _NodeManager.default.getHandler(handlerTag);
|
140
140
|
} else {
|
141
141
|
return HammerNodeManager.getHandler(handlerTag);
|
@@ -143,7 +143,7 @@ var _default = {
|
|
143
143
|
},
|
144
144
|
|
145
145
|
dropGestureHandler(handlerTag) {
|
146
|
-
if ((0,
|
146
|
+
if ((0, _EnableNewWebImplementation.isNewWebImplementationEnabled)()) {
|
147
147
|
_NodeManager.default.dropGestureHandler(handlerTag);
|
148
148
|
} else {
|
149
149
|
HammerNodeManager.dropGestureHandler(handlerTag);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["RNGestureHandlerModule.web.ts"],"names":["Gestures","NativeViewGestureHandler","PanGestureHandler","TapGestureHandler","LongPressGestureHandler","PinchGestureHandler","RotationGestureHandler","FlingGestureHandler","ManualGestureHandler","HammerGestures","HammerNativeViewGestureHandler","HammerPanGestureHandler","HammerTapGestureHandler","HammerLongPressGestureHandler","HammerPinchGestureHandler","HammerRotationGestureHandler","HammerFlingGestureHandler","handleSetJSResponder","tag","blockNativeResponder","console","warn","handleClearJSResponder","createGestureHandler","handlerName","handlerTag","config","Error","GestureClass","NodeManager","InteractionManager","getInstance","configureInteractions","getHandler","HammerNodeManager","updateGestureHandler","attachGestureHandler","newView","_actionType","propsRef","HTMLElement","React","Component","init","setView","newConfig","updateGestureConfig","getGestureHandlerNode","dropGestureHandler","flushOperations"],"mappings":";;;;;;;AAAA;;AAGA;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;AApBA;AAYA;AAWO,MAAMA,QAAQ,GAAG;AACtBC,EAAAA,wBAAwB,EAAxBA,iCADsB;AAEtBC,EAAAA,iBAAiB,EAAjBA,0BAFsB;AAGtBC,EAAAA,iBAAiB,EAAjBA,0BAHsB;AAItBC,EAAAA,uBAAuB,EAAvBA,gCAJsB;AAKtBC,EAAAA,mBAAmB,EAAnBA,4BALsB;AAMtBC,EAAAA,sBAAsB,EAAtBA,+BANsB;AAOtBC,EAAAA,mBAAmB,EAAnBA,4BAPsB;AAQtBC,EAAAA,oBAAoB,EAApBA;AARsB,CAAjB;;AAWA,MAAMC,cAAc,GAAG;AAC5BR,EAAAA,wBAAwB,EAAES,kCADE;AAE5BR,EAAAA,iBAAiB,EAAES,2BAFS;AAG5BR,EAAAA,iBAAiB,EAAES,2BAHS;AAI5BR,EAAAA,uBAAuB,EAAES,iCAJG;AAK5BR,EAAAA,mBAAmB,EAAES,6BALO;AAM5BR,EAAAA,sBAAsB,EAAES,gCANI;AAO5BR,EAAAA,mBAAmB,EAAES;AAPO,CAAvB;;eAUQ;AACbC,EAAAA,oBAAoB,CAACC,GAAD,EAAcC,oBAAd,EAA6C;AAC/DC,IAAAA,OAAO,CAACC,IAAR,CAAa,wBAAb,EAAuCH,GAAvC,EAA4CC,oBAA5C;AACD,GAHY;;AAIbG,EAAAA,sBAAsB,GAAG;AACvBF,IAAAA,OAAO,CAACC,IAAR,CAAa,0BAAb;AACD,GANY;;AAObE,EAAAA,oBAAoB,CAClBC,WADkB,EAElBC,UAFkB,EAGlBC,MAHkB,EAIlB;AACA,QAAI,
|
1
|
+
{"version":3,"sources":["RNGestureHandlerModule.web.ts"],"names":["Gestures","NativeViewGestureHandler","PanGestureHandler","TapGestureHandler","LongPressGestureHandler","PinchGestureHandler","RotationGestureHandler","FlingGestureHandler","ManualGestureHandler","HammerGestures","HammerNativeViewGestureHandler","HammerPanGestureHandler","HammerTapGestureHandler","HammerLongPressGestureHandler","HammerPinchGestureHandler","HammerRotationGestureHandler","HammerFlingGestureHandler","handleSetJSResponder","tag","blockNativeResponder","console","warn","handleClearJSResponder","createGestureHandler","handlerName","handlerTag","config","Error","GestureClass","NodeManager","InteractionManager","getInstance","configureInteractions","getHandler","HammerNodeManager","updateGestureHandler","attachGestureHandler","newView","_actionType","propsRef","HTMLElement","React","Component","init","setView","newConfig","updateGestureConfig","getGestureHandlerNode","dropGestureHandler","flushOperations"],"mappings":"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","sourcesContent":["import React from 'react';\n\nimport { ActionType } from './ActionType';\nimport { isNewWebImplementationEnabled } from './EnableNewWebImplementation';\n\n//GestureHandlers\nimport InteractionManager from './web/tools/InteractionManager';\nimport NodeManager from './web/tools/NodeManager';\nimport PanGestureHandler from './web/handlers/PanGestureHandler';\nimport TapGestureHandler from './web/handlers/TapGestureHandler';\nimport LongPressGestureHandler from './web/handlers/LongPressGestureHandler';\nimport PinchGestureHandler from './web/handlers/PinchGestureHandler';\nimport RotationGestureHandler from './web/handlers/RotationGestureHandler';\nimport FlingGestureHandler from './web/handlers/FlingGestureHandler';\nimport NativeViewGestureHandler from './web/handlers/NativeViewGestureHandler';\nimport ManualGestureHandler from './web/handlers/ManualGestureHandler';\n\n//Hammer Handlers\nimport * as HammerNodeManager from './web_hammer/NodeManager';\nimport HammerNativeViewGestureHandler from './web_hammer/NativeViewGestureHandler';\nimport HammerPanGestureHandler from './web_hammer/PanGestureHandler';\nimport HammerTapGestureHandler from './web_hammer/TapGestureHandler';\nimport HammerLongPressGestureHandler from './web_hammer/LongPressGestureHandler';\nimport HammerPinchGestureHandler from './web_hammer/PinchGestureHandler';\nimport HammerRotationGestureHandler from './web_hammer/RotationGestureHandler';\nimport HammerFlingGestureHandler from './web_hammer/FlingGestureHandler';\nimport { Config } from './web/interfaces';\n\nexport const Gestures = {\n NativeViewGestureHandler,\n PanGestureHandler,\n TapGestureHandler,\n LongPressGestureHandler,\n PinchGestureHandler,\n RotationGestureHandler,\n FlingGestureHandler,\n ManualGestureHandler,\n};\n\nexport const HammerGestures = {\n NativeViewGestureHandler: HammerNativeViewGestureHandler,\n PanGestureHandler: HammerPanGestureHandler,\n TapGestureHandler: HammerTapGestureHandler,\n LongPressGestureHandler: HammerLongPressGestureHandler,\n PinchGestureHandler: HammerPinchGestureHandler,\n RotationGestureHandler: HammerRotationGestureHandler,\n FlingGestureHandler: HammerFlingGestureHandler,\n};\n\nexport default {\n handleSetJSResponder(tag: number, blockNativeResponder: boolean) {\n console.warn('handleSetJSResponder: ', tag, blockNativeResponder);\n },\n handleClearJSResponder() {\n console.warn('handleClearJSResponder: ');\n },\n createGestureHandler<T>(\n handlerName: keyof typeof Gestures,\n handlerTag: number,\n config: T\n ) {\n if (isNewWebImplementationEnabled()) {\n if (!(handlerName in Gestures)) {\n throw new Error(\n `react-native-gesture-handler: ${handlerName} is not supported on web.`\n );\n }\n\n const GestureClass = Gestures[handlerName];\n NodeManager.createGestureHandler(handlerTag, new GestureClass());\n InteractionManager.getInstance().configureInteractions(\n NodeManager.getHandler(handlerTag),\n config as unknown as Config\n );\n } else {\n if (!(handlerName in HammerGestures)) {\n throw new Error(\n `react-native-gesture-handler: ${handlerName} is not supported on web.`\n );\n }\n\n // @ts-ignore If it doesn't exist, the error is thrown\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const GestureClass = HammerGestures[handlerName];\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n HammerNodeManager.createGestureHandler(handlerTag, new GestureClass());\n }\n\n this.updateGestureHandler(handlerTag, config as unknown as Config);\n },\n attachGestureHandler(\n handlerTag: number,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n newView: any,\n _actionType: ActionType,\n propsRef: React.RefObject<unknown>\n ) {\n if (\n !(newView instanceof HTMLElement || newView instanceof React.Component)\n ) {\n return;\n }\n\n if (isNewWebImplementationEnabled()) {\n //@ts-ignore Types should be HTMLElement or React.Component\n NodeManager.getHandler(handlerTag).init(newView, propsRef);\n } else {\n //@ts-ignore Types should be HTMLElement or React.Component\n HammerNodeManager.getHandler(handlerTag).setView(newView, propsRef);\n }\n },\n updateGestureHandler(handlerTag: number, newConfig: Config) {\n if (isNewWebImplementationEnabled()) {\n NodeManager.getHandler(handlerTag).updateGestureConfig(newConfig);\n\n InteractionManager.getInstance().configureInteractions(\n NodeManager.getHandler(handlerTag),\n newConfig\n );\n } else {\n HammerNodeManager.getHandler(handlerTag).updateGestureConfig(newConfig);\n }\n },\n getGestureHandlerNode(handlerTag: number) {\n if (isNewWebImplementationEnabled()) {\n return NodeManager.getHandler(handlerTag);\n } else {\n return HammerNodeManager.getHandler(handlerTag);\n }\n },\n dropGestureHandler(handlerTag: number) {\n if (isNewWebImplementationEnabled()) {\n NodeManager.dropGestureHandler(handlerTag);\n } else {\n HammerNodeManager.dropGestureHandler(handlerTag);\n }\n },\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n flushOperations() {},\n};\n"]}
|
@@ -7,7 +7,7 @@ exports.default = exports.HammerGestures = exports.Gestures = void 0;
|
|
7
7
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
9
9
|
|
10
|
-
var
|
10
|
+
var _EnableNewWebImplementation = require("./EnableNewWebImplementation");
|
11
11
|
|
12
12
|
var _InteractionManager = _interopRequireDefault(require("./web/tools/InteractionManager"));
|
13
13
|
|
@@ -82,7 +82,7 @@ var _default = {
|
|
82
82
|
},
|
83
83
|
|
84
84
|
createGestureHandler(handlerName, handlerTag, config) {
|
85
|
-
if ((0,
|
85
|
+
if ((0, _EnableNewWebImplementation.isNewWebImplementationEnabled)()) {
|
86
86
|
if (!(handlerName in Gestures)) {
|
87
87
|
throw new Error(`react-native-gesture-handler: ${handlerName} is not supported on web.`);
|
88
88
|
}
|
@@ -113,7 +113,7 @@ var _default = {
|
|
113
113
|
return;
|
114
114
|
}
|
115
115
|
|
116
|
-
if ((0,
|
116
|
+
if ((0, _EnableNewWebImplementation.isNewWebImplementationEnabled)()) {
|
117
117
|
//@ts-ignore Types should be HTMLElement or React.Component
|
118
118
|
_NodeManager.default.getHandler(handlerTag).init(newView, propsRef);
|
119
119
|
} else {
|
@@ -123,7 +123,7 @@ var _default = {
|
|
123
123
|
},
|
124
124
|
|
125
125
|
updateGestureHandler(handlerTag, newConfig) {
|
126
|
-
if ((0,
|
126
|
+
if ((0, _EnableNewWebImplementation.isNewWebImplementationEnabled)()) {
|
127
127
|
_NodeManager.default.getHandler(handlerTag).updateGestureConfig(newConfig);
|
128
128
|
|
129
129
|
_InteractionManager.default.getInstance().configureInteractions(_NodeManager.default.getHandler(handlerTag), newConfig);
|
@@ -133,7 +133,7 @@ var _default = {
|
|
133
133
|
},
|
134
134
|
|
135
135
|
getGestureHandlerNode(handlerTag) {
|
136
|
-
if ((0,
|
136
|
+
if ((0, _EnableNewWebImplementation.isNewWebImplementationEnabled)()) {
|
137
137
|
return _NodeManager.default.getHandler(handlerTag);
|
138
138
|
} else {
|
139
139
|
return HammerNodeManager.getHandler(handlerTag);
|
@@ -141,7 +141,7 @@ var _default = {
|
|
141
141
|
},
|
142
142
|
|
143
143
|
dropGestureHandler(handlerTag) {
|
144
|
-
if ((0,
|
144
|
+
if ((0, _EnableNewWebImplementation.isNewWebImplementationEnabled)()) {
|
145
145
|
_NodeManager.default.dropGestureHandler(handlerTag);
|
146
146
|
} else {
|
147
147
|
HammerNodeManager.dropGestureHandler(handlerTag);
|