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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (211) hide show
  1. package/harmony/gesture_handler/BuildProfile.ets +6 -0
  2. package/harmony/gesture_handler/build-profile.json5 +18 -7
  3. package/harmony/gesture_handler/hvigorfile.ts +2 -2
  4. package/harmony/gesture_handler/index.ets +3 -3
  5. package/harmony/gesture_handler/oh-package-lock.json5 +18 -0
  6. package/harmony/gesture_handler/oh-package.json5 +12 -11
  7. package/harmony/gesture_handler/src/main/cpp/CMakeLists.txt +8 -8
  8. package/harmony/gesture_handler/src/main/cpp/GestureHandlerPackage.cpp +103 -34
  9. package/harmony/gesture_handler/src/main/cpp/GestureHandlerPackage.h +21 -15
  10. package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerButtonComponentDescriptor.h +36 -60
  11. package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerButtonComponentInstance.h +27 -0
  12. package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerButtonJSIBinder.h +32 -0
  13. package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerModule.cpp +22 -17
  14. package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerModule.h +15 -12
  15. package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerPackage.h +72 -0
  16. package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerRootViewComponentDescriptor.h +36 -60
  17. package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerRootViewComponentInstance.h +123 -0
  18. package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerRootViewJSIBinder.h +25 -0
  19. package/harmony/gesture_handler/src/main/ets/CircularBuffer.ts +42 -42
  20. package/harmony/gesture_handler/src/main/ets/Event.ts +67 -67
  21. package/harmony/gesture_handler/src/main/ets/EventDispatcher.ts +52 -37
  22. package/harmony/gesture_handler/src/main/ets/GestureHandler.ts +663 -663
  23. package/harmony/gesture_handler/src/main/ets/{GestureHandlerArkUIAdapter.ets → GestureHandlerArkUIAdapter.ts} +202 -201
  24. package/harmony/gesture_handler/src/main/ets/GestureHandlerFactory.ts +44 -44
  25. package/harmony/gesture_handler/src/main/ets/GestureHandlerOrchestrator.ts +280 -280
  26. package/harmony/gesture_handler/src/main/ets/GestureHandlerPackage.ts +22 -22
  27. package/harmony/gesture_handler/src/main/ets/GestureHandlerRegistry.ts +27 -27
  28. package/harmony/gesture_handler/src/main/ets/InteractionManager.ts +108 -108
  29. package/harmony/gesture_handler/src/main/ets/LeastSquareSolver.ts +182 -182
  30. package/harmony/gesture_handler/src/main/ets/NativeViewGestureHandler.ts +114 -114
  31. package/harmony/gesture_handler/src/main/ets/OutgoingEvent.ts +33 -33
  32. package/harmony/gesture_handler/src/main/ets/PanGestureHandler.ts +327 -327
  33. package/harmony/gesture_handler/src/main/ets/PointerTracker.ts +239 -239
  34. package/harmony/gesture_handler/src/main/ets/RNGHError.ts +4 -4
  35. package/harmony/gesture_handler/src/main/ets/RNGHLogger.ts +47 -28
  36. package/harmony/gesture_handler/src/main/ets/{RNGHRootTouchHandler.ets → RNGHRootTouchHandlerArkTS.ts} +59 -57
  37. package/harmony/gesture_handler/src/main/ets/RNGHRootTouchHandlerCAPI.ts +87 -0
  38. package/harmony/gesture_handler/src/main/ets/RNGestureHandlerButton.ets +37 -36
  39. package/harmony/gesture_handler/src/main/ets/RNGestureHandlerModule.ts +183 -125
  40. package/harmony/gesture_handler/src/main/ets/RNGestureHandlerRootView.ets +52 -55
  41. package/harmony/gesture_handler/src/main/ets/RNOHScrollLocker.ts +23 -11
  42. package/harmony/gesture_handler/src/main/ets/State.ts +46 -46
  43. package/harmony/gesture_handler/src/main/ets/TapGestureHandler.ts +205 -205
  44. package/harmony/gesture_handler/src/main/ets/Vector2D.ts +36 -36
  45. package/harmony/gesture_handler/src/main/ets/VelocityTracker.ts +98 -98
  46. package/harmony/gesture_handler/src/main/ets/View.ts +70 -70
  47. package/harmony/gesture_handler/src/main/ets/ViewRegistry.ts +42 -42
  48. package/harmony/gesture_handler/src/main/ets/namespace/RNGestureHandlerButton.ts +140 -0
  49. package/harmony/gesture_handler/src/main/ets/namespace/RNGestureHandlerModule.ts +25 -0
  50. package/harmony/gesture_handler/src/main/ets/namespace/RNGestureHandlerRootView.ts +101 -0
  51. package/harmony/gesture_handler/src/main/ets/namespace/ts.ts +3 -0
  52. package/harmony/gesture_handler/src/main/ets/pages/Index.ets +16 -16
  53. package/harmony/gesture_handler/src/main/ets/types.ts +25 -0
  54. package/harmony/gesture_handler/src/main/ets/webviewability/WebviewAbility.ts +41 -41
  55. package/harmony/gesture_handler/src/main/module.json5 +7 -7
  56. package/harmony/gesture_handler/src/main/resources/base/element/color.json +7 -7
  57. package/harmony/gesture_handler/src/main/resources/base/element/string.json +15 -15
  58. package/harmony/gesture_handler/src/main/resources/base/profile/main_pages.json +5 -5
  59. package/harmony/gesture_handler/src/main/resources/en_US/element/string.json +15 -15
  60. package/harmony/gesture_handler/src/main/resources/zh_CN/element/string.json +15 -15
  61. package/harmony/gesture_handler/ts.ts +2 -1
  62. package/harmony/gesture_handler.har +0 -0
  63. package/lib/commonjs/RNGestureHandlerModule.js +6 -3
  64. package/lib/commonjs/RNGestureHandlerModule.js.map +1 -1
  65. package/lib/commonjs/components/GestureHandlerRootView.js +5 -13
  66. package/lib/commonjs/components/GestureHandlerRootView.js.map +1 -1
  67. package/lib/commonjs/handlers/createHandler.js +31 -28
  68. package/lib/commonjs/handlers/createHandler.js.map +1 -1
  69. package/lib/commonjs/index.js +42 -19
  70. package/lib/commonjs/index.js.map +1 -1
  71. package/lib/commonjs/specs/NativeRNGestureHandlerModule.js +10 -0
  72. package/lib/commonjs/specs/NativeRNGestureHandlerModule.js.map +1 -0
  73. package/lib/commonjs/specs/RNGestureHandlerButtonNativeComponent.js +11 -0
  74. package/lib/commonjs/specs/RNGestureHandlerButtonNativeComponent.js.map +1 -0
  75. package/lib/commonjs/specs/RNGestureHandlerRootViewNativeComponent.js +11 -0
  76. package/lib/commonjs/specs/RNGestureHandlerRootViewNativeComponent.js.map +1 -0
  77. package/lib/module/RNGestureHandlerModule.js +3 -2
  78. package/lib/module/RNGestureHandlerModule.js.map +1 -1
  79. package/lib/module/components/GestureHandlerRootView.js +3 -11
  80. package/lib/module/components/GestureHandlerRootView.js.map +1 -1
  81. package/lib/module/handlers/createHandler.js +20 -19
  82. package/lib/module/handlers/createHandler.js.map +1 -1
  83. package/lib/module/index.js +6 -14
  84. package/lib/module/index.js.map +1 -1
  85. package/lib/module/specs/NativeRNGestureHandlerModule.js +3 -0
  86. package/lib/module/specs/NativeRNGestureHandlerModule.js.map +1 -0
  87. package/lib/module/specs/RNGestureHandlerButtonNativeComponent.js +3 -0
  88. package/lib/module/specs/RNGestureHandlerButtonNativeComponent.js.map +1 -0
  89. package/lib/module/specs/RNGestureHandlerRootViewNativeComponent.js +3 -0
  90. package/lib/module/specs/RNGestureHandlerRootViewNativeComponent.js.map +1 -0
  91. package/lib/typescript/RNGestureHandlerModule.d.ts +2 -6
  92. package/lib/typescript/RNGestureHandlerModule.d.ts.map +1 -1
  93. package/lib/typescript/components/GestureHandlerRootView.d.ts +6 -6
  94. package/lib/typescript/components/GestureHandlerRootView.d.ts.map +1 -1
  95. package/lib/typescript/handlers/createHandler.d.ts +11 -11
  96. package/lib/typescript/handlers/createHandler.d.ts.map +1 -1
  97. package/lib/typescript/index.d.ts +9 -8
  98. package/lib/typescript/index.d.ts.map +1 -1
  99. package/lib/typescript/specs/NativeRNGestureHandlerModule.d.ts +15 -0
  100. package/lib/typescript/specs/NativeRNGestureHandlerModule.d.ts.map +1 -0
  101. package/lib/typescript/specs/RNGestureHandlerButtonNativeComponent.d.ts +15 -0
  102. package/lib/typescript/specs/RNGestureHandlerButtonNativeComponent.d.ts.map +1 -0
  103. package/lib/typescript/specs/RNGestureHandlerRootViewNativeComponent.d.ts +7 -0
  104. package/lib/typescript/specs/RNGestureHandlerRootViewNativeComponent.d.ts.map +1 -0
  105. package/package.json +66 -70
  106. package/src/RNGestureHandlerModule.ts +5 -6
  107. package/src/components/GestureHandlerRootView.tsx +23 -34
  108. package/src/handlers/createHandler.tsx +534 -535
  109. package/src/index.ts +172 -172
  110. package/src/specs/NativeRNGestureHandlerModule.ts +26 -0
  111. package/src/specs/RNGestureHandlerButtonNativeComponent.ts +18 -0
  112. package/src/specs/RNGestureHandlerRootViewNativeComponent.ts +6 -0
  113. package/README.md +0 -1
  114. package/lib/commonjs/components/GestureButtons.js +0 -186
  115. package/lib/commonjs/components/GestureButtons.js.map +0 -1
  116. package/lib/commonjs/components/GestureHandlerButton.js +0 -9
  117. package/lib/commonjs/components/GestureHandlerButton.js.map +0 -1
  118. package/lib/commonjs/components/RNGestureHandlerButton.js +0 -23
  119. package/lib/commonjs/components/RNGestureHandlerButton.js.map +0 -1
  120. package/lib/commonjs/components/touchables/GenericTouchable.js +0 -247
  121. package/lib/commonjs/components/touchables/GenericTouchable.js.map +0 -1
  122. package/lib/commonjs/components/touchables/TouchableOpacity.js +0 -58
  123. package/lib/commonjs/components/touchables/TouchableOpacity.js.map +0 -1
  124. package/lib/commonjs/components/touchables/TouchableWithoutFeedback.js +0 -18
  125. package/lib/commonjs/components/touchables/TouchableWithoutFeedback.js.map +0 -1
  126. package/lib/commonjs/components/touchables/index.js +0 -21
  127. package/lib/commonjs/components/touchables/index.js.map +0 -1
  128. package/lib/commonjs/handlers/NativeViewGestureHandler.js +0 -19
  129. package/lib/commonjs/handlers/NativeViewGestureHandler.js.map +0 -1
  130. package/lib/commonjs/handlers/PanGestureHandler.js +0 -103
  131. package/lib/commonjs/handlers/PanGestureHandler.js.map +0 -1
  132. package/lib/commonjs/handlers/TapGestureHandler.js +0 -22
  133. package/lib/commonjs/handlers/TapGestureHandler.js.map +0 -1
  134. package/lib/commonjs/handlers/createNativeWrapper.js +0 -64
  135. package/lib/commonjs/handlers/createNativeWrapper.js.map +0 -1
  136. package/lib/commonjs/handlers/gestureHandlerCommon.js +0 -22
  137. package/lib/commonjs/handlers/gestureHandlerCommon.js.map +0 -1
  138. package/lib/commonjs/handlers/gestures/GestureDetector.js +0 -554
  139. package/lib/commonjs/handlers/gestures/GestureDetector.js.map +0 -1
  140. package/lib/commonjs/init.js +0 -24
  141. package/lib/commonjs/init.js.map +0 -1
  142. package/lib/module/components/GestureButtons.js +0 -168
  143. package/lib/module/components/GestureButtons.js.map +0 -1
  144. package/lib/module/components/GestureHandlerButton.js +0 -3
  145. package/lib/module/components/GestureHandlerButton.js.map +0 -1
  146. package/lib/module/components/RNGestureHandlerButton.js +0 -17
  147. package/lib/module/components/RNGestureHandlerButton.js.map +0 -1
  148. package/lib/module/components/touchables/GenericTouchable.js +0 -238
  149. package/lib/module/components/touchables/GenericTouchable.js.map +0 -1
  150. package/lib/module/components/touchables/TouchableOpacity.js +0 -49
  151. package/lib/module/components/touchables/TouchableOpacity.js.map +0 -1
  152. package/lib/module/components/touchables/TouchableWithoutFeedback.js +0 -9
  153. package/lib/module/components/touchables/TouchableWithoutFeedback.js.map +0 -1
  154. package/lib/module/components/touchables/index.js +0 -8
  155. package/lib/module/components/touchables/index.js.map +0 -1
  156. package/lib/module/handlers/NativeViewGestureHandler.js +0 -12
  157. package/lib/module/handlers/NativeViewGestureHandler.js.map +0 -1
  158. package/lib/module/handlers/PanGestureHandler.js +0 -92
  159. package/lib/module/handlers/PanGestureHandler.js.map +0 -1
  160. package/lib/module/handlers/TapGestureHandler.js +0 -14
  161. package/lib/module/handlers/TapGestureHandler.js.map +0 -1
  162. package/lib/module/handlers/createNativeWrapper.js +0 -57
  163. package/lib/module/handlers/createNativeWrapper.js.map +0 -1
  164. package/lib/module/handlers/gestureHandlerCommon.js +0 -15
  165. package/lib/module/handlers/gestureHandlerCommon.js.map +0 -1
  166. package/lib/module/handlers/gestures/GestureDetector.js +0 -543
  167. package/lib/module/handlers/gestures/GestureDetector.js.map +0 -1
  168. package/lib/module/init.js +0 -17
  169. package/lib/module/init.js.map +0 -1
  170. package/lib/typescript/components/GestureButtons.d.ts +0 -122
  171. package/lib/typescript/components/GestureButtons.d.ts.map +0 -1
  172. package/lib/typescript/components/GestureHandlerButton.d.ts +0 -5
  173. package/lib/typescript/components/GestureHandlerButton.d.ts.map +0 -1
  174. package/lib/typescript/components/RNGestureHandlerButton.d.ts +0 -2
  175. package/lib/typescript/components/RNGestureHandlerButton.d.ts.map +0 -1
  176. package/lib/typescript/components/touchables/GenericTouchable.d.ts +0 -68
  177. package/lib/typescript/components/touchables/GenericTouchable.d.ts.map +0 -1
  178. package/lib/typescript/components/touchables/TouchableOpacity.d.ts +0 -26
  179. package/lib/typescript/components/touchables/TouchableOpacity.d.ts.map +0 -1
  180. package/lib/typescript/components/touchables/TouchableWithoutFeedback.d.ts +0 -8
  181. package/lib/typescript/components/touchables/TouchableWithoutFeedback.d.ts.map +0 -1
  182. package/lib/typescript/components/touchables/index.d.ts +0 -4
  183. package/lib/typescript/components/touchables/index.d.ts.map +0 -1
  184. package/lib/typescript/handlers/NativeViewGestureHandler.d.ts +0 -29
  185. package/lib/typescript/handlers/NativeViewGestureHandler.d.ts.map +0 -1
  186. package/lib/typescript/handlers/PanGestureHandler.d.ts +0 -140
  187. package/lib/typescript/handlers/PanGestureHandler.d.ts.map +0 -1
  188. package/lib/typescript/handlers/TapGestureHandler.d.ts +0 -58
  189. package/lib/typescript/handlers/TapGestureHandler.d.ts.map +0 -1
  190. package/lib/typescript/handlers/createNativeWrapper.d.ts +0 -4
  191. package/lib/typescript/handlers/createNativeWrapper.d.ts.map +0 -1
  192. package/lib/typescript/handlers/gestureHandlerCommon.d.ts +0 -2
  193. package/lib/typescript/handlers/gestureHandlerCommon.d.ts.map +0 -1
  194. package/lib/typescript/handlers/gestures/GestureDetector.d.ts +0 -24
  195. package/lib/typescript/handlers/gestures/GestureDetector.d.ts.map +0 -1
  196. package/lib/typescript/init.d.ts +0 -3
  197. package/lib/typescript/init.d.ts.map +0 -1
  198. package/src/components/GestureButtons.tsx +0 -334
  199. package/src/components/GestureHandlerButton.tsx +0 -5
  200. package/src/components/RNGestureHandlerButton.tsx +0 -23
  201. package/src/components/touchables/GenericTouchable.tsx +0 -301
  202. package/src/components/touchables/TouchableOpacity.tsx +0 -76
  203. package/src/components/touchables/TouchableWithoutFeedback.tsx +0 -14
  204. package/src/components/touchables/index.ts +0 -7
  205. package/src/handlers/NativeViewGestureHandler.ts +0 -55
  206. package/src/handlers/PanGestureHandler.ts +0 -327
  207. package/src/handlers/TapGestureHandler.ts +0 -95
  208. package/src/handlers/createNativeWrapper.tsx +0 -81
  209. package/src/handlers/gestureHandlerCommon.ts +0 -15
  210. package/src/handlers/gestures/GestureDetector.tsx +0 -823
  211. 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
- {
2
- "apiType": "stageMode",
3
- "targets": [
4
- {
5
- "name": "default"
6
- }
7
- ]
1
+ {
2
+ "apiType": 'stageMode',
3
+ // "buildOption": {
4
+ // "externalNativeOptions": {
5
+ // "path": "./src/main/cpp/CMakeLists.txt",
6
+ // "arguments": "",
7
+ // "cppFlags": "",
8
+ // },
9
+ // },
10
+ "targets": [
11
+ {
12
+ "name": "default",
13
+ "runtimeOS": "HarmonyOS"
14
+ },
15
+ {
16
+ "name": "ohosTest",
17
+ }
18
+ ]
8
19
  }
@@ -1,2 +1,2 @@
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';
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';
@@ -1,3 +1,3 @@
1
- export * from "./ts"
2
- export * from "./src/main/ets/RNGestureHandlerRootView"
3
- export * from "./src/main/ets/RNGestureHandlerButton"
1
+ export * from "./ts"
2
+ export * from "./src/main/ets/RNGestureHandlerRootView"
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,11 +1,12 @@
1
- {
2
- "license": "",
3
- "author": "",
4
- "name": "rnoh-gesture-handler",
5
- "description": "",
6
- "main": "",
7
- "version": "2.12.6",
8
- "devDependencies": {
9
- "rnoh": "file:../rnoh"
10
- }
11
- }
1
+ {
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',
11
+ },
12
+ }
@@ -1,8 +1,8 @@
1
- cmake_minimum_required(VERSION 3.13)
2
- set(CMAKE_VERBOSE_MAKEFILE on)
3
-
4
- file(GLOB rnoh_gesture_handler_SRC CONFIGURE_DEPENDS *.cpp)
5
- add_library(rnoh_gesture_handler SHARED ${rnoh_gesture_handler_SRC})
6
- target_include_directories(rnoh_gesture_handler PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
7
- target_link_libraries(rnoh_gesture_handler PUBLIC rnoh)
8
-
1
+ cmake_minimum_required(VERSION 3.13)
2
+ set(CMAKE_VERBOSE_MAKEFILE on)
3
+
4
+ file(GLOB rnoh_gesture_handler_SRC CONFIGURE_DEPENDS *.cpp)
5
+ add_library(rnoh_gesture_handler SHARED ${rnoh_gesture_handler_SRC})
6
+ target_include_directories(rnoh_gesture_handler PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
7
+ target_link_libraries(rnoh_gesture_handler PUBLIC rnoh)
8
+
@@ -1,34 +1,103 @@
1
- #include "GestureHandlerPackage.h"
2
- #include "RNGestureHandlerRootViewComponentDescriptor.h"
3
- #include "RNGestureHandlerButtonComponentDescriptor.h"
4
- #include "RNGestureHandlerModule.h"
5
-
6
- using namespace rnoh;
7
- using namespace facebook;
8
-
9
- class GestureHandlerTurboModuleFactoryDelegate : public TurboModuleFactoryDelegate {
10
- public:
11
- SharedTurboModule createTurboModule(Context ctx, const std::string &name) const override {
12
- if (name == "RNGestureHandlerModule") {
13
- return std::make_shared<RNGestureHandlerModule>(ctx, name);
14
- }
15
- return nullptr;
16
- };
17
- };
18
-
19
- std::unique_ptr<TurboModuleFactoryDelegate> GestureHandlerPackage::createTurboModuleFactoryDelegate() {
20
- return std::make_unique<GestureHandlerTurboModuleFactoryDelegate>();
21
- }
22
-
23
- std::vector<react::ComponentDescriptorProvider> GestureHandlerPackage::createComponentDescriptorProviders() {
24
- return {
25
- react::concreteComponentDescriptorProvider<react::RNGestureHandlerRootViewComponentDescriptor>(),
26
- react::concreteComponentDescriptorProvider<react::RNGestureHandlerButtonComponentDescriptor>(),
27
- };
28
- }
29
-
30
- EventEmitRequestHandlers GestureHandlerPackage::createEventEmitRequestHandlers() {
31
- return {
32
- std::make_shared<react::RNGestureHandlerRootViewEventEmitRequestHandler>(),
33
- };
34
- }
1
+ #pragma once
2
+ #include "GestureHandlerPackage.h"
3
+ #include "RNOH/RNInstanceCAPI.h"
4
+ #include "RNGestureHandlerButtonComponentInstance.h"
5
+ #include "RNGestureHandlerRootViewComponentInstance.h"
6
+ #include "RNOH/ArkTSTurboModule.h"
7
+ #include "RNGestureHandlerModule.h"
8
+ #include "RNGestureHandlerButtonComponentDescriptor.h"
9
+ #include "RNGestureHandlerRootViewComponentDescriptor.h"
10
+ #include "RNGestureHandlerButtonJSIBinder.h"
11
+ #include "RNGestureHandlerRootViewJSIBinder.h"
12
+
13
+ using namespace rnoh;
14
+ using namespace facebook;
15
+
16
+ class GestureHandlerTurboModuleFactoryDelegate : public TurboModuleFactoryDelegate {
17
+ public:
18
+ SharedTurboModule createTurboModule(Context ctx, const std::string &name) const override {
19
+ if (name == "RNGestureHandlerModule") {
20
+ return std::make_shared<RNGestureHandlerModule>(ctx, name);
21
+ }
22
+ return nullptr;
23
+ };
24
+ };
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
+
52
+ std::unique_ptr<TurboModuleFactoryDelegate> GestureHandlerPackage::createTurboModuleFactoryDelegate() {
53
+ return std::make_unique<GestureHandlerTurboModuleFactoryDelegate>();
54
+ }
55
+
56
+ std::vector<react::ComponentDescriptorProvider> GestureHandlerPackage::createComponentDescriptorProviders() {
57
+ return {
58
+ react::concreteComponentDescriptorProvider<react::RNGestureHandlerRootViewComponentDescriptor>(),
59
+ react::concreteComponentDescriptorProvider<react::RNGestureHandlerButtonComponentDescriptor>(),
60
+ };
61
+ }
62
+
63
+ ComponentJSIBinderByString GestureHandlerPackage::createComponentJSIBinderByName() {
64
+ return {
65
+ {"RNGestureHandlerButton", std::make_shared<RNGestureHandlerButtonJSIBinder>()},
66
+ {"RNGestureHandlerRootView", std::make_shared<RNGestureHandlerRootViewJSIBinder>()},
67
+ };
68
+ };
69
+
70
+ EventEmitRequestHandlers GestureHandlerPackage::createEventEmitRequestHandlers() {
71
+ return {
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
+ }
98
+ };
99
+ };
100
+
101
+ std::vector<ArkTSMessageHandler::Shared> GestureHandlerPackage::createArkTSMessageHandlers() {
102
+ return {std::make_shared<ScrollLockerArkTSMessageHandler>()};
103
+ }
@@ -1,15 +1,21 @@
1
- #include "RNOH/Package.h"
2
-
3
- namespace rnoh {
4
-
5
- class GestureHandlerPackage : public Package {
6
- public:
7
- GestureHandlerPackage(Package::Context ctx) : Package(ctx) {}
8
-
9
- std::vector<facebook::react::ComponentDescriptorProvider> createComponentDescriptorProviders() override;
10
-
11
- EventEmitRequestHandlers createEventEmitRequestHandlers() override;
12
-
13
- std::unique_ptr<TurboModuleFactoryDelegate> createTurboModuleFactoryDelegate() override;
14
- };
15
- } // namespace rnoh
1
+ #pragma once
2
+ #include "RNOH/Package.h"
3
+
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
@@ -1,60 +1,36 @@
1
- #pragma once
2
-
3
- #include <react/renderer/core/ConcreteComponentDescriptor.h>
4
- #include <react/renderer/components/view/ConcreteViewShadowNode.h>
5
- #include <react/renderer/components/view/ViewShadowNode.h>
6
- #include "RNOH/ArkJS.h"
7
- #include "RNOH/EventEmitRequestHandler.h"
8
-
9
- namespace facebook {
10
- namespace react {
11
-
12
- extern const char RNGestureHandlerButtonComponentName[] = "RNGestureHandlerButton";
13
-
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
- class RNGestureHandlerButtonProps : public ViewProps {
40
- public:
41
- RNGestureHandlerButtonProps() = default;
42
-
43
- RNGestureHandlerButtonProps(const PropsParserContext &context, const RNGestureHandlerButtonProps &sourceProps, const RawProps &rawProps)
44
- : ViewProps(context, sourceProps, rawProps) {}
45
- };
46
-
47
- using RNGestureHandlerButtonShadowNode = ConcreteViewShadowNode<
48
- RNGestureHandlerButtonComponentName,
49
- RNGestureHandlerButtonProps,
50
- RNGestureHandlerButtonEventEmitter>;
51
-
52
- class RNGestureHandlerButtonComponentDescriptor final
53
- : public ConcreteComponentDescriptor<RNGestureHandlerButtonShadowNode> {
54
- public:
55
- RNGestureHandlerButtonComponentDescriptor(ComponentDescriptorParameters const &parameters)
56
- : ConcreteComponentDescriptor(parameters) {}
57
- };
58
-
59
- } // namespace react
60
- } // namespace facebook
1
+
2
+ #pragma once
3
+
4
+ // This file was generated.
5
+
6
+ #include <react/renderer/core/ConcreteComponentDescriptor.h>
7
+ #include <react/renderer/components/view/ConcreteViewShadowNode.h>
8
+ #include <react/renderer/components/view/ViewShadowNode.h>
9
+
10
+ namespace facebook {
11
+ namespace react {
12
+
13
+ extern const char RNGestureHandlerButtonComponentName[] = "RNGestureHandlerButton";
14
+
15
+ class RNGestureHandlerButtonProps : public ViewProps {
16
+ public:
17
+ RNGestureHandlerButtonProps() = default;
18
+
19
+ RNGestureHandlerButtonProps(const PropsParserContext &context, const RNGestureHandlerButtonProps &sourceProps, const RawProps &rawProps)
20
+ : ViewProps(context, sourceProps, rawProps) {}
21
+ };
22
+
23
+ using RNGestureHandlerButtonShadowNode = ConcreteViewShadowNode<
24
+ RNGestureHandlerButtonComponentName,
25
+ RNGestureHandlerButtonProps,
26
+ ViewEventEmitter>;
27
+
28
+ class RNGestureHandlerButtonComponentDescriptor final
29
+ : public ConcreteComponentDescriptor<RNGestureHandlerButtonShadowNode> {
30
+ public:
31
+ RNGestureHandlerButtonComponentDescriptor(ComponentDescriptorParameters const &parameters)
32
+ : ConcreteComponentDescriptor(parameters) {}
33
+ };
34
+
35
+ } // namespace react
36
+ } // namespace facebook
@@ -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
- #include "RNGestureHandlerModule.h"
2
- #include "RNOH/ArkTSTurboModule.h"
3
-
4
- using namespace rnoh;
5
- using namespace facebook;
6
-
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)};
17
- }
1
+
2
+ #include "RNGestureHandlerModule.h"
3
+
4
+ // This file was generated.
5
+
6
+ namespace rnoh {
7
+ using namespace facebook;
8
+
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
+ };
20
+ }
21
+
22
+ } // namespace rnoh
@@ -1,12 +1,15 @@
1
- #pragma once
2
-
3
- #include "RNOH/ArkTSTurboModule.h"
4
-
5
- namespace rnoh {
6
-
7
- class JSI_EXPORT RNGestureHandlerModule : public ArkTSTurboModule {
8
- public:
9
- RNGestureHandlerModule(const ArkTSTurboModule::Context ctx, const std::string name);
10
- };
11
-
12
- } // namespace rnoh
1
+
2
+ #pragma once
3
+
4
+ // This file was generated.
5
+
6
+ #include "RNOH/ArkTSTurboModule.h"
7
+
8
+ namespace rnoh {
9
+
10
+ class JSI_EXPORT RNGestureHandlerModule : public ArkTSTurboModule {
11
+ public:
12
+ RNGestureHandlerModule(const ArkTSTurboModule::Context ctx, const std::string name);
13
+ };
14
+
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