@react-native-oh-tpl/react-native-gesture-handler 2.14.1-2.14.12 → 2.14.1-2.14.14
Sign up to get free protection for your applications and to get access to all the features.
- package/harmony/gesture_handler/BuildProfile.ets +1 -1
- package/harmony/gesture_handler/index.ets +1 -2
- package/harmony/gesture_handler/oh-package-lock.json5 +1 -1
- package/harmony/gesture_handler/oh-package.json5 +3 -3
- package/harmony/gesture_handler/src/main/cpp/CMakeLists.txt +1 -1
- package/harmony/gesture_handler/src/main/cpp/GestureHandlerPackage.h +9 -18
- package/harmony/gesture_handler/src/main/cpp/RnohReactNativeHarmonyGestureHandlerPackage.cpp +157 -0
- package/harmony/gesture_handler/src/main/cpp/RnohReactNativeHarmonyGestureHandlerPackage.h +21 -0
- package/harmony/gesture_handler/src/main/cpp/componentInstances/RNGestureHandlerButtonComponentInstance.h +16 -16
- package/harmony/gesture_handler/src/main/cpp/componentInstances/RNGestureHandlerRootViewComponentInstance.h +202 -199
- package/harmony/gesture_handler/src/main/ets/RNOHPackage.ets +17 -0
- package/harmony/gesture_handler/src/main/ets/core/GestureHandler.ts +92 -37
- package/harmony/gesture_handler/src/main/ets/core/GestureHandlerOrchestrator.ts +20 -11
- package/harmony/gesture_handler/src/main/ets/core/GestureHandlerRegistry.ts +31 -3
- package/harmony/gesture_handler/src/main/ets/core/InteractionManager.ts +4 -4
- package/harmony/gesture_handler/src/main/ets/core/Multiset.ts +26 -0
- package/harmony/gesture_handler/src/main/ets/core/RNGHLogger.ts +7 -3
- package/harmony/gesture_handler/src/main/ets/core/ViewRegistry.ts +7 -0
- package/harmony/gesture_handler/src/main/ets/core/index.ts +3 -1
- package/harmony/gesture_handler/src/main/ets/gesture-handlers/FlingGestureHandler.ts +12 -4
- package/harmony/gesture_handler/src/main/ets/gesture-handlers/GestureHandlerFactory.ts +8 -5
- package/harmony/gesture_handler/src/main/ets/gesture-handlers/LongPressGestureHandler.ts +14 -2
- package/harmony/gesture_handler/src/main/ets/gesture-handlers/ManualGestureHandler.ts +9 -1
- package/harmony/gesture_handler/src/main/ets/gesture-handlers/NativeViewGestureHandler.ts +13 -4
- package/harmony/gesture_handler/src/main/ets/gesture-handlers/PanGestureHandler.ts +31 -12
- package/harmony/gesture_handler/src/main/ets/gesture-handlers/PinchGestureHandler.ts +145 -130
- package/harmony/gesture_handler/src/main/ets/gesture-handlers/RotationGestureHandler.ts +9 -1
- package/harmony/gesture_handler/src/main/ets/gesture-handlers/TapGestureHandler.ts +15 -5
- package/harmony/gesture_handler/src/main/ets/rnoh/GestureHandlerPackage.ts +7 -4
- package/harmony/gesture_handler/src/main/ets/rnoh/Logger.ts +74 -16
- package/harmony/gesture_handler/src/main/ets/rnoh/OutgoingEventDispatchers.ts +35 -12
- package/harmony/gesture_handler/src/main/ets/rnoh/RNGHRootViewController.ts +182 -0
- package/harmony/gesture_handler/src/main/ets/rnoh/RNGHView.ts +62 -0
- package/harmony/gesture_handler/src/main/ets/rnoh/{GestureHandlerArkUIAdapter.ts → RNGHViewController.ts} +44 -22
- package/harmony/gesture_handler/src/main/ets/rnoh/RNGHViewRegistry.ts +19 -0
- package/harmony/gesture_handler/src/main/ets/rnoh/RNGestureHandlerModule.ts +130 -95
- package/harmony/gesture_handler/src/main/ets/rnoh/RNOHGestureResponder.ts +0 -9
- package/harmony/gesture_handler/src/main/ets/rnoh/RNOHScrollLocker.ts +1 -8
- package/harmony/gesture_handler.har +0 -0
- package/package.json +7 -3
- package/harmony/gesture_handler/src/main/cpp/GestureHandlerPackage.cpp +0 -149
- package/harmony/gesture_handler/src/main/ets/rnoh/RNGHRootTouchHandlerArkTS.ts +0 -108
- package/harmony/gesture_handler/src/main/ets/rnoh/RNGHRootTouchHandlerCAPI.ts +0 -110
- package/harmony/gesture_handler/src/main/ets/rnoh/RNGestureHandlerButton.ets +0 -38
- package/harmony/gesture_handler/src/main/ets/rnoh/RNGestureHandlerRootView.ets +0 -53
- package/harmony/gesture_handler/src/main/ets/rnoh/View.ts +0 -134
- package/harmony/gesture_handler/src/main/ets/rnoh/ViewRegistry.ts +0 -95
@@ -1,7 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* Use these variables when you tailor your ArkTS code. They must be of the const type.
|
3
3
|
*/
|
4
|
-
export const HAR_VERSION = '2.14.1-2.14.
|
4
|
+
export const HAR_VERSION = '2.14.1-2.14.14';
|
5
5
|
export const BUILD_MODE_NAME = 'release';
|
6
6
|
export const DEBUG = false;
|
7
7
|
export const TARGET_NAME = 'default';
|
@@ -10,7 +10,7 @@
|
|
10
10
|
"packages": {
|
11
11
|
"@rnoh/react-native-openharmony@../react_native_openharmony.har": {
|
12
12
|
"name": "@rnoh/react-native-openharmony",
|
13
|
-
"version": "0.72.
|
13
|
+
"version": "0.72.35",
|
14
14
|
"resolved": "../react_native_openharmony.har",
|
15
15
|
"registryType": "local"
|
16
16
|
}
|
@@ -5,8 +5,8 @@
|
|
5
5
|
name: '@react-native-oh-tpl/react-native-gesture-handler',
|
6
6
|
description: '',
|
7
7
|
type: 'module',
|
8
|
-
version: '2.14.1-2.14.
|
8
|
+
version: '2.14.1-2.14.14',
|
9
9
|
dependencies: {
|
10
|
-
"@rnoh/react-native-openharmony": "file
|
11
|
-
}
|
10
|
+
"@rnoh/react-native-openharmony": "file:./react_native_openharmony"
|
11
|
+
},
|
12
12
|
}
|
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.13)
|
|
2
2
|
set(CMAKE_VERBOSE_MAKEFILE on)
|
3
3
|
|
4
4
|
file(GLOB rnoh_gesture_handler_SRC CONFIGURE_DEPENDS *.cpp)
|
5
|
+
|
5
6
|
add_library(rnoh_gesture_handler SHARED ${rnoh_gesture_handler_SRC})
|
6
7
|
target_include_directories(rnoh_gesture_handler PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
7
8
|
target_link_libraries(rnoh_gesture_handler PUBLIC rnoh)
|
8
|
-
|
@@ -1,21 +1,12 @@
|
|
1
1
|
#pragma once
|
2
|
-
#include "
|
2
|
+
#include "RnohReactNativeHarmonyGestureHandlerPackage.h"
|
3
3
|
|
4
4
|
namespace rnoh {
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
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
|
5
|
+
/**
|
6
|
+
* @deprecated: Use RnohReactNativeHarmonyGestureHandlerPackage instead (2024-10-10)
|
7
|
+
*/
|
8
|
+
class GestureHandlerPackage : public RnohReactNativeHarmonyGestureHandlerPackage {
|
9
|
+
using Super = RnohReactNativeHarmonyGestureHandlerPackage;
|
10
|
+
using Super::Super;
|
11
|
+
};
|
12
|
+
} // namespace rnoh
|
@@ -0,0 +1,157 @@
|
|
1
|
+
#pragma once
|
2
|
+
#include "RnohReactNativeHarmonyGestureHandlerPackage.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
|
+
#include <react/renderer/debug/SystraceSection.h>
|
14
|
+
|
15
|
+
using namespace rnoh;
|
16
|
+
using namespace facebook;
|
17
|
+
|
18
|
+
class GestureHandlerTurboModuleFactoryDelegate : public TurboModuleFactoryDelegate {
|
19
|
+
public:
|
20
|
+
SharedTurboModule createTurboModule(Context ctx, const std::string &name) const override {
|
21
|
+
if (name == "RNGestureHandlerModule") {
|
22
|
+
return std::make_shared<RNGestureHandlerModule>(ctx, name);
|
23
|
+
}
|
24
|
+
return nullptr;
|
25
|
+
};
|
26
|
+
};
|
27
|
+
|
28
|
+
|
29
|
+
class RNGHEventEmitRequestHandler : public EventEmitRequestHandler {
|
30
|
+
void handleEvent(EventEmitRequestHandler::Context const &ctx) override {
|
31
|
+
facebook::react::SystraceSection s("RNGH::RNGHEventEmitRequestHandler::handleEvent");
|
32
|
+
auto eventEmitter = ctx.shadowViewRegistry->getEventEmitter<facebook::react::ViewEventEmitter>(ctx.tag);
|
33
|
+
if (eventEmitter == nullptr) {
|
34
|
+
return;
|
35
|
+
}
|
36
|
+
if (ctx.eventName == "onGestureHandlerEvent") {
|
37
|
+
eventEmitter->dispatchUniqueEvent(ctx.eventName, ArkJS(ctx.env).getDynamic(ctx.payload));
|
38
|
+
} else if (ctx.eventName == "onGestureHandlerStateChange") {
|
39
|
+
eventEmitter->dispatchEvent("onGestureHandlerStateChange", ArkJS(ctx.env).getDynamic(ctx.payload));
|
40
|
+
}
|
41
|
+
}
|
42
|
+
};
|
43
|
+
|
44
|
+
class RNOHCorePackageComponentInstanceFactoryDelegate : public ComponentInstanceFactoryDelegate {
|
45
|
+
public:
|
46
|
+
using ComponentInstanceFactoryDelegate::ComponentInstanceFactoryDelegate;
|
47
|
+
|
48
|
+
ComponentInstance::Shared create(ComponentInstance::Context ctx) override {
|
49
|
+
if (ctx.componentName == "RNGestureHandlerButton") {
|
50
|
+
return std::make_shared<RNGestureHandlerButtonComponentInstance>(ctx);
|
51
|
+
} else if (ctx.componentName == "RNGestureHandlerRootView") {
|
52
|
+
return std::make_shared<RNGestureHandlerRootViewComponentInstance>(ctx);
|
53
|
+
}
|
54
|
+
return nullptr;
|
55
|
+
}
|
56
|
+
};
|
57
|
+
|
58
|
+
std::unique_ptr<TurboModuleFactoryDelegate> RnohReactNativeHarmonyGestureHandlerPackage::createTurboModuleFactoryDelegate() {
|
59
|
+
return std::make_unique<GestureHandlerTurboModuleFactoryDelegate>();
|
60
|
+
}
|
61
|
+
|
62
|
+
std::vector<react::ComponentDescriptorProvider> RnohReactNativeHarmonyGestureHandlerPackage::createComponentDescriptorProviders() {
|
63
|
+
return {
|
64
|
+
react::concreteComponentDescriptorProvider<react::RNGestureHandlerRootViewComponentDescriptor>(),
|
65
|
+
react::concreteComponentDescriptorProvider<react::RNGestureHandlerButtonComponentDescriptor>(),
|
66
|
+
};
|
67
|
+
}
|
68
|
+
|
69
|
+
ComponentJSIBinderByString RnohReactNativeHarmonyGestureHandlerPackage::createComponentJSIBinderByName() {
|
70
|
+
return {
|
71
|
+
{"RNGestureHandlerButton", std::make_shared<RNGestureHandlerButtonJSIBinder>()},
|
72
|
+
{"RNGestureHandlerRootView", std::make_shared<RNGestureHandlerRootViewJSIBinder>()},
|
73
|
+
};
|
74
|
+
};
|
75
|
+
|
76
|
+
EventEmitRequestHandlers RnohReactNativeHarmonyGestureHandlerPackage::createEventEmitRequestHandlers() {
|
77
|
+
return {
|
78
|
+
std::make_shared<RNGHEventEmitRequestHandler>(),
|
79
|
+
};
|
80
|
+
}
|
81
|
+
|
82
|
+
ComponentInstanceFactoryDelegate::Shared
|
83
|
+
RnohReactNativeHarmonyGestureHandlerPackage::createComponentInstanceFactoryDelegate() {
|
84
|
+
return std::make_shared<RNOHCorePackageComponentInstanceFactoryDelegate>();
|
85
|
+
}
|
86
|
+
|
87
|
+
class ScrollLockerArkTSMessageHandler : public ArkTSMessageHandler {
|
88
|
+
public:
|
89
|
+
void handleArkTSMessage(const Context &ctx) override {
|
90
|
+
facebook::react::SystraceSection s("RNGH::ScrollLockerArkTSMessageHandler::handleArkTSMessage");
|
91
|
+
if (ctx.messageName == "RNGH::SET_NATIVE_RESPONDERS_BLOCK") {
|
92
|
+
auto targetComponentInstanceTag = ctx.messagePayload["targetTag"].asDouble();
|
93
|
+
auto shouldBlock = ctx.messagePayload["shouldBlock"].asBool();
|
94
|
+
auto rnInstance = ctx.rnInstance.lock();
|
95
|
+
if (rnInstance != nullptr) {
|
96
|
+
auto rnInstanceCAPI = std::dynamic_pointer_cast<RNInstanceCAPI>(rnInstance);
|
97
|
+
if (rnInstanceCAPI != nullptr) {
|
98
|
+
|
99
|
+
std::vector<ComponentInstance::Shared> ancestors;
|
100
|
+
auto tmpComponentInstance = rnInstanceCAPI->findComponentInstanceByTag(targetComponentInstanceTag);
|
101
|
+
while (tmpComponentInstance != nullptr) {
|
102
|
+
ancestors.push_back(tmpComponentInstance);
|
103
|
+
tmpComponentInstance = tmpComponentInstance->getParent().lock();
|
104
|
+
}
|
105
|
+
if (ancestors.size() == 0) {
|
106
|
+
return;
|
107
|
+
}
|
108
|
+
/**
|
109
|
+
* Ensure consistent behavior with Android by not blocking
|
110
|
+
* scrolls above the GestureHandlerRootView handling the
|
111
|
+
* touch. If there are multiple nested
|
112
|
+
* GestureHandlerRootViews, the one nearest to the actual
|
113
|
+
* root will handle the touch.
|
114
|
+
*/
|
115
|
+
auto isChangingResponderStatusAllowed = false;
|
116
|
+
for (size_t i = ancestors.size() - 1; i > 0; i--) {
|
117
|
+
auto ancestor = ancestors[i];
|
118
|
+
if (!isChangingResponderStatusAllowed) {
|
119
|
+
auto rootView =
|
120
|
+
std::dynamic_pointer_cast<RNGestureHandlerRootViewComponentInstance>(ancestor);
|
121
|
+
if (rootView != nullptr) {
|
122
|
+
isChangingResponderStatusAllowed = true;
|
123
|
+
}
|
124
|
+
} else {
|
125
|
+
ancestor->setNativeResponderBlocked(shouldBlock, "RNGH");
|
126
|
+
}
|
127
|
+
}
|
128
|
+
}
|
129
|
+
}
|
130
|
+
} else if (ctx.messageName == "RNGH::ROOT_VIEW_IS_HANDLING_TOUCHES") {
|
131
|
+
auto descendantViewTag = ctx.messagePayload["descendantViewTag"].asDouble();
|
132
|
+
auto isHandlingTouches = ctx.messagePayload["isHandlingTouches"].asBool();
|
133
|
+
auto rnInstance = ctx.rnInstance.lock();
|
134
|
+
if (rnInstance != nullptr) {
|
135
|
+
auto rnInstanceCAPI = std::dynamic_pointer_cast<RNInstanceCAPI>(rnInstance);
|
136
|
+
if (rnInstanceCAPI != nullptr) {
|
137
|
+
auto tmpComponentInstance = rnInstanceCAPI->findComponentInstanceByTag(descendantViewTag);
|
138
|
+
while (tmpComponentInstance != nullptr) {
|
139
|
+
tmpComponentInstance = tmpComponentInstance->getParent().lock();
|
140
|
+
if (tmpComponentInstance) {
|
141
|
+
auto rnghRootViewComponentInstance =
|
142
|
+
std::dynamic_pointer_cast<RNGestureHandlerRootViewComponentInstance>(
|
143
|
+
tmpComponentInstance);
|
144
|
+
if (rnghRootViewComponentInstance) {
|
145
|
+
rnghRootViewComponentInstance->setIsHandlingTouches(isHandlingTouches);
|
146
|
+
}
|
147
|
+
}
|
148
|
+
}
|
149
|
+
}
|
150
|
+
}
|
151
|
+
}
|
152
|
+
};
|
153
|
+
};
|
154
|
+
|
155
|
+
std::vector<ArkTSMessageHandler::Shared> RnohReactNativeHarmonyGestureHandlerPackage::createArkTSMessageHandlers() {
|
156
|
+
return {std::make_shared<ScrollLockerArkTSMessageHandler>()};
|
157
|
+
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
#pragma once
|
2
|
+
#include "RNOH/Package.h"
|
3
|
+
|
4
|
+
namespace rnoh {
|
5
|
+
class RnohReactNativeHarmonyGestureHandlerPackage : public Package {
|
6
|
+
public:
|
7
|
+
RnohReactNativeHarmonyGestureHandlerPackage(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
|
@@ -4,24 +4,24 @@
|
|
4
4
|
#import "../RNGestureHandlerButtonComponentDescriptor.h"
|
5
5
|
|
6
6
|
namespace rnoh {
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
class RNGestureHandlerButtonComponentInstance
|
8
|
+
: public CppComponentInstance<facebook::react::RNGestureHandlerButtonShadowNode> {
|
9
|
+
private:
|
10
|
+
StackNode m_stackNode;
|
11
11
|
|
12
|
-
|
13
|
-
|
12
|
+
public:
|
13
|
+
RNGestureHandlerButtonComponentInstance(Context context) : CppComponentInstance(std::move(context)){};
|
14
14
|
|
15
|
-
|
15
|
+
StackNode &getLocalRootArkUINode() override { return m_stackNode; };
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
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
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
};
|
22
|
+
void onChildRemoved(ComponentInstance::Shared const &childComponentInstance) override {
|
23
|
+
CppComponentInstance::onChildRemoved(childComponentInstance);
|
24
|
+
m_stackNode.removeChild(childComponentInstance->getLocalRootArkUINode());
|
26
25
|
};
|
27
|
-
}
|
26
|
+
};
|
27
|
+
} // namespace rnoh
|