@react-native-oh-tpl/react-native-gesture-handler 2.14.13 → 2.14.14

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.
Files changed (59) hide show
  1. package/harmony/gesture_handler/BuildProfile.ets +1 -1
  2. package/harmony/gesture_handler/index.ets +1 -2
  3. package/harmony/gesture_handler/oh-package-lock.json5 +1 -1
  4. package/harmony/gesture_handler/oh-package.json5 +1 -1
  5. package/harmony/gesture_handler/src/main/cpp/CMakeLists.txt +1 -1
  6. package/harmony/gesture_handler/src/main/cpp/GestureHandlerPackage.h +9 -18
  7. package/harmony/gesture_handler/src/main/cpp/RnohReactNativeHarmonyGestureHandlerPackage.cpp +123 -0
  8. package/harmony/gesture_handler/src/main/cpp/RnohReactNativeHarmonyGestureHandlerPackage.h +15 -0
  9. package/harmony/gesture_handler/src/main/cpp/componentInstances/RNGestureHandlerButtonComponentInstance.h +17 -17
  10. package/harmony/gesture_handler/src/main/cpp/componentInstances/RNGestureHandlerRootViewComponentInstance.h +203 -200
  11. package/harmony/gesture_handler/src/main/ets/RNOHPackage.ets +17 -0
  12. package/harmony/gesture_handler/src/main/ets/core/GestureHandler.ts +84 -35
  13. package/harmony/gesture_handler/src/main/ets/core/GestureHandlerOrchestrator.ts +20 -11
  14. package/harmony/gesture_handler/src/main/ets/core/GestureHandlerRegistry.ts +2 -2
  15. package/harmony/gesture_handler/src/main/ets/core/InteractionManager.ts +4 -4
  16. package/harmony/gesture_handler/src/main/ets/core/Multiset.ts +26 -0
  17. package/harmony/gesture_handler/src/main/ets/core/RNGHLogger.ts +7 -3
  18. package/harmony/gesture_handler/src/main/ets/core/ViewRegistry.ts +1 -2
  19. package/harmony/gesture_handler/src/main/ets/core/index.ts +2 -2
  20. package/harmony/gesture_handler/src/main/ets/gesture-handlers/FlingGestureHandler.ts +12 -4
  21. package/harmony/gesture_handler/src/main/ets/gesture-handlers/GestureHandlerFactory.ts +8 -5
  22. package/harmony/gesture_handler/src/main/ets/gesture-handlers/LongPressGestureHandler.ts +14 -2
  23. package/harmony/gesture_handler/src/main/ets/gesture-handlers/ManualGestureHandler.ts +9 -1
  24. package/harmony/gesture_handler/src/main/ets/gesture-handlers/NativeViewGestureHandler.ts +13 -4
  25. package/harmony/gesture_handler/src/main/ets/gesture-handlers/PanGestureHandler.ts +31 -12
  26. package/harmony/gesture_handler/src/main/ets/gesture-handlers/PinchGestureHandler.ts +145 -130
  27. package/harmony/gesture_handler/src/main/ets/gesture-handlers/RotationGestureHandler.ts +9 -1
  28. package/harmony/gesture_handler/src/main/ets/gesture-handlers/TapGestureHandler.ts +15 -5
  29. package/harmony/gesture_handler/src/main/ets/rnoh/GestureHandlerPackage.ts +7 -4
  30. package/harmony/gesture_handler/src/main/ets/rnoh/Logger.ts +74 -16
  31. package/harmony/gesture_handler/src/main/ets/rnoh/OutgoingEventDispatchers.ts +35 -12
  32. package/harmony/gesture_handler/src/main/ets/rnoh/RNGHRootViewController.ts +182 -0
  33. package/harmony/gesture_handler/src/main/ets/rnoh/RNGHView.ts +62 -0
  34. package/harmony/gesture_handler/src/main/ets/rnoh/{GestureHandlerArkUIAdapter.ts → RNGHViewController.ts} +44 -22
  35. package/harmony/gesture_handler/src/main/ets/rnoh/RNGHViewRegistry.ts +19 -0
  36. package/harmony/gesture_handler/src/main/ets/rnoh/RNGestureHandlerModule.ts +130 -96
  37. package/harmony/gesture_handler/src/main/ets/rnoh/RNOHGestureResponder.ts +0 -9
  38. package/harmony/gesture_handler/src/main/ets/rnoh/RNOHScrollLocker.ts +1 -8
  39. package/harmony/gesture_handler.har +0 -0
  40. package/package.json +7 -3
  41. package/harmony/gesture_handler/src/main/cpp/GestureHandlerPackage.cpp +0 -149
  42. package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerButtonComponentDescriptor.h +0 -36
  43. package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerButtonJSIBinder.h +0 -32
  44. package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerModule.cpp +0 -22
  45. package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerModule.h +0 -15
  46. package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerRootViewComponentDescriptor.h +0 -36
  47. package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerRootViewJSIBinder.h +0 -25
  48. package/harmony/gesture_handler/src/main/ets/core/ViewFinder.ts +0 -11
  49. package/harmony/gesture_handler/src/main/ets/namespace/RNGestureHandlerModule.ts +0 -24
  50. package/harmony/gesture_handler/src/main/ets/namespace/components/RNGestureHandlerButton.ts +0 -139
  51. package/harmony/gesture_handler/src/main/ets/namespace/components/RNGestureHandlerRootView.ts +0 -101
  52. package/harmony/gesture_handler/src/main/ets/namespace/components/ts.ts +0 -2
  53. package/harmony/gesture_handler/src/main/ets/namespace/ts.ts +0 -2
  54. package/harmony/gesture_handler/src/main/ets/rnoh/RNGHRootTouchHandlerArkTS.ts +0 -98
  55. package/harmony/gesture_handler/src/main/ets/rnoh/RNGHRootTouchHandlerCAPI.ts +0 -110
  56. package/harmony/gesture_handler/src/main/ets/rnoh/RNGestureHandlerButton.ets +0 -38
  57. package/harmony/gesture_handler/src/main/ets/rnoh/RNGestureHandlerRootView.ets +0 -53
  58. package/harmony/gesture_handler/src/main/ets/rnoh/View.ts +0 -134
  59. 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.1-2.14.13';
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';
@@ -1,3 +1,2 @@
1
1
  export * from "./ts"
2
- export * from "./src/main/ets/rnoh/RNGestureHandlerRootView"
3
- export * from "./src/main/ets/rnoh/RNGestureHandlerButton"
2
+ export { default } from "./src/main/ets/RNOHPackage"
@@ -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.28",
13
+ "version": "0.72.35",
14
14
  "resolved": "../react_native_openharmony.har",
15
15
  "registryType": "local"
16
16
  }
@@ -5,7 +5,7 @@
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.13',
8
+ version: '2.14.14',
9
9
  dependencies: {
10
10
  "@rnoh/react-native-openharmony": "file:./react_native_openharmony"
11
11
  },
@@ -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 "RNOH/Package.h"
2
+ #include "RnohReactNativeHarmonyGestureHandlerPackage.h"
3
3
 
4
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
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 "../RNGestureHandlerButtonComponentDescriptor.h"
4
+ #import "generated/RNGestureHandlerButtonComponentDescriptor.h"
5
5
 
6
6
  namespace rnoh {
7
- class RNGestureHandlerButtonComponentInstance
8
- : public CppComponentInstance<facebook::react::RNGestureHandlerButtonShadowNode> {
9
- private:
10
- StackNode m_stackNode;
7
+ class RNGestureHandlerButtonComponentInstance
8
+ : public CppComponentInstance<facebook::react::RNGestureHandlerButtonShadowNode> {
9
+ private:
10
+ StackNode m_stackNode;
11
11
 
12
- public:
13
- RNGestureHandlerButtonComponentInstance(Context context) : CppComponentInstance(std::move(context)) {};
12
+ public:
13
+ RNGestureHandlerButtonComponentInstance(Context context) : CppComponentInstance(std::move(context)){};
14
14
 
15
- StackNode &getLocalRootArkUINode() override { return m_stackNode; };
15
+ StackNode &getLocalRootArkUINode() override { return m_stackNode; };
16
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
- };
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
- void onChildRemoved(ComponentInstance::Shared const &childComponentInstance) override {
23
- CppComponentInstance::onChildRemoved(childComponentInstance);
24
- m_stackNode.removeChild(childComponentInstance->getLocalRootArkUINode());
25
- };
22
+ void onChildRemoved(ComponentInstance::Shared const &childComponentInstance) override {
23
+ CppComponentInstance::onChildRemoved(childComponentInstance);
24
+ m_stackNode.removeChild(childComponentInstance->getLocalRootArkUINode());
26
25
  };
27
- } // namespace rnoh
26
+ };
27
+ } // namespace rnoh