@react-native-oh-tpl/react-native-gesture-handler 2.14.7 → 2.14.13
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/DrawerLayout/index.ts +2 -2
- package/Swipeable/index.ts +2 -2
- package/harmony/gesture_handler/BuildProfile.ets +17 -0
- package/harmony/gesture_handler/build-profile.json5 +19 -0
- package/harmony/gesture_handler/hvigorfile.ts +2 -0
- package/harmony/gesture_handler/index.ets +3 -0
- package/harmony/gesture_handler/oh-package-lock.json5 +18 -0
- package/harmony/gesture_handler/oh-package.json5 +12 -0
- package/harmony/gesture_handler/src/main/cpp/CMakeLists.txt +8 -0
- package/harmony/gesture_handler/src/main/cpp/GestureHandlerPackage.cpp +149 -0
- package/harmony/gesture_handler/src/main/cpp/GestureHandlerPackage.h +21 -0
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerButtonComponentDescriptor.h +36 -0
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerButtonJSIBinder.h +32 -0
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerModule.cpp +22 -0
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerModule.h +15 -0
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerRootViewComponentDescriptor.h +36 -0
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerRootViewJSIBinder.h +25 -0
- package/harmony/gesture_handler/src/main/cpp/componentInstances/RNGestureHandlerButtonComponentInstance.h +27 -0
- package/harmony/gesture_handler/src/main/cpp/componentInstances/RNGestureHandlerRootViewComponentInstance.h +242 -0
- package/harmony/gesture_handler/src/main/ets/core/CircularBuffer.ts +42 -0
- package/harmony/gesture_handler/src/main/ets/core/GestureHandler.ts +690 -0
- package/harmony/gesture_handler/src/main/ets/core/GestureHandlerOrchestrator.ts +335 -0
- package/harmony/gesture_handler/src/main/ets/core/GestureHandlerRegistry.ts +63 -0
- package/harmony/gesture_handler/src/main/ets/core/IncomingEvent.ts +78 -0
- package/harmony/gesture_handler/src/main/ets/core/InteractionManager.ts +144 -0
- package/harmony/gesture_handler/src/main/ets/core/LeastSquareSolver.ts +182 -0
- package/harmony/gesture_handler/src/main/ets/core/OutgoingEvent.ts +34 -0
- package/harmony/gesture_handler/src/main/ets/core/OutgoingEventDispatcher.ts +12 -0
- package/harmony/gesture_handler/src/main/ets/core/PointerTracker.ts +239 -0
- package/harmony/gesture_handler/src/main/ets/core/RNGHError.ts +5 -0
- package/harmony/gesture_handler/src/main/ets/core/RNGHLogger.ts +12 -0
- package/harmony/gesture_handler/src/main/ets/core/State.ts +47 -0
- package/harmony/gesture_handler/src/main/ets/core/Vector2D.ts +80 -0
- package/harmony/gesture_handler/src/main/ets/core/VelocityTracker.ts +106 -0
- package/harmony/gesture_handler/src/main/ets/core/View.ts +21 -0
- package/harmony/gesture_handler/src/main/ets/core/ViewFinder.ts +11 -0
- package/harmony/gesture_handler/src/main/ets/core/ViewRegistry.ts +8 -0
- package/harmony/gesture_handler/src/main/ets/core/index.ts +15 -0
- package/harmony/gesture_handler/src/main/ets/detectors/ScaleGestureDetector.ts +169 -0
- package/harmony/gesture_handler/src/main/ets/gesture-handlers/FlingGestureHandler.ts +211 -0
- package/harmony/gesture_handler/src/main/ets/gesture-handlers/GestureHandlerFactory.ts +64 -0
- package/harmony/gesture_handler/src/main/ets/gesture-handlers/LongPressGestureHandler.ts +127 -0
- package/harmony/gesture_handler/src/main/ets/gesture-handlers/ManualGestureHandler.ts +42 -0
- package/harmony/gesture_handler/src/main/ets/gesture-handlers/NativeViewGestureHandler.ts +115 -0
- package/harmony/gesture_handler/src/main/ets/gesture-handlers/PanGestureHandler.ts +342 -0
- package/harmony/gesture_handler/src/main/ets/gesture-handlers/PinchGestureHandler.ts +159 -0
- package/harmony/gesture_handler/src/main/ets/gesture-handlers/RotationGestureHandler.ts +164 -0
- package/harmony/gesture_handler/src/main/ets/gesture-handlers/TapGestureHandler.ts +206 -0
- package/harmony/gesture_handler/src/main/ets/gesture-handlers/detectors/RotationGestureDetector.ts +167 -0
- package/harmony/gesture_handler/src/main/ets/gesture-handlers/index.ts +1 -0
- package/harmony/gesture_handler/src/main/ets/namespace/RNGestureHandlerModule.ts +24 -0
- package/harmony/gesture_handler/src/main/ets/namespace/components/RNGestureHandlerButton.ts +139 -0
- package/harmony/gesture_handler/src/main/ets/namespace/components/RNGestureHandlerRootView.ts +101 -0
- package/harmony/gesture_handler/src/main/ets/namespace/components/ts.ts +2 -0
- package/harmony/gesture_handler/src/main/ets/namespace/ts.ts +2 -0
- package/harmony/gesture_handler/src/main/ets/rnoh/GestureHandlerArkUIAdapter.ts +240 -0
- package/harmony/gesture_handler/src/main/ets/rnoh/GestureHandlerPackage.ts +22 -0
- package/harmony/gesture_handler/src/main/ets/rnoh/Logger.ts +49 -0
- package/harmony/gesture_handler/src/main/ets/rnoh/OutgoingEventDispatchers.ts +71 -0
- package/harmony/gesture_handler/src/main/ets/rnoh/RNGHRootTouchHandlerArkTS.ts +98 -0
- package/harmony/gesture_handler/src/main/ets/rnoh/RNGHRootTouchHandlerCAPI.ts +110 -0
- package/harmony/gesture_handler/src/main/ets/rnoh/RNGestureHandlerButton.ets +38 -0
- package/harmony/gesture_handler/src/main/ets/rnoh/RNGestureHandlerModule.ts +233 -0
- package/harmony/gesture_handler/src/main/ets/rnoh/RNGestureHandlerRootView.ets +53 -0
- package/harmony/gesture_handler/src/main/ets/rnoh/RNOHGestureResponder.ts +24 -0
- package/harmony/gesture_handler/src/main/ets/rnoh/RNOHScrollLocker.ts +32 -0
- package/harmony/gesture_handler/src/main/ets/rnoh/View.ts +134 -0
- package/harmony/gesture_handler/src/main/ets/rnoh/ViewRegistry.ts +97 -0
- package/harmony/gesture_handler/src/main/ets/rnoh/types.ts +25 -0
- package/harmony/gesture_handler/src/main/module.json5 +9 -0
- package/harmony/gesture_handler/src/main/resources/base/element/color.json +8 -0
- package/harmony/gesture_handler/src/main/resources/base/element/string.json +16 -0
- package/harmony/gesture_handler/src/main/resources/base/media/icon.png +0 -0
- package/harmony/gesture_handler/src/main/resources/base/profile/main_pages.json +5 -0
- package/harmony/gesture_handler/src/main/resources/en_US/element/string.json +16 -0
- package/harmony/gesture_handler/src/main/resources/zh_CN/element/string.json +16 -0
- package/harmony/gesture_handler/ts.ts +2 -0
- package/harmony/gesture_handler.har +0 -0
- package/lib/commonjs/RNGestureHandlerModule.js +3 -2
- package/lib/commonjs/RNGestureHandlerModule.js.map +1 -1
- package/lib/commonjs/components/GestureHandlerRootView.js +3 -3
- package/lib/commonjs/components/GestureHandlerRootView.js.map +1 -1
- package/lib/commonjs/handlers/createHandler.js +18 -15
- package/lib/commonjs/handlers/createHandler.js.map +1 -1
- package/lib/commonjs/index.js +36 -8
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/specs/NativeRNGestureHandlerModule.js +2 -1
- package/lib/commonjs/specs/NativeRNGestureHandlerModule.js.map +1 -1
- package/lib/commonjs/specs/RNGestureHandlerButtonNativeComponent.js +3 -2
- package/lib/commonjs/specs/RNGestureHandlerButtonNativeComponent.js.map +1 -1
- package/lib/commonjs/specs/RNGestureHandlerRootViewNativeComponent.js +3 -2
- package/lib/commonjs/specs/RNGestureHandlerRootViewNativeComponent.js.map +1 -1
- package/lib/module/RNGestureHandlerModule.js.map +1 -1
- package/lib/module/components/GestureHandlerRootView.js.map +1 -1
- package/lib/module/handlers/createHandler.js +15 -12
- package/lib/module/handlers/createHandler.js.map +1 -1
- package/lib/module/index.js +5 -7
- package/lib/module/index.js.map +1 -1
- package/lib/module/specs/NativeRNGestureHandlerModule.js.map +1 -1
- package/lib/module/specs/RNGestureHandlerButtonNativeComponent.js.map +1 -1
- package/lib/module/specs/RNGestureHandlerRootViewNativeComponent.js.map +1 -1
- package/lib/typescript/RNGestureHandlerModule.d.ts +2 -2
- package/lib/typescript/components/GestureHandlerRootView.d.ts +6 -6
- package/lib/typescript/handlers/createHandler.d.ts +11 -11
- package/lib/typescript/index.d.ts +47 -42
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/specs/NativeRNGestureHandlerModule.d.ts +14 -14
- package/lib/typescript/specs/RNGestureHandlerButtonNativeComponent.d.ts +14 -14
- package/lib/typescript/specs/RNGestureHandlerRootViewNativeComponent.d.ts +6 -6
- package/package.json +73 -72
- package/src/RNGestureHandlerModule.ts +4 -4
- package/src/components/GestureHandlerRootView.tsx +23 -23
- package/src/handlers/createHandler.tsx +534 -534
- package/src/index.ts +172 -172
- package/src/specs/NativeRNGestureHandlerModule.ts +26 -26
- package/src/specs/RNGestureHandlerButtonNativeComponent.ts +18 -18
- package/src/specs/RNGestureHandlerRootViewNativeComponent.ts +6 -6
package/DrawerLayout/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import DrawerLayout from 'react-native-gesture-handler/DrawerLayout';
|
|
2
|
-
export default DrawerLayout;
|
|
1
|
+
import DrawerLayout from 'react-native-gesture-handler/DrawerLayout';
|
|
2
|
+
export default DrawerLayout;
|
package/Swipeable/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import Swipeable from 'react-native-gesture-handler/Swipeable';
|
|
2
|
-
export default Swipeable;
|
|
1
|
+
import Swipeable from 'react-native-gesture-handler/Swipeable';
|
|
2
|
+
export default Swipeable;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Use these variables when you tailor your ArkTS code. They must be of the const type.
|
|
3
|
+
*/
|
|
4
|
+
export const HAR_VERSION = '2.14.1-2.14.13';
|
|
5
|
+
export const BUILD_MODE_NAME = 'release';
|
|
6
|
+
export const DEBUG = false;
|
|
7
|
+
export const TARGET_NAME = 'default';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* BuildProfile Class is used only for compatibility purposes.
|
|
11
|
+
*/
|
|
12
|
+
export default class BuildProfile {
|
|
13
|
+
static readonly HAR_VERSION = HAR_VERSION;
|
|
14
|
+
static readonly BUILD_MODE_NAME = BUILD_MODE_NAME;
|
|
15
|
+
static readonly DEBUG = DEBUG;
|
|
16
|
+
static readonly TARGET_NAME = TARGET_NAME;
|
|
17
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"apiType": 'stageMode',
|
|
3
|
+
// "buildOption": {
|
|
4
|
+
// "externalNativeOptions": {
|
|
5
|
+
// "path": "./src/main/cpp/CMakeLists.txt",
|
|
6
|
+
// "arguments": "",
|
|
7
|
+
// "cppFlags": "",
|
|
8
|
+
// },
|
|
9
|
+
// },
|
|
10
|
+
"targets": [
|
|
11
|
+
{
|
|
12
|
+
"name": "default",
|
|
13
|
+
"runtimeOS": "HarmonyOS"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"name": "ohosTest",
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"meta": {
|
|
3
|
+
"stableOrder": false
|
|
4
|
+
},
|
|
5
|
+
"lockfileVersion": 3,
|
|
6
|
+
"ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
|
|
7
|
+
"specifiers": {
|
|
8
|
+
"@rnoh/react-native-openharmony@../react_native_openharmony.har": "@rnoh/react-native-openharmony@../react_native_openharmony.har"
|
|
9
|
+
},
|
|
10
|
+
"packages": {
|
|
11
|
+
"@rnoh/react-native-openharmony@../react_native_openharmony.har": {
|
|
12
|
+
"name": "@rnoh/react-native-openharmony",
|
|
13
|
+
"version": "0.72.28",
|
|
14
|
+
"resolved": "../react_native_openharmony.har",
|
|
15
|
+
"registryType": "local"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
license: '',
|
|
3
|
+
devDependencies: {},
|
|
4
|
+
author: '',
|
|
5
|
+
name: '@react-native-oh-tpl/react-native-gesture-handler',
|
|
6
|
+
description: '',
|
|
7
|
+
type: 'module',
|
|
8
|
+
version: '2.14.1-2.14.13',
|
|
9
|
+
dependencies: {
|
|
10
|
+
"@rnoh/react-native-openharmony": "file:./react_native_openharmony"
|
|
11
|
+
},
|
|
12
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.13)
|
|
2
|
+
set(CMAKE_VERBOSE_MAKEFILE on)
|
|
3
|
+
|
|
4
|
+
file(GLOB rnoh_gesture_handler_SRC CONFIGURE_DEPENDS *.cpp)
|
|
5
|
+
add_library(rnoh_gesture_handler SHARED ${rnoh_gesture_handler_SRC})
|
|
6
|
+
target_include_directories(rnoh_gesture_handler PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
|
7
|
+
target_link_libraries(rnoh_gesture_handler PUBLIC rnoh)
|
|
8
|
+
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
#include "GestureHandlerPackage.h"
|
|
3
|
+
#include "RNOH/RNInstanceCAPI.h"
|
|
4
|
+
#include "componentInstances/RNGestureHandlerButtonComponentInstance.h"
|
|
5
|
+
#include "componentInstances/RNGestureHandlerRootViewComponentInstance.h"
|
|
6
|
+
#include "RNOH/ArkTSTurboModule.h"
|
|
7
|
+
#include "RNGestureHandlerModule.h"
|
|
8
|
+
#include "RNGestureHandlerButtonComponentDescriptor.h"
|
|
9
|
+
#include "RNGestureHandlerRootViewComponentDescriptor.h"
|
|
10
|
+
#include "RNGestureHandlerButtonJSIBinder.h"
|
|
11
|
+
#include "RNGestureHandlerRootViewJSIBinder.h"
|
|
12
|
+
#include <glog/logging.h>
|
|
13
|
+
|
|
14
|
+
using namespace rnoh;
|
|
15
|
+
using namespace facebook;
|
|
16
|
+
|
|
17
|
+
class GestureHandlerTurboModuleFactoryDelegate : public TurboModuleFactoryDelegate {
|
|
18
|
+
public:
|
|
19
|
+
SharedTurboModule createTurboModule(Context ctx, const std::string &name) const override {
|
|
20
|
+
if (name == "RNGestureHandlerModule") {
|
|
21
|
+
return std::make_shared<RNGestureHandlerModule>(ctx, name);
|
|
22
|
+
}
|
|
23
|
+
return nullptr;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class RNGHEventEmitRequestHandler : public EventEmitRequestHandler {
|
|
29
|
+
void handleEvent(EventEmitRequestHandler::Context const &ctx) override {
|
|
30
|
+
auto eventEmitter = ctx.shadowViewRegistry->getEventEmitter<facebook::react::ViewEventEmitter>(ctx.tag);
|
|
31
|
+
if (eventEmitter == nullptr) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (ctx.eventName == "onGestureHandlerEvent") {
|
|
35
|
+
eventEmitter->dispatchUniqueEvent(ctx.eventName, ArkJS(ctx.env).getDynamic(ctx.payload));
|
|
36
|
+
} else if (ctx.eventName == "onGestureHandlerStateChange") {
|
|
37
|
+
eventEmitter->dispatchEvent("onGestureHandlerStateChange", ArkJS(ctx.env).getDynamic(ctx.payload));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
class RNOHCorePackageComponentInstanceFactoryDelegate : public ComponentInstanceFactoryDelegate {
|
|
43
|
+
public:
|
|
44
|
+
using ComponentInstanceFactoryDelegate::ComponentInstanceFactoryDelegate;
|
|
45
|
+
|
|
46
|
+
ComponentInstance::Shared create(ComponentInstance::Context ctx) override {
|
|
47
|
+
if (ctx.componentName == "RNGestureHandlerButton") {
|
|
48
|
+
return std::make_shared<RNGestureHandlerButtonComponentInstance>(ctx);
|
|
49
|
+
} else if (ctx.componentName == "RNGestureHandlerRootView") {
|
|
50
|
+
return std::make_shared<RNGestureHandlerRootViewComponentInstance>(ctx);
|
|
51
|
+
}
|
|
52
|
+
return nullptr;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
std::unique_ptr<TurboModuleFactoryDelegate> GestureHandlerPackage::createTurboModuleFactoryDelegate() {
|
|
57
|
+
return std::make_unique<GestureHandlerTurboModuleFactoryDelegate>();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
std::vector<react::ComponentDescriptorProvider> GestureHandlerPackage::createComponentDescriptorProviders() {
|
|
61
|
+
return {
|
|
62
|
+
react::concreteComponentDescriptorProvider<react::RNGestureHandlerRootViewComponentDescriptor>(),
|
|
63
|
+
react::concreteComponentDescriptorProvider<react::RNGestureHandlerButtonComponentDescriptor>(),
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
ComponentJSIBinderByString GestureHandlerPackage::createComponentJSIBinderByName() {
|
|
68
|
+
return {
|
|
69
|
+
{"RNGestureHandlerButton", std::make_shared<RNGestureHandlerButtonJSIBinder>()},
|
|
70
|
+
{"RNGestureHandlerRootView", std::make_shared<RNGestureHandlerRootViewJSIBinder>()},
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
EventEmitRequestHandlers GestureHandlerPackage::createEventEmitRequestHandlers() {
|
|
75
|
+
return {
|
|
76
|
+
std::make_shared<RNGHEventEmitRequestHandler>(),
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
ComponentInstanceFactoryDelegate::Shared GestureHandlerPackage::createComponentInstanceFactoryDelegate() {
|
|
81
|
+
return std::make_shared<RNOHCorePackageComponentInstanceFactoryDelegate>();
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
class ScrollLockerArkTSMessageHandler : public ArkTSMessageHandler {
|
|
85
|
+
public:
|
|
86
|
+
void handleArkTSMessage(const Context &ctx) override {
|
|
87
|
+
if (ctx.messageName == "RNGH::SET_NATIVE_RESPONDERS_BLOCK") {
|
|
88
|
+
auto targetComponentInstanceTag = ctx.messagePayload["targetTag"].asDouble();
|
|
89
|
+
auto shouldBlock = ctx.messagePayload["shouldBlock"].asBool();
|
|
90
|
+
auto rnInstance = ctx.rnInstance.lock();
|
|
91
|
+
if (rnInstance != nullptr) {
|
|
92
|
+
auto rnInstanceCAPI = std::dynamic_pointer_cast<RNInstanceCAPI>(rnInstance);
|
|
93
|
+
if (rnInstanceCAPI != nullptr) {
|
|
94
|
+
|
|
95
|
+
std::vector<ComponentInstance::Shared> ancestors;
|
|
96
|
+
auto tmpComponentInstance = rnInstanceCAPI->findComponentInstanceByTag(targetComponentInstanceTag);
|
|
97
|
+
while (tmpComponentInstance != nullptr) {
|
|
98
|
+
ancestors.push_back(tmpComponentInstance);
|
|
99
|
+
tmpComponentInstance = tmpComponentInstance->getParent().lock();
|
|
100
|
+
}
|
|
101
|
+
if (ancestors.size() == 0) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Ensure consistent behavior with Android by not blocking scrolls above the GestureHandlerRootView handling
|
|
106
|
+
* the touch. If there are multiple nested GestureHandlerRootViews, the one nearest to the actual root will
|
|
107
|
+
* handle the touch.
|
|
108
|
+
*/
|
|
109
|
+
auto isChangingResponderStatusAllowed = false;
|
|
110
|
+
for (size_t i = ancestors.size() - 1; i > 0; i--) {
|
|
111
|
+
auto ancestor = ancestors[i];
|
|
112
|
+
if (!isChangingResponderStatusAllowed) {
|
|
113
|
+
auto rootView = std::dynamic_pointer_cast<RNGestureHandlerRootViewComponentInstance>(ancestor);
|
|
114
|
+
if (rootView != nullptr) {
|
|
115
|
+
isChangingResponderStatusAllowed = true;
|
|
116
|
+
}
|
|
117
|
+
} else {
|
|
118
|
+
ancestor->setNativeResponderBlocked(shouldBlock, "RNGH");
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
} else if (ctx.messageName == "RNGH::ROOT_VIEW_IS_HANDLING_TOUCHES") {
|
|
124
|
+
auto descendantViewTag = ctx.messagePayload["descendantViewTag"].asDouble();
|
|
125
|
+
auto isHandlingTouches = ctx.messagePayload["isHandlingTouches"].asBool();
|
|
126
|
+
auto rnInstance = ctx.rnInstance.lock();
|
|
127
|
+
if (rnInstance != nullptr) {
|
|
128
|
+
auto rnInstanceCAPI = std::dynamic_pointer_cast<RNInstanceCAPI>(rnInstance);
|
|
129
|
+
if (rnInstanceCAPI != nullptr) {
|
|
130
|
+
auto tmpComponentInstance = rnInstanceCAPI->findComponentInstanceByTag(descendantViewTag);
|
|
131
|
+
while (tmpComponentInstance != nullptr) {
|
|
132
|
+
tmpComponentInstance = tmpComponentInstance->getParent().lock();
|
|
133
|
+
if (tmpComponentInstance) {
|
|
134
|
+
auto rnghRootViewComponentInstance =
|
|
135
|
+
std::dynamic_pointer_cast<RNGestureHandlerRootViewComponentInstance>(tmpComponentInstance);
|
|
136
|
+
if (rnghRootViewComponentInstance) {
|
|
137
|
+
rnghRootViewComponentInstance->setIsHandlingTouches(isHandlingTouches);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
std::vector<ArkTSMessageHandler::Shared> GestureHandlerPackage::createArkTSMessageHandlers() {
|
|
148
|
+
return {std::make_shared<ScrollLockerArkTSMessageHandler>()};
|
|
149
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
#include "RNOH/Package.h"
|
|
3
|
+
|
|
4
|
+
namespace rnoh {
|
|
5
|
+
class GestureHandlerPackage : public Package {
|
|
6
|
+
public:
|
|
7
|
+
GestureHandlerPackage(Package::Context ctx) : Package(ctx) {}
|
|
8
|
+
|
|
9
|
+
std::unique_ptr<TurboModuleFactoryDelegate> createTurboModuleFactoryDelegate() override;
|
|
10
|
+
|
|
11
|
+
std::vector<facebook::react::ComponentDescriptorProvider> createComponentDescriptorProviders() override;
|
|
12
|
+
|
|
13
|
+
ComponentJSIBinderByString createComponentJSIBinderByName() override;
|
|
14
|
+
|
|
15
|
+
EventEmitRequestHandlers createEventEmitRequestHandlers();
|
|
16
|
+
|
|
17
|
+
ComponentInstanceFactoryDelegate::Shared createComponentInstanceFactoryDelegate();
|
|
18
|
+
|
|
19
|
+
std::vector<ArkTSMessageHandler::Shared> createArkTSMessageHandlers() override;
|
|
20
|
+
};
|
|
21
|
+
} // namespace rnoh
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
|
|
2
|
+
#pragma once
|
|
3
|
+
|
|
4
|
+
// This file was generated.
|
|
5
|
+
|
|
6
|
+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
7
|
+
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
8
|
+
#include <react/renderer/components/view/ViewShadowNode.h>
|
|
9
|
+
|
|
10
|
+
namespace facebook {
|
|
11
|
+
namespace react {
|
|
12
|
+
|
|
13
|
+
extern const char RNGestureHandlerButtonComponentName[] = "RNGestureHandlerButton";
|
|
14
|
+
|
|
15
|
+
class RNGestureHandlerButtonProps : public ViewProps {
|
|
16
|
+
public:
|
|
17
|
+
RNGestureHandlerButtonProps() = default;
|
|
18
|
+
|
|
19
|
+
RNGestureHandlerButtonProps(const PropsParserContext &context, const RNGestureHandlerButtonProps &sourceProps, const RawProps &rawProps)
|
|
20
|
+
: ViewProps(context, sourceProps, rawProps) {}
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
using RNGestureHandlerButtonShadowNode = ConcreteViewShadowNode<
|
|
24
|
+
RNGestureHandlerButtonComponentName,
|
|
25
|
+
RNGestureHandlerButtonProps,
|
|
26
|
+
ViewEventEmitter>;
|
|
27
|
+
|
|
28
|
+
class RNGestureHandlerButtonComponentDescriptor final
|
|
29
|
+
: public ConcreteComponentDescriptor<RNGestureHandlerButtonShadowNode> {
|
|
30
|
+
public:
|
|
31
|
+
RNGestureHandlerButtonComponentDescriptor(ComponentDescriptorParameters const ¶meters)
|
|
32
|
+
: ConcreteComponentDescriptor(parameters) {}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
} // namespace react
|
|
36
|
+
} // namespace facebook
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
// This file was generated.
|
|
4
|
+
|
|
5
|
+
#include "RNOHCorePackage/ComponentBinders/ViewComponentJSIBinder.h"
|
|
6
|
+
|
|
7
|
+
namespace rnoh {
|
|
8
|
+
class RNGestureHandlerButtonJSIBinder : public ViewComponentJSIBinder {
|
|
9
|
+
protected:
|
|
10
|
+
facebook::jsi::Object createNativeProps(facebook::jsi::Runtime &rt) override {
|
|
11
|
+
auto object = ViewComponentJSIBinder::createNativeProps(rt);
|
|
12
|
+
object.setProperty(rt, "exclusive", true);
|
|
13
|
+
object.setProperty(rt, "foreground", true);
|
|
14
|
+
object.setProperty(rt, "borderless", true);
|
|
15
|
+
object.setProperty(rt, "enabled", true);
|
|
16
|
+
object.setProperty(rt, "rippleColor", true);
|
|
17
|
+
object.setProperty(rt, "rippleRadius", true);
|
|
18
|
+
object.setProperty(rt, "touchSoundDisabled", true);
|
|
19
|
+
return object;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
facebook::jsi::Object createBubblingEventTypes(facebook::jsi::Runtime &rt) override {
|
|
23
|
+
facebook::jsi::Object events(rt);
|
|
24
|
+
return events;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
facebook::jsi::Object createDirectEventTypes(facebook::jsi::Runtime &rt) override {
|
|
28
|
+
facebook::jsi::Object events(rt);
|
|
29
|
+
return events;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
} // namespace rnoh
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
|
|
2
|
+
#include "RNGestureHandlerModule.h"
|
|
3
|
+
|
|
4
|
+
// This file was generated.
|
|
5
|
+
|
|
6
|
+
namespace rnoh {
|
|
7
|
+
using namespace facebook;
|
|
8
|
+
|
|
9
|
+
RNGestureHandlerModule::RNGestureHandlerModule(const ArkTSTurboModule::Context ctx, const std::string name) : ArkTSTurboModule(ctx, name) {
|
|
10
|
+
methodMap_ = {
|
|
11
|
+
ARK_METHOD_METADATA(handleSetJSResponder, 2),
|
|
12
|
+
ARK_METHOD_METADATA(handleClearJSResponder, 0),
|
|
13
|
+
ARK_METHOD_METADATA(createGestureHandler, 3),
|
|
14
|
+
ARK_METHOD_METADATA(attachGestureHandler, 3),
|
|
15
|
+
ARK_METHOD_METADATA(updateGestureHandler, 2),
|
|
16
|
+
ARK_METHOD_METADATA(dropGestureHandler, 1),
|
|
17
|
+
ARK_METHOD_METADATA(install, 0),
|
|
18
|
+
ARK_METHOD_METADATA(flushOperations, 0),
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
} // namespace rnoh
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
|
|
2
|
+
#pragma once
|
|
3
|
+
|
|
4
|
+
// This file was generated.
|
|
5
|
+
|
|
6
|
+
#include "RNOH/ArkTSTurboModule.h"
|
|
7
|
+
|
|
8
|
+
namespace rnoh {
|
|
9
|
+
|
|
10
|
+
class JSI_EXPORT RNGestureHandlerModule : public ArkTSTurboModule {
|
|
11
|
+
public:
|
|
12
|
+
RNGestureHandlerModule(const ArkTSTurboModule::Context ctx, const std::string name);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
} // namespace rnoh
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
|
|
2
|
+
#pragma once
|
|
3
|
+
|
|
4
|
+
// This file was generated.
|
|
5
|
+
|
|
6
|
+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
7
|
+
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
8
|
+
#include <react/renderer/components/view/ViewShadowNode.h>
|
|
9
|
+
|
|
10
|
+
namespace facebook {
|
|
11
|
+
namespace react {
|
|
12
|
+
|
|
13
|
+
extern const char RNGestureHandlerRootViewComponentName[] = "RNGestureHandlerRootView";
|
|
14
|
+
|
|
15
|
+
class RNGestureHandlerRootViewProps : public ViewProps {
|
|
16
|
+
public:
|
|
17
|
+
RNGestureHandlerRootViewProps() = default;
|
|
18
|
+
|
|
19
|
+
RNGestureHandlerRootViewProps(const PropsParserContext &context, const RNGestureHandlerRootViewProps &sourceProps, const RawProps &rawProps)
|
|
20
|
+
: ViewProps(context, sourceProps, rawProps) {}
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
using RNGestureHandlerRootViewShadowNode = ConcreteViewShadowNode<
|
|
24
|
+
RNGestureHandlerRootViewComponentName,
|
|
25
|
+
RNGestureHandlerRootViewProps,
|
|
26
|
+
ViewEventEmitter>;
|
|
27
|
+
|
|
28
|
+
class RNGestureHandlerRootViewComponentDescriptor final
|
|
29
|
+
: public ConcreteComponentDescriptor<RNGestureHandlerRootViewShadowNode> {
|
|
30
|
+
public:
|
|
31
|
+
RNGestureHandlerRootViewComponentDescriptor(ComponentDescriptorParameters const ¶meters)
|
|
32
|
+
: ConcreteComponentDescriptor(parameters) {}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
} // namespace react
|
|
36
|
+
} // namespace facebook
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
// This file was generated.
|
|
4
|
+
|
|
5
|
+
#include "RNOHCorePackage/ComponentBinders/ViewComponentJSIBinder.h"
|
|
6
|
+
|
|
7
|
+
namespace rnoh {
|
|
8
|
+
class RNGestureHandlerRootViewJSIBinder : public ViewComponentJSIBinder {
|
|
9
|
+
protected:
|
|
10
|
+
facebook::jsi::Object createNativeProps(facebook::jsi::Runtime &rt) override {
|
|
11
|
+
auto object = ViewComponentJSIBinder::createNativeProps(rt);
|
|
12
|
+
return object;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
facebook::jsi::Object createDirectEventTypes(facebook::jsi::Runtime &rt) override {
|
|
16
|
+
facebook::jsi::Object events(rt);
|
|
17
|
+
return events;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
facebook::jsi::Object createBubblingEventTypes(facebook::jsi::Runtime &rt) override {
|
|
21
|
+
facebook::jsi::Object events(rt);
|
|
22
|
+
return events;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
} // namespace rnoh
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
#import "RNOH/CppComponentInstance.h"
|
|
3
|
+
#import "RNOH/arkui/StackNode.h"
|
|
4
|
+
#import "../RNGestureHandlerButtonComponentDescriptor.h"
|
|
5
|
+
|
|
6
|
+
namespace rnoh {
|
|
7
|
+
class RNGestureHandlerButtonComponentInstance
|
|
8
|
+
: public CppComponentInstance<facebook::react::RNGestureHandlerButtonShadowNode> {
|
|
9
|
+
private:
|
|
10
|
+
StackNode m_stackNode;
|
|
11
|
+
|
|
12
|
+
public:
|
|
13
|
+
RNGestureHandlerButtonComponentInstance(Context context) : CppComponentInstance(std::move(context)) {};
|
|
14
|
+
|
|
15
|
+
StackNode &getLocalRootArkUINode() override { return m_stackNode; };
|
|
16
|
+
|
|
17
|
+
void onChildInserted(ComponentInstance::Shared const &childComponentInstance, std::size_t index) override {
|
|
18
|
+
CppComponentInstance::onChildInserted(childComponentInstance, index);
|
|
19
|
+
m_stackNode.insertChild(childComponentInstance->getLocalRootArkUINode(), index);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
void onChildRemoved(ComponentInstance::Shared const &childComponentInstance) override {
|
|
23
|
+
CppComponentInstance::onChildRemoved(childComponentInstance);
|
|
24
|
+
m_stackNode.removeChild(childComponentInstance->getLocalRootArkUINode());
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
} // namespace rnoh
|