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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. package/harmony/gesture_handler/LICENSE +21 -0
  2. package/harmony/gesture_handler/OAT.xml +44 -0
  3. package/harmony/gesture_handler/README.OpenSource +11 -0
  4. package/harmony/gesture_handler/README.md +1 -0
  5. package/harmony/gesture_handler/build-profile.json5 +7 -7
  6. package/harmony/gesture_handler/hvigorfile.ts +2 -2
  7. package/harmony/gesture_handler/index.ets +2 -2
  8. package/harmony/gesture_handler/oh-package.json5 +13 -11
  9. package/harmony/gesture_handler/src/main/cpp/CMakeLists.txt +8 -8
  10. package/harmony/gesture_handler/src/main/cpp/GestureHandlerPackage.cpp +33 -33
  11. package/harmony/gesture_handler/src/main/cpp/GestureHandlerPackage.h +14 -14
  12. package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerButtonComponentDescriptor.h +60 -60
  13. package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerModule.cpp +17 -17
  14. package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerModule.h +11 -11
  15. package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerRootViewComponentDescriptor.h +60 -60
  16. package/harmony/gesture_handler/src/main/ets/CircularBuffer.ts +42 -42
  17. package/harmony/gesture_handler/src/main/ets/Event.ts +67 -67
  18. package/harmony/gesture_handler/src/main/ets/EventDispatcher.ts +37 -37
  19. package/harmony/gesture_handler/src/main/ets/GestureHandler.ts +663 -663
  20. package/harmony/gesture_handler/src/main/ets/GestureHandlerArkUIAdapter.ets +201 -201
  21. package/harmony/gesture_handler/src/main/ets/GestureHandlerFactory.ts +44 -44
  22. package/harmony/gesture_handler/src/main/ets/GestureHandlerOrchestrator.ts +280 -280
  23. package/harmony/gesture_handler/src/main/ets/GestureHandlerPackage.ts +22 -22
  24. package/harmony/gesture_handler/src/main/ets/GestureHandlerRegistry.ts +27 -27
  25. package/harmony/gesture_handler/src/main/ets/InteractionManager.ts +108 -108
  26. package/harmony/gesture_handler/src/main/ets/LeastSquareSolver.ts +182 -182
  27. package/harmony/gesture_handler/src/main/ets/NativeViewGestureHandler.ts +114 -114
  28. package/harmony/gesture_handler/src/main/ets/OutgoingEvent.ts +33 -33
  29. package/harmony/gesture_handler/src/main/ets/PanGestureHandler.ts +327 -327
  30. package/harmony/gesture_handler/src/main/ets/PointerTracker.ts +239 -239
  31. package/harmony/gesture_handler/src/main/ets/RNGHError.ts +4 -4
  32. package/harmony/gesture_handler/src/main/ets/RNGHLogger.ts +28 -28
  33. package/harmony/gesture_handler/src/main/ets/RNGHRootTouchHandler.ets +57 -57
  34. package/harmony/gesture_handler/src/main/ets/RNGestureHandlerButton.ets +36 -36
  35. package/harmony/gesture_handler/src/main/ets/RNGestureHandlerModule.ts +125 -125
  36. package/harmony/gesture_handler/src/main/ets/RNGestureHandlerRootView.ets +56 -55
  37. package/harmony/gesture_handler/src/main/ets/RNOHScrollLocker.ts +10 -10
  38. package/harmony/gesture_handler/src/main/ets/State.ts +46 -46
  39. package/harmony/gesture_handler/src/main/ets/TapGestureHandler.ts +205 -205
  40. package/harmony/gesture_handler/src/main/ets/Vector2D.ts +36 -36
  41. package/harmony/gesture_handler/src/main/ets/VelocityTracker.ts +98 -98
  42. package/harmony/gesture_handler/src/main/ets/View.ts +70 -70
  43. package/harmony/gesture_handler/src/main/ets/ViewRegistry.ts +42 -42
  44. package/harmony/gesture_handler/src/main/ets/pages/Index.ets +16 -16
  45. package/harmony/gesture_handler/src/main/ets/webviewability/WebviewAbility.ts +41 -41
  46. package/harmony/gesture_handler/src/main/module.json5 +6 -6
  47. package/harmony/gesture_handler/src/main/resources/base/element/color.json +7 -7
  48. package/harmony/gesture_handler/src/main/resources/base/element/string.json +15 -15
  49. package/harmony/gesture_handler/src/main/resources/base/profile/main_pages.json +5 -5
  50. package/harmony/gesture_handler/src/main/resources/en_US/element/string.json +15 -15
  51. package/harmony/gesture_handler/src/main/resources/zh_CN/element/string.json +15 -15
  52. package/harmony/gesture_handler.har +0 -0
  53. package/lib/commonjs/components/touchables/GenericTouchable.js +9 -9
  54. package/lib/commonjs/components/touchables/TouchableOpacity.js +2 -2
  55. package/lib/commonjs/handlers/createNativeWrapper.js +6 -6
  56. package/lib/commonjs/handlers/gestures/GestureDetector.js +3 -3
  57. package/lib/module/components/touchables/GenericTouchable.js +9 -9
  58. package/lib/module/components/touchables/TouchableOpacity.js +2 -2
  59. package/lib/module/handlers/createNativeWrapper.js +6 -6
  60. package/lib/module/handlers/gestures/GestureDetector.js +3 -3
  61. package/package.json +70 -70
  62. package/src/RNGestureHandlerModule.ts +6 -6
  63. package/src/components/GestureButtons.tsx +334 -334
  64. package/src/components/GestureHandlerButton.tsx +5 -5
  65. package/src/components/GestureHandlerRootView.tsx +34 -34
  66. package/src/components/RNGestureHandlerButton.tsx +23 -23
  67. package/src/components/touchables/GenericTouchable.tsx +301 -301
  68. package/src/components/touchables/TouchableOpacity.tsx +76 -76
  69. package/src/components/touchables/TouchableWithoutFeedback.tsx +14 -14
  70. package/src/components/touchables/index.ts +7 -7
  71. package/src/handlers/NativeViewGestureHandler.ts +55 -55
  72. package/src/handlers/PanGestureHandler.ts +327 -327
  73. package/src/handlers/TapGestureHandler.ts +95 -95
  74. package/src/handlers/createHandler.tsx +535 -535
  75. package/src/handlers/createNativeWrapper.tsx +81 -81
  76. package/src/handlers/gestureHandlerCommon.ts +15 -15
  77. package/src/handlers/gestures/GestureDetector.tsx +823 -823
  78. package/src/index.ts +172 -172
  79. package/src/init.ts +18 -18
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 react-native-community
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,44 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <configuration>
3
+ <oatconfig>
4
+ <licensefile>LICENSE</licensefile>
5
+ <filefilterlist>
6
+ <filefilter name="copyrightPolicyFilter" desc="Filters for compatibility,license header policies">
7
+ <filteritem type="filename" name="hvigorfile.ts" desc="hvigor构建脚本,DevEco Studio自动生成,不需要添加版权头"/>
8
+ <filteritem type="filename" name="*.json5" desc="hvigor工程配置文件,DevEco Studio自动生成,不需要添加版权头"/>
9
+ <filteritem type="filename" name="*.proto" desc="资源文件,不需要添加版权头"/>
10
+ <filteritem type="filename" name="*.json" desc="资源文件,不需要添加版权头"/>
11
+ <filteritem type="filename" name="*.test.ts" desc="测试文件,不需要添加版权头"/>
12
+ <filteritem type="filename" name="index.ets" desc="入口文件,不需要添加版权头"/>
13
+ <filteritem type="filename" name="ts.ts" desc="出口文件,不需要添加版权头"/>
14
+ <filteritem type="filepath" name="hvigorw" desc="工程模板,不修改版权头,以防有修改版权风险"/>
15
+ <filteritem type="filepath" name="hvigorw.bat" desc="工程模板,不修改版权头,以防有修改版权风险"/>
16
+ <filteritem type="filepath" name="hvigor/hvigor-wrapper.js" desc="工程模板,不修改版权头,以防有修改版权风险"/>
17
+ <filteritem type="filename" name="LICENSE" desc="工程文件,不修改版权头"/>
18
+ </filefilter>
19
+ <filefilter name="defaultPolicyFilter" desc="Filters for compatibility,license header policies">
20
+ <filteritem type="filename" name="hvigorfile.ts" desc="hvigor构建脚本,DevEco Studio自动生成,不需要添加许可证头"/>
21
+ <filteritem type="filename" name="*.json5" desc="hvigor工程配置文件,DevEco Studio自动生成,不需要添加许可证头"/>
22
+ <filteritem type="filename" name="LICENSE" desc="原三方库证书文件无需更改,因此添加过滤"/>
23
+ <filteritem type="filename" name="*.proto" desc="资源文件,不需要添加许可证头"/>
24
+ <filteritem type="filename" name="*.json" desc="资源文件,不需要添加许可证头"/>
25
+ <filteritem type="filename" name="*.test.ts" desc="测试文件,不需要添加版权头"/>
26
+ <filteritem type="filename" name="index.ets" desc="入口文件,不需要添加版权头"/>
27
+ <filteritem type="filename" name="ts.ts" desc="出口文件,不需要添加版权头"/>
28
+ <filteritem type="filepath" name="hvigorw" desc="工程模板,不修改版权头,以防有修改版权风险"/>
29
+ <filteritem type="filepath" name="hvigorw.bat" desc="工程模板,不修改版权头,以防有修改版权风险"/>
30
+ <filteritem type="filepath" name="hvigor/hvigor-wrapper.js" desc="工程模板,不修改版权头,以防有修改版权风险"/>
31
+ </filefilter>
32
+ <filefilter name="binaryFileTypePolicyFilter" desc="Filters for resources files policies">
33
+ <filteritem type="filename" name="icon.png" desc="应用图标"/>
34
+ <filteritem type="filename" name="app_icon.png" desc="应用图标"/>
35
+ <filteritem type="filename" name="warn.png" desc="页面展示图标"/>
36
+ </filefilter>
37
+ </filefilterlist>
38
+ <policylist>
39
+ <policy name="projectPolicy" desc="">
40
+ <policyitem type="license" name="MIT" path=".*" desc="license under the MIT"/>
41
+ </policy>
42
+ </policylist>
43
+ </oatconfig>
44
+ </configuration>
@@ -0,0 +1,11 @@
1
+ [
2
+ {
3
+ "Name": "react-native-gesture-handler",
4
+ "License": "MIT License",
5
+ "License File":"https://github.com/software-mansion/react-native-gesture-handler/blob/main/LICENSE",
6
+ "Version Number": "2.12.6-0.0.1",
7
+ "Owner" : ""
8
+ "Upstream URL": "https://github.com/software-mansion/react-native-gesture-handler",
9
+ "Description": "React Native Gesture Handler provides native-driven gesture management APIs for building best possible touch-based experiences in React Native."
10
+ }
11
+ ]
@@ -0,0 +1 @@
1
+ # react-native-harmony-gesture-handler
@@ -1,8 +1,8 @@
1
- {
2
- "apiType": "stageMode",
3
- "targets": [
4
- {
5
- "name": "default"
6
- }
7
- ]
1
+ {
2
+ "apiType": "stageMode",
3
+ "targets": [
4
+ {
5
+ "name": "default"
6
+ }
7
+ ]
8
8
  }
@@ -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"
1
+ export * from "./ts"
2
+ export * from "./src/main/ets/RNGestureHandlerRootView"
3
3
  export * from "./src/main/ets/RNGestureHandlerButton"
@@ -1,11 +1,13 @@
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
+ "author": "",
4
+ "name": "rnoh-gesture-handler",
5
+ "description": "",
6
+ "main": "index.ets",
7
+ "version": "2.12.6",
8
+ "devDependencies": {
9
+ },
10
+ "dependencies": {
11
+ "rnoh": "file:../rnoh"
12
+ }
13
+ }
@@ -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,34 @@
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
- };
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
34
  }
@@ -1,15 +1,15 @@
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
- };
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
15
  } // namespace rnoh
@@ -1,60 +1,60 @@
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
+ #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,17 +1,17 @@
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
+ #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,12 +1,12 @@
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
-
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
12
  } // namespace rnoh
@@ -1,60 +1,60 @@
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 RNGestureHandlerRootViewComponentName[] = "RNGestureHandlerRootView";
13
-
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
- class RNGestureHandlerRootViewProps : public ViewProps {
40
- public:
41
- RNGestureHandlerRootViewProps() = default;
42
-
43
- RNGestureHandlerRootViewProps(const PropsParserContext &context, const RNGestureHandlerRootViewProps &sourceProps, const RawProps &rawProps)
44
- : ViewProps(context, sourceProps, rawProps) {}
45
- };
46
-
47
- using RNGestureHandlerRootViewShadowNode = ConcreteViewShadowNode<
48
- RNGestureHandlerRootViewComponentName,
49
- RNGestureHandlerRootViewProps,
50
- RNGestureHandlerRootViewEventEmitter>;
51
-
52
- class RNGestureHandlerRootViewComponentDescriptor final
53
- : public ConcreteComponentDescriptor<RNGestureHandlerRootViewShadowNode> {
54
- public:
55
- RNGestureHandlerRootViewComponentDescriptor(ComponentDescriptorParameters const &parameters)
56
- : ConcreteComponentDescriptor(parameters) {}
57
- };
58
-
59
- } // namespace react
60
- } // namespace facebook
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 RNGestureHandlerRootViewComponentName[] = "RNGestureHandlerRootView";
13
+
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
+ class RNGestureHandlerRootViewProps : public ViewProps {
40
+ public:
41
+ RNGestureHandlerRootViewProps() = default;
42
+
43
+ RNGestureHandlerRootViewProps(const PropsParserContext &context, const RNGestureHandlerRootViewProps &sourceProps, const RawProps &rawProps)
44
+ : ViewProps(context, sourceProps, rawProps) {}
45
+ };
46
+
47
+ using RNGestureHandlerRootViewShadowNode = ConcreteViewShadowNode<
48
+ RNGestureHandlerRootViewComponentName,
49
+ RNGestureHandlerRootViewProps,
50
+ RNGestureHandlerRootViewEventEmitter>;
51
+
52
+ class RNGestureHandlerRootViewComponentDescriptor final
53
+ : public ConcreteComponentDescriptor<RNGestureHandlerRootViewShadowNode> {
54
+ public:
55
+ RNGestureHandlerRootViewComponentDescriptor(ComponentDescriptorParameters const &parameters)
56
+ : ConcreteComponentDescriptor(parameters) {}
57
+ };
58
+
59
+ } // namespace react
60
+ } // namespace facebook
@@ -1,42 +1,42 @@
1
- export class CircularBuffer<T> {
2
- private bufferSize: number;
3
- private buffer: T[];
4
- private index: number;
5
- private actualSize: number;
6
-
7
- constructor(size: number) {
8
- this.bufferSize = size;
9
- this.buffer = new Array<T>(size);
10
- this.index = 0;
11
- this.actualSize = 0;
12
- }
13
-
14
- public get size(): number {
15
- return this.actualSize;
16
- }
17
-
18
- public push(element: T): void {
19
- this.buffer[this.index] = element;
20
- this.index = (this.index + 1) % this.bufferSize;
21
- this.actualSize = Math.min(this.actualSize + 1, this.bufferSize);
22
- }
23
-
24
- public get(at: number): T {
25
- if (this.actualSize === this.bufferSize) {
26
- let index = (this.index + at) % this.bufferSize;
27
- if (index < 0) {
28
- index += this.bufferSize;
29
- }
30
-
31
- return this.buffer[index];
32
- } else {
33
- return this.buffer[at];
34
- }
35
- }
36
-
37
- public clear(): void {
38
- this.buffer = new Array<T>(this.bufferSize);
39
- this.index = 0;
40
- this.actualSize = 0;
41
- }
42
- }
1
+ export class CircularBuffer<T> {
2
+ private bufferSize: number;
3
+ private buffer: T[];
4
+ private index: number;
5
+ private actualSize: number;
6
+
7
+ constructor(size: number) {
8
+ this.bufferSize = size;
9
+ this.buffer = new Array<T>(size);
10
+ this.index = 0;
11
+ this.actualSize = 0;
12
+ }
13
+
14
+ public get size(): number {
15
+ return this.actualSize;
16
+ }
17
+
18
+ public push(element: T): void {
19
+ this.buffer[this.index] = element;
20
+ this.index = (this.index + 1) % this.bufferSize;
21
+ this.actualSize = Math.min(this.actualSize + 1, this.bufferSize);
22
+ }
23
+
24
+ public get(at: number): T {
25
+ if (this.actualSize === this.bufferSize) {
26
+ let index = (this.index + at) % this.bufferSize;
27
+ if (index < 0) {
28
+ index += this.bufferSize;
29
+ }
30
+
31
+ return this.buffer[index];
32
+ } else {
33
+ return this.buffer[at];
34
+ }
35
+ }
36
+
37
+ public clear(): void {
38
+ this.buffer = new Array<T>(this.bufferSize);
39
+ this.index = 0;
40
+ this.actualSize = 0;
41
+ }
42
+ }