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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (192) hide show
  1. package/harmony/gesture_handler/BuildProfile.ets +6 -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 +18 -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 +123 -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,6 @@
1
+ export default class BuildProfile {
2
+ static readonly HAR_VERSION = '2.12.9-1';
3
+ static readonly BUILD_MODE_NAME = 'debug';
4
+ static readonly DEBUG = true;
5
+ static readonly TARGET_NAME = 'default';
6
+ }
@@ -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,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": "@rnoh/react-native-openharmony@../react_native_openharmony"
9
+ },
10
+ "packages": {
11
+ "@rnoh/react-native-openharmony@../react_native_openharmony": {
12
+ "name": "@rnoh/react-native-openharmony",
13
+ "version": "0.72.20",
14
+ "resolved": "../react_native_openharmony",
15
+ "registryType": "local"
16
+ }
17
+ }
18
+ }
@@ -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-1',
9
+ dependencies: {
10
+ "@rnoh/react-native-openharmony": 'file:../react_native_openharmony',
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,123 @@
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
+ #include "RNOH/arkui/TouchEventDispatcher.h"
8
+
9
+ namespace rnoh {
10
+ class RNGestureHandlerRootViewComponentInstance
11
+ : public CppComponentInstance<facebook::react::RNGestureHandlerRootViewShadowNode>,
12
+ public TouchEventHandler {
13
+ private:
14
+ StackNode m_stackNode;
15
+
16
+ public:
17
+ RNGestureHandlerRootViewComponentInstance(Context context) : CppComponentInstance(std::move(context)) {
18
+ ArkUINodeRegistry::getInstance().registerTouchHandler(&m_stackNode, this);
19
+ NativeNodeApi::getInstance()->registerNodeEvent(m_stackNode.getArkUINodeHandle(), NODE_TOUCH_EVENT, 0, nullptr);
20
+ m_deps->arkTSChannel->postMessage("RNGH::ROOT_CREATED", m_tag);
21
+ };
22
+
23
+ ~RNGestureHandlerRootViewComponentInstance() {
24
+ ArkUINodeRegistry::getInstance().unregisterTouchHandler(&m_stackNode);
25
+ NativeNodeApi::getInstance()->unregisterNodeEvent(m_stackNode.getArkUINodeHandle(), NODE_TOUCH_EVENT);
26
+ }
27
+
28
+ StackNode &getLocalRootArkUINode() override { return m_stackNode; };
29
+
30
+ void onTouchEvent(ArkUI_UIInputEvent *e) override {
31
+ folly::dynamic payload = folly::dynamic::object;
32
+ payload["action"] = static_cast<int>(OH_ArkUI_UIInputEvent_GetAction(e));
33
+ payload["actionTouch"] = this->convertNodeTouchPointToDynamic(getActiveTouchFromEvent(e));
34
+ folly::dynamic touchPoints = folly::dynamic::array();
35
+ touchPoints.push_back(this->convertNodeTouchPointToDynamic(getActiveTouchFromEvent(e)));
36
+ payload["touchPoints"] = touchPoints;
37
+ payload["sourceType"] = static_cast<int>(OH_ArkUI_UIInputEvent_GetSourceType(e));
38
+ payload["timestamp"] = OH_ArkUI_UIInputEvent_GetEventTime(e);
39
+ payload["rootTag"] = m_tag;
40
+ m_deps->arkTSChannel->postMessage("RNGH::TOUCH_EVENT", payload);
41
+ }
42
+
43
+ private:
44
+ struct TouchPoint {
45
+ int32_t contactAreaHeight;
46
+ int32_t contactAreaWidth;
47
+ int32_t id;
48
+ int32_t nodeX;
49
+ int32_t nodeY;
50
+ int64_t pressedTime;
51
+ double pressure;
52
+ int32_t rawX;
53
+ int32_t rawY;
54
+ int32_t screenX;
55
+ int32_t screenY;
56
+ double tiltX;
57
+ double tiltY;
58
+ int32_t toolHeight;
59
+ int32_t toolWidth;
60
+ int32_t toolX;
61
+ int32_t toolY;
62
+ int32_t toolType;
63
+ int32_t windowX;
64
+ int32_t windowY;
65
+ };
66
+
67
+ TouchPoint getActiveTouchFromEvent(ArkUI_UIInputEvent *event) {
68
+ TouchPoint actionTouch{};
69
+ actionTouch = TouchPoint{
70
+ .contactAreaHeight = int32_t(OH_ArkUI_PointerEvent_GetTouchAreaHeight(event, 0)),
71
+ .contactAreaWidth = int32_t(OH_ArkUI_PointerEvent_GetTouchAreaWidth(event, 0)),
72
+ .id = OH_ArkUI_PointerEvent_GetPointerId(event, 0),
73
+ .nodeX = int32_t(OH_ArkUI_PointerEvent_GetX(event)),
74
+ .nodeY = int32_t(OH_ArkUI_PointerEvent_GetY(event)),
75
+ .pressure = double(OH_ArkUI_PointerEvent_GetPressure(event, 0)),
76
+ .screenX = int32_t(OH_ArkUI_PointerEvent_GetDisplayX(event)),
77
+ .screenY = int32_t(OH_ArkUI_PointerEvent_GetDisplayY(event)),
78
+ .tiltX = double(OH_ArkUI_PointerEvent_GetTiltX(event, 0)),
79
+ .tiltY = double(OH_ArkUI_PointerEvent_GetTiltX(event, 0)),
80
+ .toolType = int32_t(OH_ArkUI_UIInputEvent_GetToolType(event)),
81
+ .windowX = int32_t(OH_ArkUI_PointerEvent_GetWindowX(event)),
82
+ .windowY = int32_t(OH_ArkUI_PointerEvent_GetWindowY(event)),
83
+ };
84
+ return actionTouch;
85
+ }
86
+
87
+ folly::dynamic convertNodeTouchPointToDynamic(TouchPoint actionTouch) {
88
+ folly::dynamic result = folly::dynamic::object;
89
+ result["contactAreaHeight"] = actionTouch.contactAreaHeight;
90
+ result["contactAreaWidth"] = actionTouch.contactAreaWidth;
91
+ result["id"] = actionTouch.id;
92
+ result["nodeX"] = actionTouch.nodeX;
93
+ result["nodeY"] = actionTouch.nodeY;
94
+ // result["pressedTime"] = actionTouch.pressedTime;
95
+ result["pressure"] = actionTouch.pressure;
96
+ // result["rawX"] = actionTouch.rawX;
97
+ // result["rawY"] = actionTouch.rawY;
98
+ result["screenX"] = actionTouch.screenX;
99
+ result["screenY"] = actionTouch.screenY;
100
+ result["tiltX"] = actionTouch.tiltX;
101
+ result["tiltY"] = actionTouch.tiltY;
102
+ // result["toolHeight"] = actionTouch.toolHeight;
103
+ // result["toolWidth"] = actionTouch.toolWidth;
104
+ // result["toolX"] = actionTouch.toolX;
105
+ // result["toolY"] = actionTouch.toolY;
106
+ result["toolType"] = static_cast<int>(actionTouch.toolType);
107
+ result["windowX"] = actionTouch.windowX;
108
+ result["windowY"] = actionTouch.windowY;
109
+ return result;
110
+ }
111
+
112
+ protected:
113
+ void onChildInserted(ComponentInstance::Shared const &childComponentInstance, std::size_t index) override {
114
+ CppComponentInstance::onChildInserted(childComponentInstance, index);
115
+ m_stackNode.insertChild(childComponentInstance->getLocalRootArkUINode(), index);
116
+ };
117
+
118
+ void onChildRemoved(ComponentInstance::Shared const &childComponentInstance) override {
119
+ CppComponentInstance::onChildRemoved(childComponentInstance);
120
+ m_stackNode.removeChild(childComponentInstance->getLocalRootArkUINode());
121
+ };
122
+ };
123
+ } // 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