react-native-gesture-handler 2.14.1 → 2.16.0-rc.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/README.md +1 -0
- package/RNGestureHandler.podspec +3 -24
- package/android/build.gradle +1 -1
- package/android/paper/src/main/java/com/swmansion/gesturehandler/NativeRNGestureHandlerModuleSpec.java +55 -0
- package/android/src/main/java/com/swmansion/gesturehandler/RNGestureHandlerPackage.kt +69 -4
- package/android/src/main/java/com/swmansion/gesturehandler/core/FlingGestureHandler.kt +4 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandler.kt +69 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt +37 -21
- 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/react/RNGestureHandlerModule.kt +61 -24
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootHelper.kt +3 -2
- 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/{ios → apple}/Handlers/RNFlingHandler.m +29 -8
- package/{ios → apple}/Handlers/RNForceTouchHandler.m +28 -8
- package/{ios → apple}/Handlers/RNHoverHandler.m +28 -2
- package/{ios → apple}/Handlers/RNLongPressHandler.m +27 -5
- package/{ios → apple}/Handlers/RNManualHandler.m +25 -4
- package/{ios → apple}/Handlers/RNNativeViewHandler.mm +51 -13
- package/{ios → apple}/Handlers/RNPanHandler.m +106 -16
- package/apple/Handlers/RNPinchHandler.m +175 -0
- package/apple/Handlers/RNRotationHandler.m +169 -0
- package/{ios → apple}/Handlers/RNTapHandler.m +98 -26
- package/apple/RNGHUIKit.h +27 -0
- package/{ios → apple}/RNGestureHandler.h +12 -3
- package/{ios → apple}/RNGestureHandler.m +68 -7
- package/{ios → apple}/RNGestureHandlerButton.h +4 -1
- package/{ios → apple}/RNGestureHandlerButton.m +12 -4
- package/{ios → apple}/RNGestureHandlerButtonManager.m +4 -2
- package/{ios → apple}/RNGestureHandlerEvents.h +19 -10
- package/{ios → apple}/RNGestureHandlerEvents.m +29 -11
- package/{ios → apple}/RNGestureHandlerManager.h +7 -2
- package/{ios → apple}/RNGestureHandlerManager.mm +78 -17
- package/apple/RNGestureHandlerModule.h +19 -0
- package/{ios → apple}/RNGestureHandlerModule.mm +69 -69
- package/{ios → apple}/RNGestureHandlerPointerTracker.h +5 -5
- package/{ios → apple}/RNGestureHandlerPointerTracker.m +19 -14
- package/apple/RNGestureHandlerPointerType.h +8 -0
- package/{ios → apple}/RNGestureHandlerRegistry.h +1 -1
- package/{ios → apple}/RNGestureHandlerRegistry.m +1 -1
- package/{ios → apple}/RNManualActivationRecognizer.h +8 -0
- package/{ios → apple}/RNManualActivationRecognizer.m +27 -7
- package/{ios → apple}/RNRootViewGestureRecognizer.m +72 -4
- package/lib/commonjs/PointerType.js +16 -0
- package/lib/commonjs/PointerType.js.map +1 -0
- package/lib/commonjs/RNGestureHandlerModule.js +5 -18
- package/lib/commonjs/RNGestureHandlerModule.js.map +1 -1
- package/lib/commonjs/RNGestureHandlerModule.windows.js +10 -102
- package/lib/commonjs/RNGestureHandlerModule.windows.js.map +1 -1
- package/lib/commonjs/components/DrawerLayout.js +2 -0
- 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/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/gestureHandlerCommon.js +1 -1
- package/lib/commonjs/handlers/gestureHandlerCommon.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector.js +11 -1
- package/lib/commonjs/handlers/gestures/GestureDetector.js.map +1 -1
- package/lib/commonjs/handlers/gestures/gesture.js +5 -0
- package/lib/commonjs/handlers/gestures/gesture.js.map +1 -1
- package/lib/commonjs/index.js +16 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/specs/NativeRNGestureHandlerModule.js +13 -0
- package/lib/commonjs/specs/NativeRNGestureHandlerModule.js.map +1 -0
- package/lib/commonjs/web/handlers/FlingGestureHandler.js +4 -0
- package/lib/commonjs/web/handlers/FlingGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/GestureHandler.js +19 -4
- package/lib/commonjs/web/handlers/GestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/LongPressGestureHandler.js +8 -6
- package/lib/commonjs/web/handlers/LongPressGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/PanGestureHandler.js +4 -0
- package/lib/commonjs/web/handlers/PanGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/TapGestureHandler.js +4 -0
- package/lib/commonjs/web/handlers/TapGestureHandler.js.map +1 -1
- package/lib/commonjs/web/interfaces.js +12 -24
- package/lib/commonjs/web/interfaces.js.map +1 -1
- package/lib/commonjs/web/tools/GestureHandlerOrchestrator.js +3 -3
- package/lib/commonjs/web/tools/GestureHandlerOrchestrator.js.map +1 -1
- package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js +35 -0
- package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js.map +1 -1
- package/lib/commonjs/web/tools/NodeManager.js +3 -2
- package/lib/commonjs/web/tools/NodeManager.js.map +1 -1
- package/lib/commonjs/web/tools/PointerEventManager.js +40 -10
- package/lib/commonjs/web/tools/PointerEventManager.js.map +1 -1
- package/lib/commonjs/web/tools/TouchEventManager.js +3 -2
- package/lib/commonjs/web/tools/TouchEventManager.js.map +1 -1
- package/lib/commonjs/web/utils.js +6 -0
- package/lib/commonjs/web/utils.js.map +1 -1
- package/lib/module/PointerType.js +9 -0
- package/lib/module/PointerType.js.map +1 -0
- package/lib/module/RNGestureHandlerModule.js +4 -18
- package/lib/module/RNGestureHandlerModule.js.map +1 -1
- package/lib/module/RNGestureHandlerModule.windows.js +10 -81
- package/lib/module/RNGestureHandlerModule.windows.js.map +1 -1
- package/lib/module/components/DrawerLayout.js +2 -0
- 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/getShadowNodeFromRef.js +19 -2
- package/lib/module/getShadowNodeFromRef.js.map +1 -1
- package/lib/module/handlers/createHandler.js +6 -1
- package/lib/module/handlers/createHandler.js.map +1 -1
- package/lib/module/handlers/gestureHandlerCommon.js +1 -1
- package/lib/module/handlers/gestureHandlerCommon.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector.js +11 -1
- package/lib/module/handlers/gestures/GestureDetector.js.map +1 -1
- package/lib/module/handlers/gestures/gesture.js +5 -0
- package/lib/module/handlers/gestures/gesture.js.map +1 -1
- package/lib/module/index.js +2 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/specs/NativeRNGestureHandlerModule.js +3 -0
- package/lib/module/specs/NativeRNGestureHandlerModule.js.map +1 -0
- package/lib/module/web/handlers/FlingGestureHandler.js +4 -0
- package/lib/module/web/handlers/FlingGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/GestureHandler.js +18 -4
- package/lib/module/web/handlers/GestureHandler.js.map +1 -1
- package/lib/module/web/handlers/LongPressGestureHandler.js +8 -5
- package/lib/module/web/handlers/LongPressGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/PanGestureHandler.js +4 -0
- package/lib/module/web/handlers/PanGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/TapGestureHandler.js +4 -0
- package/lib/module/web/handlers/TapGestureHandler.js.map +1 -1
- package/lib/module/web/interfaces.js +9 -20
- package/lib/module/web/interfaces.js.map +1 -1
- package/lib/module/web/tools/GestureHandlerOrchestrator.js +2 -2
- package/lib/module/web/tools/GestureHandlerOrchestrator.js.map +1 -1
- package/lib/module/web/tools/GestureHandlerWebDelegate.js +34 -0
- package/lib/module/web/tools/GestureHandlerWebDelegate.js.map +1 -1
- package/lib/module/web/tools/NodeManager.js +3 -2
- package/lib/module/web/tools/NodeManager.js.map +1 -1
- package/lib/module/web/tools/PointerEventManager.js +41 -12
- package/lib/module/web/tools/PointerEventManager.js.map +1 -1
- package/lib/module/web/tools/TouchEventManager.js +2 -2
- package/lib/module/web/tools/TouchEventManager.js.map +1 -1
- package/lib/module/web/utils.js +2 -0
- package/lib/module/web/utils.js.map +1 -1
- package/lib/typescript/PointerType.d.ts +6 -0
- package/lib/typescript/RNGestureHandlerModule.d.ts +2 -13
- package/lib/typescript/RNGestureHandlerModule.windows.d.ts +5 -21
- package/lib/typescript/components/DrawerLayout.d.ts +11 -0
- 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/getShadowNodeFromRef.d.ts +1 -1
- package/lib/typescript/handlers/NativeViewGestureHandler.d.ts +1 -1
- package/lib/typescript/handlers/PanGestureHandler.d.ts +1 -1
- package/lib/typescript/handlers/gestureHandlerCommon.d.ts +6 -1
- package/lib/typescript/handlers/gestures/GestureDetector.d.ts +2 -1
- package/lib/typescript/handlers/gestures/gesture.d.ts +2 -0
- package/lib/typescript/index.d.ts +2 -0
- package/lib/typescript/specs/NativeRNGestureHandlerModule.d.ts +14 -0
- package/lib/typescript/web/handlers/GestureHandler.d.ts +4 -1
- package/lib/typescript/web/interfaces.d.ts +10 -14
- package/lib/typescript/web/tools/GestureHandlerDelegate.d.ts +2 -0
- package/lib/typescript/web/tools/GestureHandlerWebDelegate.d.ts +7 -0
- package/lib/typescript/web/tools/PointerEventManager.d.ts +2 -0
- package/lib/typescript/web/utils.d.ts +2 -0
- package/package.json +14 -11
- package/src/PointerType.ts +6 -0
- package/src/RNGestureHandlerModule.ts +4 -49
- package/src/RNGestureHandlerModule.windows.ts +18 -100
- package/src/components/DrawerLayout.tsx +15 -0
- 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/getShadowNodeFromRef.ts +28 -6
- package/src/handlers/createHandler.tsx +6 -0
- package/src/handlers/gestureHandlerCommon.ts +7 -0
- package/src/handlers/gestures/GestureDetector.tsx +16 -2
- package/src/handlers/gestures/gesture.ts +6 -0
- package/src/index.ts +2 -0
- package/src/specs/NativeRNGestureHandlerModule.ts +26 -0
- package/src/web/handlers/FlingGestureHandler.ts +4 -0
- package/src/web/handlers/GestureHandler.ts +20 -2
- package/src/web/handlers/LongPressGestureHandler.ts +8 -5
- package/src/web/handlers/PanGestureHandler.ts +4 -0
- package/src/web/handlers/TapGestureHandler.ts +4 -0
- package/src/web/interfaces.ts +12 -17
- package/src/web/tools/GestureHandlerDelegate.ts +3 -0
- package/src/web/tools/GestureHandlerOrchestrator.ts +2 -2
- package/src/web/tools/GestureHandlerWebDelegate.ts +39 -0
- package/src/web/tools/NodeManager.ts +5 -1
- package/src/web/tools/PointerEventManager.ts +46 -10
- package/src/web/tools/TouchEventManager.ts +2 -8
- package/src/web/utils.ts +9 -0
- package/ios/Handlers/RNPinchHandler.m +0 -95
- package/ios/Handlers/RNRotationHandler.m +0 -93
- package/ios/RNGestureHandlerModule.h +0 -7
- package/lib/commonjs/RNGestureHandlerModule.macos.js +0 -149
- package/lib/commonjs/RNGestureHandlerModule.macos.js.map +0 -1
- package/lib/module/RNGestureHandlerModule.macos.js +0 -110
- package/lib/module/RNGestureHandlerModule.macos.js.map +0 -1
- package/lib/typescript/RNGestureHandlerModule.macos.d.ts +0 -47
- package/src/RNGestureHandlerModule.macos.ts +0 -133
- /package/{ios → apple}/Handlers/RNFlingHandler.h +0 -0
- /package/{ios → apple}/Handlers/RNForceTouchHandler.h +0 -0
- /package/{ios → apple}/Handlers/RNHoverHandler.h +0 -0
- /package/{ios → apple}/Handlers/RNLongPressHandler.h +0 -0
- /package/{ios → apple}/Handlers/RNManualHandler.h +0 -0
- /package/{ios → apple}/Handlers/RNNativeViewHandler.h +0 -0
- /package/{ios → apple}/Handlers/RNPanHandler.h +0 -0
- /package/{ios → apple}/Handlers/RNPinchHandler.h +0 -0
- /package/{ios → apple}/Handlers/RNRotationHandler.h +0 -0
- /package/{ios → apple}/Handlers/RNTapHandler.h +0 -0
- /package/{ios → apple}/RNGHTouchEventType.h +0 -0
- /package/{ios → apple}/RNGestureHandler.xcodeproj/project.pbxproj +0 -0
- /package/{ios → apple}/RNGestureHandler.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -0
- /package/{ios → apple}/RNGestureHandlerActionType.h +0 -0
- /package/{ios → apple}/RNGestureHandlerButtonComponentView.h +0 -0
- /package/{ios → apple}/RNGestureHandlerButtonComponentView.mm +0 -0
- /package/{ios → apple}/RNGestureHandlerButtonManager.h +0 -0
- /package/{ios → apple}/RNGestureHandlerDirection.h +0 -0
- /package/{ios → apple}/RNGestureHandlerRootViewComponentView.mm +0 -0
- /package/{ios → apple}/RNGestureHandlerState.h +0 -0
- /package/{ios → apple}/RNGestureHandlerStateManager.h +0 -0
- /package/{ios → apple}/RNRootViewGestureRecognizer.h +0 -0
package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootHelper.kt
CHANGED
|
@@ -10,6 +10,7 @@ import com.facebook.react.bridge.ReactContext
|
|
|
10
10
|
import com.facebook.react.bridge.UiThreadUtil
|
|
11
11
|
import com.facebook.react.common.ReactConstants
|
|
12
12
|
import com.facebook.react.uimanager.RootView
|
|
13
|
+
import com.facebook.react.uimanager.ThemedReactContext
|
|
13
14
|
import com.swmansion.gesturehandler.core.GestureHandler
|
|
14
15
|
import com.swmansion.gesturehandler.core.GestureHandlerOrchestrator
|
|
15
16
|
|
|
@@ -24,7 +25,7 @@ class RNGestureHandlerRootHelper(private val context: ReactContext, wrappedView:
|
|
|
24
25
|
UiThreadUtil.assertOnUiThread()
|
|
25
26
|
val wrappedViewTag = wrappedView.id
|
|
26
27
|
check(wrappedViewTag >= 1) { "Expect view tag to be set for $wrappedView" }
|
|
27
|
-
val module = context.getNativeModule(RNGestureHandlerModule::class.java)!!
|
|
28
|
+
val module = (context as ThemedReactContext).reactApplicationContext.getNativeModule(RNGestureHandlerModule::class.java)!!
|
|
28
29
|
val registry = module.registry
|
|
29
30
|
rootView = findRootViewTag(wrappedView)
|
|
30
31
|
Log.i(
|
|
@@ -49,7 +50,7 @@ class RNGestureHandlerRootHelper(private val context: ReactContext, wrappedView:
|
|
|
49
50
|
ReactConstants.TAG,
|
|
50
51
|
"[GESTURE HANDLER] Tearing down gesture handler registered for root view $rootView"
|
|
51
52
|
)
|
|
52
|
-
val module = context.getNativeModule(RNGestureHandlerModule::class.java)!!
|
|
53
|
+
val module = (context as ThemedReactContext).reactApplicationContext.getNativeModule(RNGestureHandlerModule::class.java)!!
|
|
53
54
|
with(module) {
|
|
54
55
|
registry.dropHandler(jsGestureHandler!!.tag)
|
|
55
56
|
unregisterRootHelper(this@RNGestureHandlerRootHelper)
|
|
@@ -7,16 +7,19 @@ abstract class GestureHandlerEventDataBuilder<T : GestureHandler<T>>(handler: T)
|
|
|
7
7
|
private val numberOfPointers: Int
|
|
8
8
|
private val handlerTag: Int
|
|
9
9
|
private val state: Int
|
|
10
|
+
private val pointerType: Int
|
|
10
11
|
|
|
11
12
|
init {
|
|
12
13
|
numberOfPointers = handler.numberOfPointers
|
|
13
14
|
handlerTag = handler.tag
|
|
14
15
|
state = handler.state
|
|
16
|
+
pointerType = handler.pointerType
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
open fun buildEventData(eventData: WritableMap) {
|
|
18
20
|
eventData.putInt("numberOfPointers", numberOfPointers)
|
|
19
21
|
eventData.putInt("handlerTag", handlerTag)
|
|
20
22
|
eventData.putInt("state", state)
|
|
23
|
+
eventData.putInt("pointerType", pointerType)
|
|
21
24
|
}
|
|
22
25
|
}
|
|
@@ -7,29 +7,25 @@ using namespace facebook;
|
|
|
7
7
|
using namespace react;
|
|
8
8
|
|
|
9
9
|
void decorateRuntime(jsi::Runtime &runtime) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
10
|
+
auto isFormsStackingContext = jsi::Function::createFromHostFunction(
|
|
11
|
+
runtime,
|
|
12
|
+
jsi::PropNameID::forAscii(runtime, "isFormsStackingContext"),
|
|
13
|
+
1,
|
|
14
|
+
[](jsi::Runtime &runtime,
|
|
15
|
+
const jsi::Value &thisValue,
|
|
16
|
+
const jsi::Value *arguments,
|
|
17
|
+
size_t count) -> jsi::Value {
|
|
18
|
+
if (!arguments[0].isObject()) {
|
|
19
|
+
return jsi::Value::null();
|
|
20
|
+
}
|
|
21
|
+
auto shadowNode = arguments[0]
|
|
22
|
+
.asObject(runtime).getNativeState<ShadowNode>(runtime);
|
|
23
|
+
bool isFormsStackingContext = shadowNode->getTraits().check(ShadowNodeTraits::FormsStackingContext);
|
|
21
24
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
bool isFormsStackingContext = shadowNode->getTraits().check(
|
|
27
|
-
ShadowNodeTraits::FormsStackingContext);
|
|
28
|
-
|
|
29
|
-
return jsi::Value(isFormsStackingContext);
|
|
30
|
-
});
|
|
31
|
-
runtime.global().setProperty(
|
|
32
|
-
runtime, "isFormsStackingContext", std::move(isFormsStackingContext));
|
|
25
|
+
return jsi::Value(isFormsStackingContext);
|
|
26
|
+
});
|
|
27
|
+
runtime.global().setProperty(
|
|
28
|
+
runtime, "isFormsStackingContext", std::move(isFormsStackingContext));
|
|
33
29
|
}
|
|
34
30
|
|
|
35
31
|
extern "C" JNIEXPORT void JNICALL
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
#import "RNFlingHandler.h"
|
|
2
2
|
|
|
3
|
+
#if !TARGET_OS_OSX
|
|
4
|
+
|
|
3
5
|
@interface RNBetterSwipeGestureRecognizer : UISwipeGestureRecognizer
|
|
4
6
|
|
|
5
7
|
- (id)initWithGestureHandler:(RNGestureHandler *)gestureHandler;
|
|
@@ -22,8 +24,9 @@
|
|
|
22
24
|
return self;
|
|
23
25
|
}
|
|
24
26
|
|
|
25
|
-
- (void)touchesBegan:(NSSet<
|
|
27
|
+
- (void)touchesBegan:(NSSet<RNGHUITouch *> *)touches withEvent:(UIEvent *)event
|
|
26
28
|
{
|
|
29
|
+
[_gestureHandler setCurrentPointerType:event];
|
|
27
30
|
_lastPoint = [[[touches allObjects] objectAtIndex:0] locationInView:_gestureHandler.recognizer.view];
|
|
28
31
|
[_gestureHandler reset];
|
|
29
32
|
[super touchesBegan:touches withEvent:event];
|
|
@@ -38,21 +41,21 @@
|
|
|
38
41
|
}
|
|
39
42
|
}
|
|
40
43
|
|
|
41
|
-
- (void)touchesMoved:(NSSet<
|
|
44
|
+
- (void)touchesMoved:(NSSet<RNGHUITouch *> *)touches withEvent:(UIEvent *)event
|
|
42
45
|
{
|
|
43
46
|
_lastPoint = [[[touches allObjects] objectAtIndex:0] locationInView:_gestureHandler.recognizer.view];
|
|
44
47
|
[super touchesMoved:touches withEvent:event];
|
|
45
48
|
[_gestureHandler.pointerTracker touchesMoved:touches withEvent:event];
|
|
46
49
|
}
|
|
47
50
|
|
|
48
|
-
- (void)touchesEnded:(NSSet<
|
|
51
|
+
- (void)touchesEnded:(NSSet<RNGHUITouch *> *)touches withEvent:(UIEvent *)event
|
|
49
52
|
{
|
|
50
53
|
_lastPoint = [[[touches allObjects] objectAtIndex:0] locationInView:_gestureHandler.recognizer.view];
|
|
51
54
|
[super touchesEnded:touches withEvent:event];
|
|
52
55
|
[_gestureHandler.pointerTracker touchesEnded:touches withEvent:event];
|
|
53
56
|
}
|
|
54
57
|
|
|
55
|
-
- (void)touchesCancelled:(NSSet<
|
|
58
|
+
- (void)touchesCancelled:(NSSet<RNGHUITouch *> *)touches withEvent:(UIEvent *)event
|
|
56
59
|
{
|
|
57
60
|
_lastPoint = [[[touches allObjects] objectAtIndex:0] locationInView:_gestureHandler.recognizer.view];
|
|
58
61
|
[super touchesCancelled:touches withEvent:event];
|
|
@@ -70,6 +73,7 @@
|
|
|
70
73
|
[_gestureHandler.pointerTracker reset];
|
|
71
74
|
_hasBegan = NO;
|
|
72
75
|
[super reset];
|
|
76
|
+
[_gestureHandler reset];
|
|
73
77
|
}
|
|
74
78
|
|
|
75
79
|
- (CGPoint)getLastLocation
|
|
@@ -91,6 +95,7 @@
|
|
|
91
95
|
}
|
|
92
96
|
return self;
|
|
93
97
|
}
|
|
98
|
+
|
|
94
99
|
- (void)resetConfig
|
|
95
100
|
{
|
|
96
101
|
[super resetConfig];
|
|
@@ -137,16 +142,32 @@
|
|
|
137
142
|
|
|
138
143
|
RNBetterSwipeGestureRecognizer *recognizer = (RNBetterSwipeGestureRecognizer *)_recognizer;
|
|
139
144
|
|
|
140
|
-
CGPoint viewAbsolutePosition =
|
|
141
|
-
|
|
142
|
-
toView:[UIApplication sharedApplication].keyWindow.rootViewController.view];
|
|
145
|
+
CGPoint viewAbsolutePosition = [recognizer.view convertPoint:recognizer.view.bounds.origin
|
|
146
|
+
toView:RCTKeyWindow().rootViewController.view];
|
|
143
147
|
CGPoint locationInView = [recognizer getLastLocation];
|
|
144
148
|
|
|
145
149
|
return [RNGestureHandlerEventExtraData
|
|
146
150
|
forPosition:locationInView
|
|
147
151
|
withAbsolutePosition:CGPointMake(
|
|
148
152
|
viewAbsolutePosition.x + locationInView.x, viewAbsolutePosition.y + locationInView.y)
|
|
149
|
-
withNumberOfTouches:recognizer.numberOfTouches
|
|
153
|
+
withNumberOfTouches:recognizer.numberOfTouches
|
|
154
|
+
withPointerType:_pointerType];
|
|
155
|
+
}
|
|
156
|
+
@end
|
|
157
|
+
|
|
158
|
+
#else
|
|
159
|
+
|
|
160
|
+
@implementation RNFlingGestureHandler
|
|
161
|
+
|
|
162
|
+
- (instancetype)initWithTag:(NSNumber *)tag
|
|
163
|
+
{
|
|
164
|
+
RCTLogWarn(@"FlingGestureHandler is not supported on macOS");
|
|
165
|
+
if ((self = [super initWithTag:tag])) {
|
|
166
|
+
_recognizer = [NSGestureRecognizer alloc];
|
|
167
|
+
}
|
|
168
|
+
return self;
|
|
150
169
|
}
|
|
151
170
|
|
|
152
171
|
@end
|
|
172
|
+
|
|
173
|
+
#endif
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#import "RNForceTouchHandler.h"
|
|
2
2
|
|
|
3
|
+
#if !TARGET_OS_OSX
|
|
3
4
|
#import <UIKit/UIGestureRecognizerSubclass.h>
|
|
4
5
|
|
|
5
6
|
#import <React/RCTConvert.h>
|
|
@@ -17,7 +18,7 @@
|
|
|
17
18
|
|
|
18
19
|
@implementation RNForceTouchGestureRecognizer {
|
|
19
20
|
__weak RNGestureHandler *_gestureHandler;
|
|
20
|
-
|
|
21
|
+
RNGHUITouch *_firstTouch;
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
static const CGFloat defaultForce = 0;
|
|
@@ -37,8 +38,9 @@ static const BOOL defaultFeedbackOnActivation = NO;
|
|
|
37
38
|
return self;
|
|
38
39
|
}
|
|
39
40
|
|
|
40
|
-
- (void)touchesBegan:(NSSet<
|
|
41
|
+
- (void)touchesBegan:(NSSet<RNGHUITouch *> *)touches withEvent:(UIEvent *)event
|
|
41
42
|
{
|
|
43
|
+
[_gestureHandler setCurrentPointerType:event];
|
|
42
44
|
if (_firstTouch) {
|
|
43
45
|
// ignore rest of fingers
|
|
44
46
|
return;
|
|
@@ -51,7 +53,7 @@ static const BOOL defaultFeedbackOnActivation = NO;
|
|
|
51
53
|
self.state = UIGestureRecognizerStatePossible;
|
|
52
54
|
}
|
|
53
55
|
|
|
54
|
-
- (void)touchesMoved:(NSSet<
|
|
56
|
+
- (void)touchesMoved:(NSSet<RNGHUITouch *> *)touches withEvent:(UIEvent *)event
|
|
55
57
|
{
|
|
56
58
|
if (![touches containsObject:_firstTouch]) {
|
|
57
59
|
// Considered only the very first touch
|
|
@@ -85,7 +87,7 @@ static const BOOL defaultFeedbackOnActivation = NO;
|
|
|
85
87
|
|
|
86
88
|
- (void)performFeedbackIfRequired
|
|
87
89
|
{
|
|
88
|
-
#if !TARGET_OS_TV
|
|
90
|
+
#if !TARGET_OS_TV && !TARGET_OS_VISION
|
|
89
91
|
if (_feedbackOnActivation) {
|
|
90
92
|
if (@available(iOS 10.0, *)) {
|
|
91
93
|
[[[UIImpactFeedbackGenerator alloc] initWithStyle:(UIImpactFeedbackStyleMedium)] impactOccurred];
|
|
@@ -94,7 +96,7 @@ static const BOOL defaultFeedbackOnActivation = NO;
|
|
|
94
96
|
#endif
|
|
95
97
|
}
|
|
96
98
|
|
|
97
|
-
- (void)touchesEnded:(NSSet<
|
|
99
|
+
- (void)touchesEnded:(NSSet<RNGHUITouch *> *)touches withEvent:(UIEvent *)event
|
|
98
100
|
{
|
|
99
101
|
if (![touches containsObject:_firstTouch]) {
|
|
100
102
|
// Considered only the very first touch
|
|
@@ -109,13 +111,13 @@ static const BOOL defaultFeedbackOnActivation = NO;
|
|
|
109
111
|
}
|
|
110
112
|
}
|
|
111
113
|
|
|
112
|
-
- (void)touchesCancelled:(NSSet<
|
|
114
|
+
- (void)touchesCancelled:(NSSet<RNGHUITouch *> *)touches withEvent:(UIEvent *)event
|
|
113
115
|
{
|
|
114
116
|
[super touchesCancelled:touches withEvent:event];
|
|
115
117
|
[_gestureHandler.pointerTracker touchesCancelled:touches withEvent:event];
|
|
116
118
|
}
|
|
117
119
|
|
|
118
|
-
- (void)handleForceWithTouches:(NSSet<
|
|
120
|
+
- (void)handleForceWithTouches:(NSSet<RNGHUITouch *> *)touches
|
|
119
121
|
{
|
|
120
122
|
_force = _firstTouch.force / _firstTouch.maximumPossibleForce;
|
|
121
123
|
}
|
|
@@ -124,6 +126,7 @@ static const BOOL defaultFeedbackOnActivation = NO;
|
|
|
124
126
|
{
|
|
125
127
|
[_gestureHandler.pointerTracker reset];
|
|
126
128
|
[super reset];
|
|
129
|
+
[_gestureHandler reset];
|
|
127
130
|
_force = 0;
|
|
128
131
|
_firstTouch = NULL;
|
|
129
132
|
}
|
|
@@ -169,7 +172,24 @@ static const BOOL defaultFeedbackOnActivation = NO;
|
|
|
169
172
|
return [RNGestureHandlerEventExtraData forForce:recognizer.force
|
|
170
173
|
forPosition:[recognizer locationInView:recognizer.view]
|
|
171
174
|
withAbsolutePosition:[recognizer locationInView:recognizer.view.window]
|
|
172
|
-
withNumberOfTouches:recognizer.numberOfTouches
|
|
175
|
+
withNumberOfTouches:recognizer.numberOfTouches
|
|
176
|
+
withPointerType:_pointerType];
|
|
173
177
|
}
|
|
174
178
|
|
|
175
179
|
@end
|
|
180
|
+
|
|
181
|
+
#else
|
|
182
|
+
|
|
183
|
+
@implementation RNForceTouchHandler
|
|
184
|
+
|
|
185
|
+
- (instancetype)initWithTag:(NSNumber *)tag
|
|
186
|
+
{
|
|
187
|
+
if ((self = [super initWithTag:tag])) {
|
|
188
|
+
_recognizer = [NSGestureRecognizer alloc];
|
|
189
|
+
}
|
|
190
|
+
return self;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
@end
|
|
194
|
+
|
|
195
|
+
#endif
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
#import "RNHoverHandler.h"
|
|
9
9
|
|
|
10
|
+
#if !TARGET_OS_OSX
|
|
11
|
+
|
|
10
12
|
#import <React/RCTConvert.h>
|
|
11
13
|
#import <UIKit/UIGestureRecognizerSubclass.h>
|
|
12
14
|
|
|
@@ -54,6 +56,12 @@ API_AVAILABLE(ios(13.4))
|
|
|
54
56
|
self.enabled = NO;
|
|
55
57
|
}
|
|
56
58
|
|
|
59
|
+
- (void)reset
|
|
60
|
+
{
|
|
61
|
+
[super reset];
|
|
62
|
+
[_gestureHandler reset];
|
|
63
|
+
}
|
|
64
|
+
|
|
57
65
|
- (UIPointerStyle *)pointerInteraction:(UIPointerInteraction *)interaction styleForRegion:(UIPointerRegion *)region
|
|
58
66
|
{
|
|
59
67
|
if (interaction.view != nil && _hoverEffect != RNGestureHandlerHoverEffectNone) {
|
|
@@ -85,7 +93,7 @@ API_AVAILABLE(ios(13.4))
|
|
|
85
93
|
- (instancetype)initWithTag:(NSNumber *)tag
|
|
86
94
|
{
|
|
87
95
|
#if TARGET_OS_TV
|
|
88
|
-
RCTLogWarn(@"
|
|
96
|
+
RCTLogWarn(@"HoverGestureHandler is not supported on tvOS");
|
|
89
97
|
#endif
|
|
90
98
|
|
|
91
99
|
if ((self = [super initWithTag:tag])) {
|
|
@@ -147,7 +155,25 @@ API_AVAILABLE(ios(13.4))
|
|
|
147
155
|
- (RNGestureHandlerEventExtraData *)eventExtraData:(UIGestureRecognizer *)recognizer
|
|
148
156
|
{
|
|
149
157
|
return [RNGestureHandlerEventExtraData forPosition:[recognizer locationInView:recognizer.view]
|
|
150
|
-
withAbsolutePosition:[recognizer locationInView:recognizer.view.window]
|
|
158
|
+
withAbsolutePosition:[recognizer locationInView:recognizer.view.window]
|
|
159
|
+
withPointerType:UITouchTypePencil];
|
|
151
160
|
}
|
|
152
161
|
|
|
153
162
|
@end
|
|
163
|
+
|
|
164
|
+
#else
|
|
165
|
+
|
|
166
|
+
@implementation RNHoverGestureHandler
|
|
167
|
+
|
|
168
|
+
- (instancetype)initWithTag:(NSNumber *)tag
|
|
169
|
+
{
|
|
170
|
+
RCTLogWarn(@"HoverGestureHandler is not supported on macOS");
|
|
171
|
+
if ((self = [super initWithTag:tag])) {
|
|
172
|
+
_recognizer = [NSGestureRecognizer alloc];
|
|
173
|
+
}
|
|
174
|
+
return self;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
@end
|
|
178
|
+
|
|
179
|
+
#endif
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
#import "RNLongPressHandler.h"
|
|
10
10
|
|
|
11
|
+
#if !TARGET_OS_OSX
|
|
12
|
+
|
|
11
13
|
#import <UIKit/UIGestureRecognizerSubclass.h>
|
|
12
14
|
|
|
13
15
|
#import <React/RCTConvert.h>
|
|
@@ -55,8 +57,9 @@
|
|
|
55
57
|
return CGPointMake(currentPosition.x - _initPosition.x, currentPosition.y - _initPosition.y);
|
|
56
58
|
}
|
|
57
59
|
|
|
58
|
-
- (void)touchesBegan:(NSSet<
|
|
60
|
+
- (void)touchesBegan:(NSSet<RNGHUITouch *> *)touches withEvent:(UIEvent *)event
|
|
59
61
|
{
|
|
62
|
+
[_gestureHandler setCurrentPointerType:event];
|
|
60
63
|
[super touchesBegan:touches withEvent:event];
|
|
61
64
|
[_gestureHandler.pointerTracker touchesBegan:touches withEvent:event];
|
|
62
65
|
|
|
@@ -66,7 +69,7 @@
|
|
|
66
69
|
[self triggerAction];
|
|
67
70
|
}
|
|
68
71
|
|
|
69
|
-
- (void)touchesMoved:(NSSet<
|
|
72
|
+
- (void)touchesMoved:(NSSet<RNGHUITouch *> *)touches withEvent:(UIEvent *)event
|
|
70
73
|
{
|
|
71
74
|
[super touchesMoved:touches withEvent:event];
|
|
72
75
|
[_gestureHandler.pointerTracker touchesMoved:touches withEvent:event];
|
|
@@ -80,13 +83,13 @@
|
|
|
80
83
|
}
|
|
81
84
|
}
|
|
82
85
|
|
|
83
|
-
- (void)touchesEnded:(NSSet<
|
|
86
|
+
- (void)touchesEnded:(NSSet<RNGHUITouch *> *)touches withEvent:(UIEvent *)event
|
|
84
87
|
{
|
|
85
88
|
[super touchesEnded:touches withEvent:event];
|
|
86
89
|
[_gestureHandler.pointerTracker touchesEnded:touches withEvent:event];
|
|
87
90
|
}
|
|
88
91
|
|
|
89
|
-
- (void)touchesCancelled:(NSSet<
|
|
92
|
+
- (void)touchesCancelled:(NSSet<RNGHUITouch *> *)touches withEvent:(UIEvent *)event
|
|
90
93
|
{
|
|
91
94
|
[super touchesCancelled:touches withEvent:event];
|
|
92
95
|
[_gestureHandler.pointerTracker touchesCancelled:touches withEvent:event];
|
|
@@ -101,6 +104,7 @@
|
|
|
101
104
|
[_gestureHandler.pointerTracker reset];
|
|
102
105
|
|
|
103
106
|
[super reset];
|
|
107
|
+
[_gestureHandler reset];
|
|
104
108
|
}
|
|
105
109
|
|
|
106
110
|
- (NSUInteger)getDuration
|
|
@@ -178,6 +182,24 @@
|
|
|
178
182
|
return [RNGestureHandlerEventExtraData forPosition:[recognizer locationInView:recognizer.view]
|
|
179
183
|
withAbsolutePosition:[recognizer locationInView:recognizer.view.window]
|
|
180
184
|
withNumberOfTouches:recognizer.numberOfTouches
|
|
181
|
-
withDuration:[(RNBetterLongPressGestureRecognizer *)recognizer getDuration]
|
|
185
|
+
withDuration:[(RNBetterLongPressGestureRecognizer *)recognizer getDuration]
|
|
186
|
+
withPointerType:_pointerType];
|
|
182
187
|
}
|
|
183
188
|
@end
|
|
189
|
+
|
|
190
|
+
#else
|
|
191
|
+
|
|
192
|
+
@implementation RNLongPressGestureHandler
|
|
193
|
+
|
|
194
|
+
- (instancetype)initWithTag:(NSNumber *)tag
|
|
195
|
+
{
|
|
196
|
+
RCTLogWarn(@"LongPressGestureHandler is not supported on macOS");
|
|
197
|
+
if ((self = [super initWithTag:tag])) {
|
|
198
|
+
_recognizer = [NSGestureRecognizer alloc];
|
|
199
|
+
}
|
|
200
|
+
return self;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
@end
|
|
204
|
+
|
|
205
|
+
#endif
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
#import "RNManualHandler.h"
|
|
2
2
|
|
|
3
|
+
#if !TARGET_OS_OSX
|
|
4
|
+
|
|
3
5
|
@interface RNManualRecognizer : UIGestureRecognizer
|
|
4
6
|
|
|
5
7
|
- (id)initWithGestureHandler:(RNGestureHandler *)gestureHandler;
|
|
@@ -20,8 +22,9 @@
|
|
|
20
22
|
return self;
|
|
21
23
|
}
|
|
22
24
|
|
|
23
|
-
- (void)touchesBegan:(NSSet<
|
|
25
|
+
- (void)touchesBegan:(NSSet<RNGHUITouch *> *)touches withEvent:(UIEvent *)event
|
|
24
26
|
{
|
|
27
|
+
[_gestureHandler setCurrentPointerType:event];
|
|
25
28
|
[super touchesBegan:touches withEvent:event];
|
|
26
29
|
[_gestureHandler.pointerTracker touchesBegan:touches withEvent:event];
|
|
27
30
|
|
|
@@ -31,7 +34,7 @@
|
|
|
31
34
|
}
|
|
32
35
|
}
|
|
33
36
|
|
|
34
|
-
- (void)touchesMoved:(NSSet<
|
|
37
|
+
- (void)touchesMoved:(NSSet<RNGHUITouch *> *)touches withEvent:(UIEvent *)event
|
|
35
38
|
{
|
|
36
39
|
[super touchesMoved:touches withEvent:event];
|
|
37
40
|
[_gestureHandler.pointerTracker touchesMoved:touches withEvent:event];
|
|
@@ -44,13 +47,13 @@
|
|
|
44
47
|
}
|
|
45
48
|
}
|
|
46
49
|
|
|
47
|
-
- (void)touchesEnded:(NSSet<
|
|
50
|
+
- (void)touchesEnded:(NSSet<RNGHUITouch *> *)touches withEvent:(UIEvent *)event
|
|
48
51
|
{
|
|
49
52
|
[super touchesEnded:touches withEvent:event];
|
|
50
53
|
[_gestureHandler.pointerTracker touchesEnded:touches withEvent:event];
|
|
51
54
|
}
|
|
52
55
|
|
|
53
|
-
- (void)touchesCancelled:(NSSet<
|
|
56
|
+
- (void)touchesCancelled:(NSSet<RNGHUITouch *> *)touches withEvent:(UIEvent *)event
|
|
54
57
|
{
|
|
55
58
|
[super touchesCancelled:touches withEvent:event];
|
|
56
59
|
[_gestureHandler.pointerTracker touchesCancelled:touches withEvent:event];
|
|
@@ -60,6 +63,7 @@
|
|
|
60
63
|
{
|
|
61
64
|
[_gestureHandler.pointerTracker reset];
|
|
62
65
|
[super reset];
|
|
66
|
+
[_gestureHandler reset];
|
|
63
67
|
|
|
64
68
|
_shouldSendBeginEvent = YES;
|
|
65
69
|
}
|
|
@@ -86,3 +90,20 @@
|
|
|
86
90
|
}
|
|
87
91
|
|
|
88
92
|
@end
|
|
93
|
+
|
|
94
|
+
#else
|
|
95
|
+
|
|
96
|
+
@implementation RNManualGestureHandler
|
|
97
|
+
|
|
98
|
+
- (instancetype)initWithTag:(NSNumber *)tag
|
|
99
|
+
{
|
|
100
|
+
RCTLogWarn(@"ManualGestureHandler is not supported on macOS");
|
|
101
|
+
if ((self = [super initWithTag:tag])) {
|
|
102
|
+
_recognizer = [NSGestureRecognizer alloc];
|
|
103
|
+
}
|
|
104
|
+
return self;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
@end
|
|
108
|
+
|
|
109
|
+
#endif
|
|
@@ -8,7 +8,9 @@
|
|
|
8
8
|
|
|
9
9
|
#import "RNNativeViewHandler.h"
|
|
10
10
|
|
|
11
|
+
#if !TARGET_OS_OSX
|
|
11
12
|
#import <UIKit/UIGestureRecognizerSubclass.h>
|
|
13
|
+
#endif
|
|
12
14
|
|
|
13
15
|
#import <React/RCTConvert.h>
|
|
14
16
|
#import <React/UIView+React.h>
|
|
@@ -19,6 +21,8 @@
|
|
|
19
21
|
#import <React/RCTScrollView.h>
|
|
20
22
|
#endif // RCT_NEW_ARCH_ENABLED
|
|
21
23
|
|
|
24
|
+
#if !TARGET_OS_OSX
|
|
25
|
+
|
|
22
26
|
#pragma mark RNDummyGestureRecognizer
|
|
23
27
|
|
|
24
28
|
@implementation RNDummyGestureRecognizer {
|
|
@@ -33,24 +37,25 @@
|
|
|
33
37
|
return self;
|
|
34
38
|
}
|
|
35
39
|
|
|
36
|
-
- (void)touchesBegan:(NSSet<
|
|
40
|
+
- (void)touchesBegan:(NSSet<RNGHUITouch *> *)touches withEvent:(UIEvent *)event
|
|
37
41
|
{
|
|
42
|
+
[_gestureHandler setCurrentPointerType:event];
|
|
38
43
|
[_gestureHandler.pointerTracker touchesBegan:touches withEvent:event];
|
|
39
44
|
}
|
|
40
45
|
|
|
41
|
-
- (void)touchesMoved:(NSSet<
|
|
46
|
+
- (void)touchesMoved:(NSSet<RNGHUITouch *> *)touches withEvent:(UIEvent *)event
|
|
42
47
|
{
|
|
43
48
|
[_gestureHandler.pointerTracker touchesMoved:touches withEvent:event];
|
|
44
49
|
}
|
|
45
50
|
|
|
46
|
-
- (void)touchesEnded:(NSSet<
|
|
51
|
+
- (void)touchesEnded:(NSSet<RNGHUITouch *> *)touches withEvent:(UIEvent *)event
|
|
47
52
|
{
|
|
48
53
|
[_gestureHandler.pointerTracker touchesEnded:touches withEvent:event];
|
|
49
54
|
self.state = UIGestureRecognizerStateFailed;
|
|
50
55
|
[self reset];
|
|
51
56
|
}
|
|
52
57
|
|
|
53
|
-
- (void)touchesCancelled:(NSSet<
|
|
58
|
+
- (void)touchesCancelled:(NSSet<RNGHUITouch *> *)touches withEvent:(UIEvent *)event
|
|
54
59
|
{
|
|
55
60
|
[_gestureHandler.pointerTracker touchesCancelled:touches withEvent:event];
|
|
56
61
|
self.state = UIGestureRecognizerStateCancelled;
|
|
@@ -61,11 +66,12 @@
|
|
|
61
66
|
{
|
|
62
67
|
[_gestureHandler.pointerTracker reset];
|
|
63
68
|
[super reset];
|
|
69
|
+
[_gestureHandler reset];
|
|
64
70
|
}
|
|
65
71
|
|
|
66
72
|
@end
|
|
67
73
|
|
|
68
|
-
#pragma mark
|
|
74
|
+
#pragma mark RNNativeViewGestureHandler
|
|
69
75
|
|
|
70
76
|
@implementation RNNativeViewGestureHandler {
|
|
71
77
|
BOOL _shouldActivateOnStart;
|
|
@@ -128,12 +134,13 @@
|
|
|
128
134
|
|
|
129
135
|
- (void)handleTouchDown:(UIView *)sender forEvent:(UIEvent *)event
|
|
130
136
|
{
|
|
137
|
+
[self setCurrentPointerType:event];
|
|
131
138
|
[self reset];
|
|
132
139
|
|
|
133
140
|
if (_disallowInterruption) {
|
|
134
141
|
// When `disallowInterruption` is set we cancel all gesture handlers when this UIControl
|
|
135
142
|
// gets DOWN event
|
|
136
|
-
for (
|
|
143
|
+
for (RNGHUITouch *touch in [event allTouches]) {
|
|
137
144
|
for (UIGestureRecognizer *recogn in [touch gestureRecognizers]) {
|
|
138
145
|
recogn.enabled = NO;
|
|
139
146
|
recogn.enabled = YES;
|
|
@@ -143,21 +150,21 @@
|
|
|
143
150
|
|
|
144
151
|
[self sendEventsInState:RNGestureHandlerStateActive
|
|
145
152
|
forViewWithTag:sender.reactTag
|
|
146
|
-
withExtraData:[RNGestureHandlerEventExtraData forPointerInside:YES]];
|
|
153
|
+
withExtraData:[RNGestureHandlerEventExtraData forPointerInside:YES withPointerType:_pointerType]];
|
|
147
154
|
}
|
|
148
155
|
|
|
149
156
|
- (void)handleTouchUpOutside:(UIView *)sender forEvent:(UIEvent *)event
|
|
150
157
|
{
|
|
151
158
|
[self sendEventsInState:RNGestureHandlerStateEnd
|
|
152
159
|
forViewWithTag:sender.reactTag
|
|
153
|
-
withExtraData:[RNGestureHandlerEventExtraData forPointerInside:NO]];
|
|
160
|
+
withExtraData:[RNGestureHandlerEventExtraData forPointerInside:NO withPointerType:_pointerType]];
|
|
154
161
|
}
|
|
155
162
|
|
|
156
163
|
- (void)handleTouchUpInside:(UIView *)sender forEvent:(UIEvent *)event
|
|
157
164
|
{
|
|
158
165
|
[self sendEventsInState:RNGestureHandlerStateEnd
|
|
159
166
|
forViewWithTag:sender.reactTag
|
|
160
|
-
withExtraData:[RNGestureHandlerEventExtraData forPointerInside:YES]];
|
|
167
|
+
withExtraData:[RNGestureHandlerEventExtraData forPointerInside:YES withPointerType:_pointerType]];
|
|
161
168
|
}
|
|
162
169
|
|
|
163
170
|
- (void)handleDragExit:(UIView *)sender forEvent:(UIEvent *)event
|
|
@@ -168,11 +175,11 @@
|
|
|
168
175
|
[control cancelTrackingWithEvent:event];
|
|
169
176
|
[self sendEventsInState:RNGestureHandlerStateEnd
|
|
170
177
|
forViewWithTag:sender.reactTag
|
|
171
|
-
withExtraData:[RNGestureHandlerEventExtraData forPointerInside:NO]];
|
|
178
|
+
withExtraData:[RNGestureHandlerEventExtraData forPointerInside:NO withPointerType:_pointerType]];
|
|
172
179
|
} else {
|
|
173
180
|
[self sendEventsInState:RNGestureHandlerStateActive
|
|
174
181
|
forViewWithTag:sender.reactTag
|
|
175
|
-
withExtraData:[RNGestureHandlerEventExtraData forPointerInside:NO]];
|
|
182
|
+
withExtraData:[RNGestureHandlerEventExtraData forPointerInside:NO withPointerType:_pointerType]];
|
|
176
183
|
}
|
|
177
184
|
}
|
|
178
185
|
|
|
@@ -180,14 +187,45 @@
|
|
|
180
187
|
{
|
|
181
188
|
[self sendEventsInState:RNGestureHandlerStateActive
|
|
182
189
|
forViewWithTag:sender.reactTag
|
|
183
|
-
withExtraData:[RNGestureHandlerEventExtraData forPointerInside:YES]];
|
|
190
|
+
withExtraData:[RNGestureHandlerEventExtraData forPointerInside:YES withPointerType:_pointerType]];
|
|
184
191
|
}
|
|
185
192
|
|
|
186
193
|
- (void)handleTouchCancel:(UIView *)sender forEvent:(UIEvent *)event
|
|
187
194
|
{
|
|
188
195
|
[self sendEventsInState:RNGestureHandlerStateCancelled
|
|
189
196
|
forViewWithTag:sender.reactTag
|
|
190
|
-
withExtraData:[RNGestureHandlerEventExtraData forPointerInside:NO]];
|
|
197
|
+
withExtraData:[RNGestureHandlerEventExtraData forPointerInside:NO withPointerType:_pointerType]];
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
@end
|
|
201
|
+
|
|
202
|
+
#else
|
|
203
|
+
|
|
204
|
+
#pragma mark RNDummyGestureRecognizer
|
|
205
|
+
|
|
206
|
+
@implementation RNDummyGestureRecognizer
|
|
207
|
+
|
|
208
|
+
- (id)initWithGestureHandler:(RNGestureHandler *)gestureHandler
|
|
209
|
+
{
|
|
210
|
+
self = [super initWithTarget:gestureHandler action:@selector(handleGesture:)];
|
|
211
|
+
return self;
|
|
191
212
|
}
|
|
192
213
|
|
|
193
214
|
@end
|
|
215
|
+
|
|
216
|
+
#pragma mark RNNativeViewGestureHandler
|
|
217
|
+
|
|
218
|
+
@implementation RNNativeViewGestureHandler
|
|
219
|
+
|
|
220
|
+
- (instancetype)initWithTag:(NSNumber *)tag
|
|
221
|
+
{
|
|
222
|
+
RCTLogWarn(@"NativeViewGestureHandler is not supported on macOS");
|
|
223
|
+
if ((self = [super initWithTag:tag])) {
|
|
224
|
+
_recognizer = [NSGestureRecognizer alloc];
|
|
225
|
+
}
|
|
226
|
+
return self;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
@end
|
|
230
|
+
|
|
231
|
+
#endif
|