@react-native-oh-tpl/react-native-gesture-handler 2.12.6-2 → 2.12.9

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 (192) hide show
  1. package/harmony/gesture_handler/BuildProfile.ets +5 -0
  2. package/harmony/gesture_handler/build-profile.json5 +13 -2
  3. package/harmony/gesture_handler/hvigorfile.ts +1 -1
  4. package/harmony/gesture_handler/index.ets +1 -1
  5. package/harmony/gesture_handler/oh-package-lock.json5 +17 -0
  6. package/harmony/gesture_handler/oh-package.json5 +10 -11
  7. package/harmony/gesture_handler/src/main/cpp/GestureHandlerPackage.cpp +75 -6
  8. package/harmony/gesture_handler/src/main/cpp/GestureHandlerPackage.h +14 -8
  9. package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerButtonComponentDescriptor.h +4 -28
  10. package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerButtonComponentInstance.h +27 -0
  11. package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerButtonJSIBinder.h +32 -0
  12. package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerModule.cpp +17 -12
  13. package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerModule.h +5 -2
  14. package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerPackage.h +72 -0
  15. package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerRootViewComponentDescriptor.h +4 -28
  16. package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerRootViewComponentInstance.h +78 -0
  17. package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerRootViewJSIBinder.h +25 -0
  18. package/harmony/gesture_handler/src/main/ets/EventDispatcher.ts +16 -1
  19. package/harmony/gesture_handler/src/main/ets/GestureHandler.ts +2 -2
  20. package/harmony/gesture_handler/src/main/ets/{GestureHandlerArkUIAdapter.ets → GestureHandlerArkUIAdapter.ts} +2 -1
  21. package/harmony/gesture_handler/src/main/ets/GestureHandlerPackage.ts +2 -2
  22. package/harmony/gesture_handler/src/main/ets/OutgoingEvent.ts +5 -5
  23. package/harmony/gesture_handler/src/main/ets/RNGHLogger.ts +20 -1
  24. package/harmony/gesture_handler/src/main/ets/{RNGHRootTouchHandler.ets → RNGHRootTouchHandlerArkTS.ts} +5 -3
  25. package/harmony/gesture_handler/src/main/ets/RNGHRootTouchHandlerCAPI.ts +87 -0
  26. package/harmony/gesture_handler/src/main/ets/RNGestureHandlerButton.ets +4 -3
  27. package/harmony/gesture_handler/src/main/ets/RNGestureHandlerModule.ts +65 -7
  28. package/harmony/gesture_handler/src/main/ets/RNGestureHandlerRootView.ets +7 -11
  29. package/harmony/gesture_handler/src/main/ets/RNOHScrollLocker.ts +17 -5
  30. package/harmony/gesture_handler/src/main/ets/View.ts +1 -1
  31. package/harmony/gesture_handler/src/main/ets/ViewRegistry.ts +1 -1
  32. package/harmony/gesture_handler/src/main/ets/namespace/RNGestureHandlerButton.ts +140 -0
  33. package/harmony/gesture_handler/src/main/ets/namespace/RNGestureHandlerModule.ts +25 -0
  34. package/harmony/gesture_handler/src/main/ets/namespace/RNGestureHandlerRootView.ts +101 -0
  35. package/harmony/gesture_handler/src/main/ets/namespace/ts.ts +3 -0
  36. package/harmony/gesture_handler/src/main/ets/types.ts +25 -0
  37. package/harmony/gesture_handler/src/main/module.json5 +6 -6
  38. package/harmony/gesture_handler/ts.ts +2 -1
  39. package/harmony/gesture_handler.har +0 -0
  40. package/lib/commonjs/RNGestureHandlerModule.js +6 -3
  41. package/lib/commonjs/RNGestureHandlerModule.js.map +1 -1
  42. package/lib/commonjs/components/GestureHandlerRootView.js +5 -13
  43. package/lib/commonjs/components/GestureHandlerRootView.js.map +1 -1
  44. package/lib/commonjs/handlers/createHandler.js +31 -28
  45. package/lib/commonjs/handlers/createHandler.js.map +1 -1
  46. package/lib/commonjs/index.js +42 -19
  47. package/lib/commonjs/index.js.map +1 -1
  48. package/lib/commonjs/specs/NativeRNGestureHandlerModule.js +10 -0
  49. package/lib/commonjs/specs/NativeRNGestureHandlerModule.js.map +1 -0
  50. package/lib/commonjs/specs/RNGestureHandlerButtonNativeComponent.js +11 -0
  51. package/lib/commonjs/specs/RNGestureHandlerButtonNativeComponent.js.map +1 -0
  52. package/lib/commonjs/specs/RNGestureHandlerRootViewNativeComponent.js +11 -0
  53. package/lib/commonjs/specs/RNGestureHandlerRootViewNativeComponent.js.map +1 -0
  54. package/lib/module/RNGestureHandlerModule.js +3 -2
  55. package/lib/module/RNGestureHandlerModule.js.map +1 -1
  56. package/lib/module/components/GestureHandlerRootView.js +3 -11
  57. package/lib/module/components/GestureHandlerRootView.js.map +1 -1
  58. package/lib/module/handlers/createHandler.js +20 -19
  59. package/lib/module/handlers/createHandler.js.map +1 -1
  60. package/lib/module/index.js +6 -14
  61. package/lib/module/index.js.map +1 -1
  62. package/lib/module/specs/NativeRNGestureHandlerModule.js +3 -0
  63. package/lib/module/specs/NativeRNGestureHandlerModule.js.map +1 -0
  64. package/lib/module/specs/RNGestureHandlerButtonNativeComponent.js +3 -0
  65. package/lib/module/specs/RNGestureHandlerButtonNativeComponent.js.map +1 -0
  66. package/lib/module/specs/RNGestureHandlerRootViewNativeComponent.js +3 -0
  67. package/lib/module/specs/RNGestureHandlerRootViewNativeComponent.js.map +1 -0
  68. package/lib/typescript/RNGestureHandlerModule.d.ts +2 -6
  69. package/lib/typescript/RNGestureHandlerModule.d.ts.map +1 -1
  70. package/lib/typescript/components/GestureHandlerRootView.d.ts +6 -6
  71. package/lib/typescript/components/GestureHandlerRootView.d.ts.map +1 -1
  72. package/lib/typescript/handlers/createHandler.d.ts +11 -11
  73. package/lib/typescript/handlers/createHandler.d.ts.map +1 -1
  74. package/lib/typescript/index.d.ts +9 -8
  75. package/lib/typescript/index.d.ts.map +1 -1
  76. package/lib/typescript/specs/NativeRNGestureHandlerModule.d.ts +15 -0
  77. package/lib/typescript/specs/NativeRNGestureHandlerModule.d.ts.map +1 -0
  78. package/lib/typescript/specs/RNGestureHandlerButtonNativeComponent.d.ts +15 -0
  79. package/lib/typescript/specs/RNGestureHandlerButtonNativeComponent.d.ts.map +1 -0
  80. package/lib/typescript/specs/RNGestureHandlerRootViewNativeComponent.d.ts +7 -0
  81. package/lib/typescript/specs/RNGestureHandlerRootViewNativeComponent.d.ts.map +1 -0
  82. package/package.json +9 -13
  83. package/src/RNGestureHandlerModule.ts +3 -4
  84. package/src/components/GestureHandlerRootView.tsx +4 -15
  85. package/src/handlers/createHandler.tsx +4 -5
  86. package/src/index.ts +13 -13
  87. package/src/specs/NativeRNGestureHandlerModule.ts +26 -0
  88. package/src/specs/RNGestureHandlerButtonNativeComponent.ts +18 -0
  89. package/src/specs/RNGestureHandlerRootViewNativeComponent.ts +6 -0
  90. package/README.md +0 -1
  91. package/harmony/gesture_handler/LICENSE +0 -21
  92. package/harmony/gesture_handler/OAT.xml +0 -44
  93. package/harmony/gesture_handler/README.OpenSource +0 -11
  94. package/harmony/gesture_handler/README.md +0 -1
  95. package/lib/commonjs/components/GestureButtons.js +0 -186
  96. package/lib/commonjs/components/GestureButtons.js.map +0 -1
  97. package/lib/commonjs/components/GestureHandlerButton.js +0 -9
  98. package/lib/commonjs/components/GestureHandlerButton.js.map +0 -1
  99. package/lib/commonjs/components/RNGestureHandlerButton.js +0 -23
  100. package/lib/commonjs/components/RNGestureHandlerButton.js.map +0 -1
  101. package/lib/commonjs/components/touchables/GenericTouchable.js +0 -247
  102. package/lib/commonjs/components/touchables/GenericTouchable.js.map +0 -1
  103. package/lib/commonjs/components/touchables/TouchableOpacity.js +0 -58
  104. package/lib/commonjs/components/touchables/TouchableOpacity.js.map +0 -1
  105. package/lib/commonjs/components/touchables/TouchableWithoutFeedback.js +0 -18
  106. package/lib/commonjs/components/touchables/TouchableWithoutFeedback.js.map +0 -1
  107. package/lib/commonjs/components/touchables/index.js +0 -21
  108. package/lib/commonjs/components/touchables/index.js.map +0 -1
  109. package/lib/commonjs/handlers/NativeViewGestureHandler.js +0 -19
  110. package/lib/commonjs/handlers/NativeViewGestureHandler.js.map +0 -1
  111. package/lib/commonjs/handlers/PanGestureHandler.js +0 -103
  112. package/lib/commonjs/handlers/PanGestureHandler.js.map +0 -1
  113. package/lib/commonjs/handlers/TapGestureHandler.js +0 -22
  114. package/lib/commonjs/handlers/TapGestureHandler.js.map +0 -1
  115. package/lib/commonjs/handlers/createNativeWrapper.js +0 -64
  116. package/lib/commonjs/handlers/createNativeWrapper.js.map +0 -1
  117. package/lib/commonjs/handlers/gestureHandlerCommon.js +0 -22
  118. package/lib/commonjs/handlers/gestureHandlerCommon.js.map +0 -1
  119. package/lib/commonjs/handlers/gestures/GestureDetector.js +0 -554
  120. package/lib/commonjs/handlers/gestures/GestureDetector.js.map +0 -1
  121. package/lib/commonjs/init.js +0 -24
  122. package/lib/commonjs/init.js.map +0 -1
  123. package/lib/module/components/GestureButtons.js +0 -168
  124. package/lib/module/components/GestureButtons.js.map +0 -1
  125. package/lib/module/components/GestureHandlerButton.js +0 -3
  126. package/lib/module/components/GestureHandlerButton.js.map +0 -1
  127. package/lib/module/components/RNGestureHandlerButton.js +0 -17
  128. package/lib/module/components/RNGestureHandlerButton.js.map +0 -1
  129. package/lib/module/components/touchables/GenericTouchable.js +0 -238
  130. package/lib/module/components/touchables/GenericTouchable.js.map +0 -1
  131. package/lib/module/components/touchables/TouchableOpacity.js +0 -49
  132. package/lib/module/components/touchables/TouchableOpacity.js.map +0 -1
  133. package/lib/module/components/touchables/TouchableWithoutFeedback.js +0 -9
  134. package/lib/module/components/touchables/TouchableWithoutFeedback.js.map +0 -1
  135. package/lib/module/components/touchables/index.js +0 -8
  136. package/lib/module/components/touchables/index.js.map +0 -1
  137. package/lib/module/handlers/NativeViewGestureHandler.js +0 -12
  138. package/lib/module/handlers/NativeViewGestureHandler.js.map +0 -1
  139. package/lib/module/handlers/PanGestureHandler.js +0 -92
  140. package/lib/module/handlers/PanGestureHandler.js.map +0 -1
  141. package/lib/module/handlers/TapGestureHandler.js +0 -14
  142. package/lib/module/handlers/TapGestureHandler.js.map +0 -1
  143. package/lib/module/handlers/createNativeWrapper.js +0 -57
  144. package/lib/module/handlers/createNativeWrapper.js.map +0 -1
  145. package/lib/module/handlers/gestureHandlerCommon.js +0 -15
  146. package/lib/module/handlers/gestureHandlerCommon.js.map +0 -1
  147. package/lib/module/handlers/gestures/GestureDetector.js +0 -543
  148. package/lib/module/handlers/gestures/GestureDetector.js.map +0 -1
  149. package/lib/module/init.js +0 -17
  150. package/lib/module/init.js.map +0 -1
  151. package/lib/typescript/components/GestureButtons.d.ts +0 -122
  152. package/lib/typescript/components/GestureButtons.d.ts.map +0 -1
  153. package/lib/typescript/components/GestureHandlerButton.d.ts +0 -5
  154. package/lib/typescript/components/GestureHandlerButton.d.ts.map +0 -1
  155. package/lib/typescript/components/RNGestureHandlerButton.d.ts +0 -2
  156. package/lib/typescript/components/RNGestureHandlerButton.d.ts.map +0 -1
  157. package/lib/typescript/components/touchables/GenericTouchable.d.ts +0 -68
  158. package/lib/typescript/components/touchables/GenericTouchable.d.ts.map +0 -1
  159. package/lib/typescript/components/touchables/TouchableOpacity.d.ts +0 -26
  160. package/lib/typescript/components/touchables/TouchableOpacity.d.ts.map +0 -1
  161. package/lib/typescript/components/touchables/TouchableWithoutFeedback.d.ts +0 -8
  162. package/lib/typescript/components/touchables/TouchableWithoutFeedback.d.ts.map +0 -1
  163. package/lib/typescript/components/touchables/index.d.ts +0 -4
  164. package/lib/typescript/components/touchables/index.d.ts.map +0 -1
  165. package/lib/typescript/handlers/NativeViewGestureHandler.d.ts +0 -29
  166. package/lib/typescript/handlers/NativeViewGestureHandler.d.ts.map +0 -1
  167. package/lib/typescript/handlers/PanGestureHandler.d.ts +0 -140
  168. package/lib/typescript/handlers/PanGestureHandler.d.ts.map +0 -1
  169. package/lib/typescript/handlers/TapGestureHandler.d.ts +0 -58
  170. package/lib/typescript/handlers/TapGestureHandler.d.ts.map +0 -1
  171. package/lib/typescript/handlers/createNativeWrapper.d.ts +0 -4
  172. package/lib/typescript/handlers/createNativeWrapper.d.ts.map +0 -1
  173. package/lib/typescript/handlers/gestureHandlerCommon.d.ts +0 -2
  174. package/lib/typescript/handlers/gestureHandlerCommon.d.ts.map +0 -1
  175. package/lib/typescript/handlers/gestures/GestureDetector.d.ts +0 -24
  176. package/lib/typescript/handlers/gestures/GestureDetector.d.ts.map +0 -1
  177. package/lib/typescript/init.d.ts +0 -3
  178. package/lib/typescript/init.d.ts.map +0 -1
  179. package/src/components/GestureButtons.tsx +0 -334
  180. package/src/components/GestureHandlerButton.tsx +0 -5
  181. package/src/components/RNGestureHandlerButton.tsx +0 -23
  182. package/src/components/touchables/GenericTouchable.tsx +0 -301
  183. package/src/components/touchables/TouchableOpacity.tsx +0 -76
  184. package/src/components/touchables/TouchableWithoutFeedback.tsx +0 -14
  185. package/src/components/touchables/index.ts +0 -7
  186. package/src/handlers/NativeViewGestureHandler.ts +0 -55
  187. package/src/handlers/PanGestureHandler.ts +0 -327
  188. package/src/handlers/TapGestureHandler.ts +0 -95
  189. package/src/handlers/createNativeWrapper.tsx +0 -81
  190. package/src/handlers/gestureHandlerCommon.ts +0 -15
  191. package/src/handlers/gestures/GestureDetector.tsx +0 -823
  192. package/src/init.ts +0 -18
@@ -0,0 +1,5 @@
1
+ export default class BuildProfile {
2
+ static readonly HAR_VERSION = '2.12.9';
3
+ static readonly BUILD_MODE_NAME = 'debug';
4
+ static readonly DEBUG = true;
5
+ }
@@ -1,8 +1,19 @@
1
1
  {
2
- "apiType": "stageMode",
2
+ "apiType": 'stageMode',
3
+ // "buildOption": {
4
+ // "externalNativeOptions": {
5
+ // "path": "./src/main/cpp/CMakeLists.txt",
6
+ // "arguments": "",
7
+ // "cppFlags": "",
8
+ // },
9
+ // },
3
10
  "targets": [
4
11
  {
5
- "name": "default"
12
+ "name": "default",
13
+ "runtimeOS": "HarmonyOS"
14
+ },
15
+ {
16
+ "name": "ohosTest",
6
17
  }
7
18
  ]
8
19
  }
@@ -1,2 +1,2 @@
1
1
  // Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
2
- export { harTasks } from '@ohos/hvigor-ohos-plugin';
2
+ export { harTasks } from '@ohos/hvigor-ohos-plugin';
@@ -1,3 +1,3 @@
1
1
  export * from "./ts"
2
2
  export * from "./src/main/ets/RNGestureHandlerRootView"
3
- export * from "./src/main/ets/RNGestureHandlerButton"
3
+ export * from "./src/main/ets/RNGestureHandlerButton"
@@ -0,0 +1,17 @@
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@../rnoh": "@rnoh/react-native-openharmony@../rnoh"
9
+ },
10
+ "packages": {
11
+ "@rnoh/react-native-openharmony@../rnoh": {
12
+ "name": "@rnoh/react-native-openharmony",
13
+ "resolved": "../rnoh",
14
+ "registryType": "local"
15
+ }
16
+ }
17
+ }
@@ -1,13 +1,12 @@
1
1
  {
2
- "license": "",
3
- "author": "",
4
- "name": "rnoh-gesture-handler",
5
- "description": "",
6
- "main": "index.ets",
7
- "version": "2.12.6",
8
- "devDependencies": {
2
+ license: '',
3
+ devDependencies: {},
4
+ author: '',
5
+ name: '@react-native-oh-tpl/react-native-gesture-handler',
6
+ description: '',
7
+ main: 'index.ets',
8
+ version: '2.12.9',
9
+ dependencies: {
10
+ "@rnoh/react-native-openharmony": 'file:../rnoh',
9
11
  },
10
- "dependencies": {
11
- "rnoh": "file:../rnoh"
12
- }
13
- }
12
+ }
@@ -1,7 +1,14 @@
1
+ #pragma once
1
2
  #include "GestureHandlerPackage.h"
2
- #include "RNGestureHandlerRootViewComponentDescriptor.h"
3
- #include "RNGestureHandlerButtonComponentDescriptor.h"
3
+ #include "RNOH/RNInstanceCAPI.h"
4
+ #include "RNGestureHandlerButtonComponentInstance.h"
5
+ #include "RNGestureHandlerRootViewComponentInstance.h"
6
+ #include "RNOH/ArkTSTurboModule.h"
4
7
  #include "RNGestureHandlerModule.h"
8
+ #include "RNGestureHandlerButtonComponentDescriptor.h"
9
+ #include "RNGestureHandlerRootViewComponentDescriptor.h"
10
+ #include "RNGestureHandlerButtonJSIBinder.h"
11
+ #include "RNGestureHandlerRootViewJSIBinder.h"
5
12
 
6
13
  using namespace rnoh;
7
14
  using namespace facebook;
@@ -16,19 +23,81 @@ public:
16
23
  };
17
24
  };
18
25
 
26
+ class RNGHEventEmitRequestHandler : public EventEmitRequestHandler {
27
+ void handleEvent(EventEmitRequestHandler::Context const &ctx) override {
28
+ auto eventEmitter = ctx.shadowViewRegistry->getEventEmitter<facebook::react::ViewEventEmitter>(ctx.tag);
29
+ if (eventEmitter == nullptr) {
30
+ return;
31
+ }
32
+ if (ctx.eventName == "onGestureHandlerEvent") {
33
+ eventEmitter->dispatchEvent(ctx.eventName, ArkJS(ctx.env).getDynamic(ctx.payload));
34
+ }
35
+ }
36
+ };
37
+
38
+ class RNOHCorePackageComponentInstanceFactoryDelegate : public ComponentInstanceFactoryDelegate {
39
+ public:
40
+ using ComponentInstanceFactoryDelegate::ComponentInstanceFactoryDelegate;
41
+
42
+ ComponentInstance::Shared create(ComponentInstance::Context ctx) override {
43
+ if (ctx.componentName == "RNGestureHandlerButton") {
44
+ return std::make_shared<RNGestureHandlerButtonComponentInstance>(ctx);
45
+ } else if (ctx.componentName == "RNGestureHandlerRootView") {
46
+ return std::make_shared<RNGestureHandlerRootViewComponentInstance>(ctx);
47
+ }
48
+ return nullptr;
49
+ }
50
+ };
51
+
19
52
  std::unique_ptr<TurboModuleFactoryDelegate> GestureHandlerPackage::createTurboModuleFactoryDelegate() {
20
53
  return std::make_unique<GestureHandlerTurboModuleFactoryDelegate>();
21
54
  }
22
55
 
23
56
  std::vector<react::ComponentDescriptorProvider> GestureHandlerPackage::createComponentDescriptorProviders() {
24
57
  return {
25
- react::concreteComponentDescriptorProvider<react::RNGestureHandlerRootViewComponentDescriptor>(),
26
- react::concreteComponentDescriptorProvider<react::RNGestureHandlerButtonComponentDescriptor>(),
58
+ react::concreteComponentDescriptorProvider<react::RNGestureHandlerRootViewComponentDescriptor>(),
59
+ react::concreteComponentDescriptorProvider<react::RNGestureHandlerButtonComponentDescriptor>(),
27
60
  };
28
61
  }
29
62
 
63
+ ComponentJSIBinderByString GestureHandlerPackage::createComponentJSIBinderByName() {
64
+ return {
65
+ {"RNGestureHandlerButton", std::make_shared<RNGestureHandlerButtonJSIBinder>()},
66
+ {"RNGestureHandlerRootView", std::make_shared<RNGestureHandlerRootViewJSIBinder>()},
67
+ };
68
+ };
69
+
30
70
  EventEmitRequestHandlers GestureHandlerPackage::createEventEmitRequestHandlers() {
31
71
  return {
32
- std::make_shared<react::RNGestureHandlerRootViewEventEmitRequestHandler>(),
72
+ std::make_shared<RNGHEventEmitRequestHandler>(),
73
+ };
74
+ }
75
+
76
+ ComponentInstanceFactoryDelegate::Shared GestureHandlerPackage::createComponentInstanceFactoryDelegate() {
77
+ return std::make_shared<RNOHCorePackageComponentInstanceFactoryDelegate>();
78
+ }
79
+
80
+ class ScrollLockerArkTSMessageHandler : public ArkTSMessageHandler {
81
+ public:
82
+ void handleArkTSMessage(const Context &ctx) override {
83
+ if (ctx.messageName == "RNGH::SET_NATIVE_RESPONDERS_BLOCK") {
84
+ auto targetComponentInstanceTag = ctx.messagePayload["targetTag"].asDouble();
85
+ auto shouldBlock = ctx.messagePayload["shouldBlock"].asBool();
86
+ auto rnInstance = ctx.rnInstance.lock();
87
+ if (rnInstance != nullptr) {
88
+ auto rnInstanceCAPI = std::dynamic_pointer_cast<RNInstanceCAPI>(rnInstance);
89
+ if (rnInstanceCAPI != nullptr) {
90
+ auto tmpComponentInstance = rnInstanceCAPI->findComponentInstanceByTag(targetComponentInstanceTag);
91
+ while (tmpComponentInstance != nullptr) {
92
+ tmpComponentInstance->setNativeResponderBlocked(shouldBlock, "RNGH");
93
+ tmpComponentInstance = tmpComponentInstance->getParent().lock();
94
+ }
95
+ }
96
+ }
97
+ }
33
98
  };
34
- }
99
+ };
100
+
101
+ std::vector<ArkTSMessageHandler::Shared> GestureHandlerPackage::createArkTSMessageHandlers() {
102
+ return {std::make_shared<ScrollLockerArkTSMessageHandler>()};
103
+ }
@@ -1,15 +1,21 @@
1
+ #pragma once
1
2
  #include "RNOH/Package.h"
2
3
 
3
4
  namespace rnoh {
5
+ class GestureHandlerPackage : public Package {
6
+ public:
7
+ GestureHandlerPackage(Package::Context ctx) : Package(ctx) {}
4
8
 
5
- class GestureHandlerPackage : public Package {
6
- public:
7
- GestureHandlerPackage(Package::Context ctx) : Package(ctx) {}
9
+ std::unique_ptr<TurboModuleFactoryDelegate> createTurboModuleFactoryDelegate() override;
8
10
 
9
- std::vector<facebook::react::ComponentDescriptorProvider> createComponentDescriptorProviders() override;
11
+ std::vector<facebook::react::ComponentDescriptorProvider> createComponentDescriptorProviders() override;
10
12
 
11
- EventEmitRequestHandlers createEventEmitRequestHandlers() override;
13
+ ComponentJSIBinderByString createComponentJSIBinderByName() override;
12
14
 
13
- std::unique_ptr<TurboModuleFactoryDelegate> createTurboModuleFactoryDelegate() override;
14
- };
15
- } // namespace rnoh
15
+ EventEmitRequestHandlers createEventEmitRequestHandlers();
16
+
17
+ ComponentInstanceFactoryDelegate::Shared createComponentInstanceFactoryDelegate();
18
+
19
+ std::vector<ArkTSMessageHandler::Shared> createArkTSMessageHandlers() override;
20
+ };
21
+ } // namespace rnoh
@@ -1,41 +1,17 @@
1
+
1
2
  #pragma once
2
3
 
4
+ // This file was generated.
5
+
3
6
  #include <react/renderer/core/ConcreteComponentDescriptor.h>
4
7
  #include <react/renderer/components/view/ConcreteViewShadowNode.h>
5
8
  #include <react/renderer/components/view/ViewShadowNode.h>
6
- #include "RNOH/ArkJS.h"
7
- #include "RNOH/EventEmitRequestHandler.h"
8
9
 
9
10
  namespace facebook {
10
11
  namespace react {
11
12
 
12
13
  extern const char RNGestureHandlerButtonComponentName[] = "RNGestureHandlerButton";
13
14
 
14
- class RNGestureHandlerButtonEventEmitter : public ViewEventEmitter {
15
- using ViewEventEmitter::ViewEventEmitter;
16
-
17
- public:
18
- void emit(std::string type, const folly::dynamic &payload) const {
19
- this->dispatchEvent(type, payload);
20
- }
21
- };
22
-
23
- class RNGestureHandlerButtonEventEmitRequestHandler : public rnoh::EventEmitRequestHandler {
24
- void handleEvent(rnoh::EventEmitRequestHandler::Context const &ctx) override {
25
- std::string prefix = "RNGestureHandlerButton";
26
- size_t prefixPos = ctx.eventName.find(prefix);
27
- if (prefixPos != std::string::npos) {
28
- ArkJS arkJs(ctx.env);
29
- auto eventEmitter = ctx.shadowViewRegistry->getEventEmitter<RNGestureHandlerButtonEventEmitter>(ctx.tag);
30
- if (eventEmitter != nullptr) {
31
- auto payload = arkJs.getDynamic(ctx.payload);
32
- std::string eventName = ctx.eventName.substr(prefixPos + prefix.length());
33
- eventEmitter->emit(eventName, payload);
34
- }
35
- }
36
- }
37
- };
38
-
39
15
  class RNGestureHandlerButtonProps : public ViewProps {
40
16
  public:
41
17
  RNGestureHandlerButtonProps() = default;
@@ -47,7 +23,7 @@ class RNGestureHandlerButtonProps : public ViewProps {
47
23
  using RNGestureHandlerButtonShadowNode = ConcreteViewShadowNode<
48
24
  RNGestureHandlerButtonComponentName,
49
25
  RNGestureHandlerButtonProps,
50
- RNGestureHandlerButtonEventEmitter>;
26
+ ViewEventEmitter>;
51
27
 
52
28
  class RNGestureHandlerButtonComponentDescriptor final
53
29
  : public ConcreteComponentDescriptor<RNGestureHandlerButtonShadowNode> {
@@ -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
@@ -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
@@ -1,17 +1,22 @@
1
+
1
2
  #include "RNGestureHandlerModule.h"
2
- #include "RNOH/ArkTSTurboModule.h"
3
3
 
4
- using namespace rnoh;
4
+ // This file was generated.
5
+
6
+ namespace rnoh {
5
7
  using namespace facebook;
6
8
 
7
- rnoh::RNGestureHandlerModule::RNGestureHandlerModule(const ArkTSTurboModule::Context ctx, const std::string name)
8
- : rnoh::ArkTSTurboModule(ctx, name) {
9
- methodMap_ = {ARK_METHOD_METADATA(handleSetJSResponder, 2),
10
- ARK_METHOD_METADATA(handleClearJSResponder, 0),
11
- ARK_METHOD_METADATA(createGestureHandler, 3),
12
- ARK_METHOD_METADATA(attachGestureHandler, 3),
13
- ARK_METHOD_METADATA(updateGestureHandler, 2),
14
- ARK_METHOD_METADATA(dropGestureHandler, 1),
15
- ARK_METHOD_METADATA(install, 0),
16
- ARK_METHOD_METADATA(flushOperations, 0)};
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
+ };
17
20
  }
21
+
22
+ } // namespace rnoh
@@ -1,12 +1,15 @@
1
+
1
2
  #pragma once
2
3
 
4
+ // This file was generated.
5
+
3
6
  #include "RNOH/ArkTSTurboModule.h"
4
7
 
5
8
  namespace rnoh {
6
9
 
7
10
  class JSI_EXPORT RNGestureHandlerModule : public ArkTSTurboModule {
8
- public:
11
+ public:
9
12
  RNGestureHandlerModule(const ArkTSTurboModule::Context ctx, const std::string name);
10
13
  };
11
14
 
12
- } // namespace rnoh
15
+ } // namespace rnoh
@@ -0,0 +1,72 @@
1
+ // #pragma once
2
+ //
3
+ // // This file was generated.
4
+ //
5
+ // #include "RNOH/Package.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
+ //
13
+ // namespace rnoh {
14
+ //
15
+ // class RNOHGeneratedPackageTurboModuleFactoryDelegate : public TurboModuleFactoryDelegate {
16
+ // public:
17
+ // SharedTurboModule createTurboModule(Context ctx, const std::string &name) const override {
18
+ // if (name == "RNGestureHandlerModule") {
19
+ // return std::make_shared<RNGestureHandlerModule>(ctx, name);
20
+ // }
21
+ // return nullptr;
22
+ // };
23
+ // };
24
+ //
25
+ // class GeneratedEventEmitRequestHandler : public EventEmitRequestHandler {
26
+ // public:
27
+ // void handleEvent(Context const &ctx) override {
28
+ // auto eventEmitter = ctx.shadowViewRegistry->getEventEmitter<facebook::react::EventEmitter>(ctx.tag);
29
+ // if (eventEmitter == nullptr) {
30
+ // return;
31
+ // }
32
+ //
33
+ // std::vector<std::string> supportedEventNames = {
34
+ // "directEvent",
35
+ // "bubblingEvent",
36
+ // };
37
+ // if (std::find(supportedEventNames.begin(), supportedEventNames.end(), ctx.eventName) != supportedEventNames.end()) {
38
+ // eventEmitter->dispatchEvent(ctx.eventName, ArkJS(ctx.env).getDynamic(ctx.payload));
39
+ // }
40
+ // }
41
+ // };
42
+ //
43
+ // class RNOHGeneratedPackage : public Package {
44
+ // public:
45
+ // RNOHGeneratedPackage(Package::Context ctx) : Package(ctx){};
46
+ //
47
+ // std::unique_ptr<TurboModuleFactoryDelegate> createTurboModuleFactoryDelegate() override {
48
+ // return std::make_unique<RNOHGeneratedPackageTurboModuleFactoryDelegate>();
49
+ // }
50
+ //
51
+ // std::vector<facebook::react::ComponentDescriptorProvider> createComponentDescriptorProviders() override {
52
+ // return {
53
+ // facebook::react::concreteComponentDescriptorProvider<facebook::react::RNGestureHandlerButtonComponentDescriptor>(),
54
+ // facebook::react::concreteComponentDescriptorProvider<facebook::react::RNGestureHandlerRootViewComponentDescriptor>(),
55
+ // };
56
+ // }
57
+ //
58
+ // ComponentJSIBinderByString createComponentJSIBinderByName() override {
59
+ // return {
60
+ // {"RNGestureHandlerButton", std::make_shared<RNGestureHandlerButtonJSIBinder>()},
61
+ // {"RNGestureHandlerRootView", std::make_shared<RNGestureHandlerRootViewJSIBinder>()},
62
+ // };
63
+ // };
64
+ //
65
+ // EventEmitRequestHandlers createEventEmitRequestHandlers() override {
66
+ // return {
67
+ // std::make_shared<GeneratedEventEmitRequestHandler>(),
68
+ // };
69
+ // }
70
+ // };
71
+ //
72
+ // } // namespace rnoh
@@ -1,41 +1,17 @@
1
+
1
2
  #pragma once
2
3
 
4
+ // This file was generated.
5
+
3
6
  #include <react/renderer/core/ConcreteComponentDescriptor.h>
4
7
  #include <react/renderer/components/view/ConcreteViewShadowNode.h>
5
8
  #include <react/renderer/components/view/ViewShadowNode.h>
6
- #include "RNOH/ArkJS.h"
7
- #include "RNOH/EventEmitRequestHandler.h"
8
9
 
9
10
  namespace facebook {
10
11
  namespace react {
11
12
 
12
13
  extern const char RNGestureHandlerRootViewComponentName[] = "RNGestureHandlerRootView";
13
14
 
14
- class RNGestureHandlerRootViewEventEmitter : public ViewEventEmitter {
15
- using ViewEventEmitter::ViewEventEmitter;
16
-
17
- public:
18
- void emit(std::string type, const folly::dynamic &payload) const {
19
- this->dispatchEvent(type, payload);
20
- }
21
- };
22
-
23
- class RNGestureHandlerRootViewEventEmitRequestHandler : public rnoh::EventEmitRequestHandler {
24
- void handleEvent(rnoh::EventEmitRequestHandler::Context const &ctx) override {
25
- std::string prefix = "RNGestureHandlerRootView";
26
- size_t prefixPos = ctx.eventName.find(prefix);
27
- if (prefixPos != std::string::npos) {
28
- ArkJS arkJs(ctx.env);
29
- auto eventEmitter = ctx.shadowViewRegistry->getEventEmitter<RNGestureHandlerRootViewEventEmitter>(ctx.tag);
30
- if (eventEmitter != nullptr) {
31
- auto payload = arkJs.getDynamic(ctx.payload);
32
- std::string eventName = ctx.eventName.substr(prefixPos + prefix.length());
33
- eventEmitter->emit(eventName, payload);
34
- }
35
- }
36
- }
37
- };
38
-
39
15
  class RNGestureHandlerRootViewProps : public ViewProps {
40
16
  public:
41
17
  RNGestureHandlerRootViewProps() = default;
@@ -47,7 +23,7 @@ class RNGestureHandlerRootViewProps : public ViewProps {
47
23
  using RNGestureHandlerRootViewShadowNode = ConcreteViewShadowNode<
48
24
  RNGestureHandlerRootViewComponentName,
49
25
  RNGestureHandlerRootViewProps,
50
- RNGestureHandlerRootViewEventEmitter>;
26
+ ViewEventEmitter>;
51
27
 
52
28
  class RNGestureHandlerRootViewComponentDescriptor final
53
29
  : public ConcreteComponentDescriptor<RNGestureHandlerRootViewShadowNode> {
@@ -0,0 +1,78 @@
1
+ #pragma once
2
+ #import "RNOH/CppComponentInstance.h"
3
+ #import "RNOH/arkui/StackNode.h"
4
+ #import "RNOH/arkui/ArkUINodeRegistry.h"
5
+ #import "RNOH/arkui/NativeNodeApi.h"
6
+ #import "RNGestureHandlerRootViewComponentDescriptor.h"
7
+
8
+ namespace rnoh {
9
+ class RNGestureHandlerRootViewComponentInstance
10
+ : public CppComponentInstance<facebook::react::RNGestureHandlerRootViewShadowNode>,
11
+ public TouchEventHandler {
12
+ private:
13
+ StackNode m_stackNode;
14
+
15
+ public:
16
+ RNGestureHandlerRootViewComponentInstance(Context context) : CppComponentInstance(std::move(context)) {
17
+ ArkUINodeRegistry::getInstance().registerTouchHandler(&m_stackNode, this);
18
+ NativeNodeApi::getInstance()->registerNodeEvent(m_stackNode.getArkUINodeHandle(), NODE_TOUCH_EVENT, 0);
19
+ m_deps->arkTSChannel->postMessage("RNGH::ROOT_CREATED", m_tag);
20
+ };
21
+
22
+ ~RNGestureHandlerRootViewComponentInstance() {
23
+ ArkUINodeRegistry::getInstance().unregisterTouchHandler(&m_stackNode);
24
+ NativeNodeApi::getInstance()->unregisterNodeEvent(m_stackNode.getArkUINodeHandle(), NODE_TOUCH_EVENT);
25
+ }
26
+
27
+ StackNode &getLocalRootArkUINode() override { return m_stackNode; };
28
+
29
+ void onTouchEvent(ArkUI_NodeTouchEvent e) override {
30
+ folly::dynamic payload = folly::dynamic::object;
31
+ payload["action"] = static_cast<int>(e.action);
32
+ payload["actionTouch"] = this->convertNodeTouchPointToDynamic(e.actionTouch);
33
+ folly::dynamic touchPoints = folly::dynamic::array();
34
+ touchPoints.push_back(this->convertNodeTouchPointToDynamic(e.actionTouch));
35
+ payload["touchPoints"] = touchPoints;
36
+ payload["sourceType"] = static_cast<int>(e.sourceType);
37
+ payload["timestamp"] = e.timeStamp;
38
+ payload["rootTag"] = m_tag;
39
+ m_deps->arkTSChannel->postMessage("RNGH::TOUCH_EVENT", payload);
40
+ }
41
+ private:
42
+ folly::dynamic convertNodeTouchPointToDynamic(ArkUI_NodeTouchPoint actionTouch) {
43
+ folly::dynamic result = folly::dynamic::object;
44
+ result["contactAreaHeight"] = actionTouch.contactAreaHeight;
45
+ result["contactAreaWidth"] = actionTouch.contactAreaWidth;
46
+ result["id"] = actionTouch.id;
47
+ result["nodeX"] = actionTouch.nodeX;
48
+ result["nodeY"] = actionTouch.nodeY;
49
+ result["pressedTime"] = actionTouch.pressedTime;
50
+ result["pressure"] = actionTouch.pressure;
51
+ result["rawX"] = actionTouch.rawX;
52
+ result["rawY"] = actionTouch.rawY;
53
+ result["screenX"] = actionTouch.screenX;
54
+ result["screenY"] = actionTouch.screenY;
55
+ result["tiltX"] = actionTouch.tiltX;
56
+ result["tiltY"] = actionTouch.tiltY;
57
+ result["toolHeight"] = actionTouch.toolHeight;
58
+ result["toolWidth"] = actionTouch.toolWidth;
59
+ result["toolX"] = actionTouch.toolX;
60
+ result["toolY"] = actionTouch.toolY;
61
+ result["toolType"] = static_cast<int>(actionTouch.toolType);
62
+ result["windowX"] = actionTouch.windowX;
63
+ result["windowY"] = actionTouch.windowY;
64
+ return result;
65
+ }
66
+
67
+ protected:
68
+ void onChildInserted(ComponentInstance::Shared const &childComponentInstance, std::size_t index) override {
69
+ CppComponentInstance::onChildInserted(childComponentInstance, index);
70
+ m_stackNode.insertChild(childComponentInstance->getLocalRootArkUINode(), index);
71
+ };
72
+
73
+ void onChildRemoved(ComponentInstance::Shared const &childComponentInstance) override {
74
+ CppComponentInstance::onChildRemoved(childComponentInstance);
75
+ m_stackNode.removeChild(childComponentInstance->getLocalRootArkUINode());
76
+ };
77
+ };
78
+ } // namespace rnoh
@@ -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 createBubblingEventTypes(facebook::jsi::Runtime &rt) override {
16
+ facebook::jsi::Object events(rt);
17
+ return events;
18
+ }
19
+
20
+ facebook::jsi::Object createDirectEventTypes(facebook::jsi::Runtime &rt) override {
21
+ facebook::jsi::Object events(rt);
22
+ return events;
23
+ }
24
+ };
25
+ } // namespace rnoh
@@ -1,4 +1,4 @@
1
- import { RNInstance } from "rnoh/ts"
1
+ import { RNInstance } from "@rnoh/react-native-openharmony/ts"
2
2
  import { GestureStateChangeEvent, GestureUpdateEvent, GestureTouchEvent } from "./OutgoingEvent"
3
3
  import { RNGHLogger } from './RNGHLogger'
4
4
 
@@ -31,6 +31,21 @@ export class AnimatedEventDispatcher implements EventDispatcher {
31
31
  this.rnInstance.emitDeviceEvent("onGestureHandlerStateChange", event)
32
32
  }
33
33
 
34
+ public onGestureHandlerEvent(event: GestureStateChangeEvent | GestureUpdateEvent | GestureTouchEvent) {
35
+ this.logger.info(`onGestureHandlerEvent`)
36
+ this.rnInstance.emitComponentEvent(this.viewTag, "onGestureHandlerEvent", event)
37
+ }
38
+ }
39
+
40
+ export class ReanimatedEventDispatcher implements EventDispatcher {
41
+ constructor(private rnInstance: RNInstance, private logger: RNGHLogger, private viewTag: number) {
42
+ }
43
+
44
+ public onGestureHandlerStateChange(event: GestureStateChangeEvent) {
45
+ this.logger.info(`onGestureHandlerStateChange`)
46
+ this.rnInstance.emitComponentEvent(this.viewTag, "onGestureHandlerStateChange", event)
47
+ }
48
+
34
49
  public onGestureHandlerEvent(event: GestureStateChangeEvent | GestureUpdateEvent | GestureTouchEvent) {
35
50
  this.logger.info(`onGestureHandlerEvent`)
36
51
  this.rnInstance.emitComponentEvent(this.viewTag, "onGestureHandlerEvent", event)