@react-native-oh-tpl/react-native-gesture-handler 2.14.13 → 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 +1 -1
- 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 +123 -0
- package/harmony/gesture_handler/src/main/cpp/RnohReactNativeHarmonyGestureHandlerPackage.h +15 -0
- package/harmony/gesture_handler/src/main/cpp/componentInstances/RNGestureHandlerButtonComponentInstance.h +17 -17
- package/harmony/gesture_handler/src/main/cpp/componentInstances/RNGestureHandlerRootViewComponentInstance.h +203 -200
- package/harmony/gesture_handler/src/main/ets/RNOHPackage.ets +17 -0
- package/harmony/gesture_handler/src/main/ets/core/GestureHandler.ts +84 -35
- package/harmony/gesture_handler/src/main/ets/core/GestureHandlerOrchestrator.ts +20 -11
- package/harmony/gesture_handler/src/main/ets/core/GestureHandlerRegistry.ts +2 -2
- 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 +1 -2
- package/harmony/gesture_handler/src/main/ets/core/index.ts +2 -2
- 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 -96
- 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/cpp/RNGestureHandlerButtonComponentDescriptor.h +0 -36
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerButtonJSIBinder.h +0 -32
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerModule.cpp +0 -22
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerModule.h +0 -15
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerRootViewComponentDescriptor.h +0 -36
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerRootViewJSIBinder.h +0 -25
- package/harmony/gesture_handler/src/main/ets/core/ViewFinder.ts +0 -11
- package/harmony/gesture_handler/src/main/ets/namespace/RNGestureHandlerModule.ts +0 -24
- package/harmony/gesture_handler/src/main/ets/namespace/components/RNGestureHandlerButton.ts +0 -139
- package/harmony/gesture_handler/src/main/ets/namespace/components/RNGestureHandlerRootView.ts +0 -101
- package/harmony/gesture_handler/src/main/ets/namespace/components/ts.ts +0 -2
- package/harmony/gesture_handler/src/main/ets/namespace/ts.ts +0 -2
- package/harmony/gesture_handler/src/main/ets/rnoh/RNGHRootTouchHandlerArkTS.ts +0 -98
- 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 -97
@@ -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.
|
4
|
+
export const HAR_VERSION = '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
|
}
|
@@ -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,123 @@
|
|
1
|
+
#pragma once
|
2
|
+
#include "RnohReactNativeHarmonyGestureHandlerPackage.h"
|
3
|
+
#include "RNOH/RNInstanceCAPI.h"
|
4
|
+
#include "componentInstances/RNGestureHandlerButtonComponentInstance.h"
|
5
|
+
#include "componentInstances/RNGestureHandlerRootViewComponentInstance.h"
|
6
|
+
#include <glog/logging.h>
|
7
|
+
#include <react/renderer/debug/SystraceSection.h>
|
8
|
+
|
9
|
+
using namespace rnoh;
|
10
|
+
using namespace facebook;
|
11
|
+
|
12
|
+
class RNGHEventEmitRequestHandler : public EventEmitRequestHandler {
|
13
|
+
void handleEvent(EventEmitRequestHandler::Context const &ctx) override {
|
14
|
+
facebook::react::SystraceSection s("RNGH::RNGHEventEmitRequestHandler::handleEvent");
|
15
|
+
auto eventEmitter = ctx.shadowViewRegistry->getEventEmitter<facebook::react::ViewEventEmitter>(ctx.tag);
|
16
|
+
if (eventEmitter == nullptr) {
|
17
|
+
return;
|
18
|
+
}
|
19
|
+
if (ctx.eventName == "onGestureHandlerEvent") {
|
20
|
+
eventEmitter->dispatchUniqueEvent(ctx.eventName, ArkJS(ctx.env).getDynamic(ctx.payload));
|
21
|
+
} else if (ctx.eventName == "onGestureHandlerStateChange") {
|
22
|
+
eventEmitter->dispatchEvent("onGestureHandlerStateChange", ArkJS(ctx.env).getDynamic(ctx.payload));
|
23
|
+
}
|
24
|
+
}
|
25
|
+
};
|
26
|
+
|
27
|
+
class RNOHCorePackageComponentInstanceFactoryDelegate : public ComponentInstanceFactoryDelegate {
|
28
|
+
public:
|
29
|
+
using ComponentInstanceFactoryDelegate::ComponentInstanceFactoryDelegate;
|
30
|
+
|
31
|
+
ComponentInstance::Shared create(ComponentInstance::Context ctx) override {
|
32
|
+
if (ctx.componentName == "RNGestureHandlerButton") {
|
33
|
+
return std::make_shared<RNGestureHandlerButtonComponentInstance>(ctx);
|
34
|
+
} else if (ctx.componentName == "RNGestureHandlerRootView") {
|
35
|
+
return std::make_shared<RNGestureHandlerRootViewComponentInstance>(ctx);
|
36
|
+
}
|
37
|
+
return nullptr;
|
38
|
+
}
|
39
|
+
};
|
40
|
+
|
41
|
+
|
42
|
+
EventEmitRequestHandlers RnohReactNativeHarmonyGestureHandlerPackage::createEventEmitRequestHandlers() {
|
43
|
+
return {
|
44
|
+
std::make_shared<RNGHEventEmitRequestHandler>(),
|
45
|
+
};
|
46
|
+
}
|
47
|
+
|
48
|
+
ComponentInstanceFactoryDelegate::Shared
|
49
|
+
RnohReactNativeHarmonyGestureHandlerPackage::createComponentInstanceFactoryDelegate() {
|
50
|
+
return std::make_shared<RNOHCorePackageComponentInstanceFactoryDelegate>();
|
51
|
+
}
|
52
|
+
|
53
|
+
class ScrollLockerArkTSMessageHandler : public ArkTSMessageHandler {
|
54
|
+
public:
|
55
|
+
void handleArkTSMessage(const Context &ctx) override {
|
56
|
+
facebook::react::SystraceSection s("RNGH::ScrollLockerArkTSMessageHandler::handleArkTSMessage");
|
57
|
+
if (ctx.messageName == "RNGH::SET_NATIVE_RESPONDERS_BLOCK") {
|
58
|
+
auto targetComponentInstanceTag = ctx.messagePayload["targetTag"].asDouble();
|
59
|
+
auto shouldBlock = ctx.messagePayload["shouldBlock"].asBool();
|
60
|
+
auto rnInstance = ctx.rnInstance.lock();
|
61
|
+
if (rnInstance != nullptr) {
|
62
|
+
auto rnInstanceCAPI = std::dynamic_pointer_cast<RNInstanceCAPI>(rnInstance);
|
63
|
+
if (rnInstanceCAPI != nullptr) {
|
64
|
+
|
65
|
+
std::vector<ComponentInstance::Shared> ancestors;
|
66
|
+
auto tmpComponentInstance = rnInstanceCAPI->findComponentInstanceByTag(targetComponentInstanceTag);
|
67
|
+
while (tmpComponentInstance != nullptr) {
|
68
|
+
ancestors.push_back(tmpComponentInstance);
|
69
|
+
tmpComponentInstance = tmpComponentInstance->getParent().lock();
|
70
|
+
}
|
71
|
+
if (ancestors.size() == 0) {
|
72
|
+
return;
|
73
|
+
}
|
74
|
+
/**
|
75
|
+
* Ensure consistent behavior with Android by not blocking
|
76
|
+
* scrolls above the GestureHandlerRootView handling the
|
77
|
+
* touch. If there are multiple nested
|
78
|
+
* GestureHandlerRootViews, the one nearest to the actual
|
79
|
+
* root will handle the touch.
|
80
|
+
*/
|
81
|
+
auto isChangingResponderStatusAllowed = false;
|
82
|
+
for (size_t i = ancestors.size() - 1; i > 0; i--) {
|
83
|
+
auto ancestor = ancestors[i];
|
84
|
+
if (!isChangingResponderStatusAllowed) {
|
85
|
+
auto rootView =
|
86
|
+
std::dynamic_pointer_cast<RNGestureHandlerRootViewComponentInstance>(ancestor);
|
87
|
+
if (rootView != nullptr) {
|
88
|
+
isChangingResponderStatusAllowed = true;
|
89
|
+
}
|
90
|
+
} else {
|
91
|
+
ancestor->setNativeResponderBlocked(shouldBlock, "RNGH");
|
92
|
+
}
|
93
|
+
}
|
94
|
+
}
|
95
|
+
}
|
96
|
+
} else if (ctx.messageName == "RNGH::ROOT_VIEW_IS_HANDLING_TOUCHES") {
|
97
|
+
auto descendantViewTag = ctx.messagePayload["descendantViewTag"].asDouble();
|
98
|
+
auto isHandlingTouches = ctx.messagePayload["isHandlingTouches"].asBool();
|
99
|
+
auto rnInstance = ctx.rnInstance.lock();
|
100
|
+
if (rnInstance != nullptr) {
|
101
|
+
auto rnInstanceCAPI = std::dynamic_pointer_cast<RNInstanceCAPI>(rnInstance);
|
102
|
+
if (rnInstanceCAPI != nullptr) {
|
103
|
+
auto tmpComponentInstance = rnInstanceCAPI->findComponentInstanceByTag(descendantViewTag);
|
104
|
+
while (tmpComponentInstance != nullptr) {
|
105
|
+
tmpComponentInstance = tmpComponentInstance->getParent().lock();
|
106
|
+
if (tmpComponentInstance) {
|
107
|
+
auto rnghRootViewComponentInstance =
|
108
|
+
std::dynamic_pointer_cast<RNGestureHandlerRootViewComponentInstance>(
|
109
|
+
tmpComponentInstance);
|
110
|
+
if (rnghRootViewComponentInstance) {
|
111
|
+
rnghRootViewComponentInstance->setIsHandlingTouches(isHandlingTouches);
|
112
|
+
}
|
113
|
+
}
|
114
|
+
}
|
115
|
+
}
|
116
|
+
}
|
117
|
+
}
|
118
|
+
};
|
119
|
+
};
|
120
|
+
|
121
|
+
std::vector<ArkTSMessageHandler::Shared> RnohReactNativeHarmonyGestureHandlerPackage::createArkTSMessageHandlers() {
|
122
|
+
return {std::make_shared<ScrollLockerArkTSMessageHandler>()};
|
123
|
+
}
|
@@ -0,0 +1,15 @@
|
|
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
|
+
EventEmitRequestHandlers createEventEmitRequestHandlers();
|
10
|
+
|
11
|
+
ComponentInstanceFactoryDelegate::Shared createComponentInstanceFactoryDelegate();
|
12
|
+
|
13
|
+
std::vector<ArkTSMessageHandler::Shared> createArkTSMessageHandlers() override;
|
14
|
+
};
|
15
|
+
} // namespace rnoh
|
@@ -1,27 +1,27 @@
|
|
1
1
|
#pragma once
|
2
2
|
#import "RNOH/CppComponentInstance.h"
|
3
3
|
#import "RNOH/arkui/StackNode.h"
|
4
|
-
#import "
|
4
|
+
#import "generated/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
|