@react-native-oh-tpl/react-native-gesture-handler 2.12.9 → 2.14.4-1
Sign up to get free protection for your applications and to get access to all the features.
- package/DrawerLayout/index.ts +2 -0
- package/Swipeable/index.ts +2 -0
- package/harmony/gesture_handler.har +0 -0
- package/lib/commonjs/RNGestureHandlerModule.js.map +1 -1
- package/lib/commonjs/components/GestureHandlerRootView.js.map +1 -1
- package/lib/commonjs/handlers/createHandler.js.map +1 -1
- package/lib/commonjs/index.js +91 -137
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/specs/NativeRNGestureHandlerModule.js.map +1 -1
- package/lib/commonjs/specs/RNGestureHandlerButtonNativeComponent.js.map +1 -1
- package/lib/commonjs/specs/RNGestureHandlerRootViewNativeComponent.js.map +1 -1
- package/lib/module/RNGestureHandlerModule.js.map +1 -1
- package/lib/module/components/GestureHandlerRootView.js.map +1 -1
- package/lib/module/handlers/createHandler.js.map +1 -1
- package/lib/module/index.js +10 -141
- package/lib/module/index.js.map +1 -1
- package/lib/module/specs/NativeRNGestureHandlerModule.js.map +1 -1
- package/lib/module/specs/RNGestureHandlerButtonNativeComponent.js.map +1 -1
- package/lib/module/specs/RNGestureHandlerRootViewNativeComponent.js.map +1 -1
- package/lib/typescript/RNGestureHandlerModule.d.ts +2 -2
- package/lib/typescript/components/GestureHandlerRootView.d.ts +6 -6
- package/lib/typescript/handlers/createHandler.d.ts +11 -11
- package/lib/typescript/index.d.ts +42 -9
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/specs/NativeRNGestureHandlerModule.d.ts +14 -14
- package/lib/typescript/specs/RNGestureHandlerButtonNativeComponent.d.ts +14 -14
- package/lib/typescript/specs/RNGestureHandlerRootViewNativeComponent.d.ts +6 -6
- package/package.json +69 -66
- package/src/RNGestureHandlerModule.ts +4 -4
- package/src/components/GestureHandlerRootView.tsx +23 -23
- package/src/handlers/createHandler.tsx +534 -534
- package/src/index.ts +172 -172
- package/src/specs/NativeRNGestureHandlerModule.ts +26 -26
- package/src/specs/RNGestureHandlerButtonNativeComponent.ts +18 -18
- package/src/specs/RNGestureHandlerRootViewNativeComponent.ts +6 -6
- package/harmony/gesture_handler/BuildProfile.ets +0 -5
- package/harmony/gesture_handler/build-profile.json5 +0 -19
- package/harmony/gesture_handler/hvigorfile.ts +0 -2
- package/harmony/gesture_handler/index.ets +0 -3
- package/harmony/gesture_handler/oh-package-lock.json5 +0 -17
- package/harmony/gesture_handler/oh-package.json5 +0 -12
- package/harmony/gesture_handler/src/main/cpp/CMakeLists.txt +0 -8
- package/harmony/gesture_handler/src/main/cpp/GestureHandlerPackage.cpp +0 -103
- package/harmony/gesture_handler/src/main/cpp/GestureHandlerPackage.h +0 -21
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerButtonComponentDescriptor.h +0 -36
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerButtonComponentInstance.h +0 -27
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerButtonJSIBinder.h +0 -32
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerModule.cpp +0 -22
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerModule.h +0 -15
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerPackage.h +0 -72
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerRootViewComponentDescriptor.h +0 -36
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerRootViewComponentInstance.h +0 -78
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerRootViewJSIBinder.h +0 -25
- package/harmony/gesture_handler/src/main/ets/CircularBuffer.ts +0 -42
- package/harmony/gesture_handler/src/main/ets/Event.ts +0 -68
- package/harmony/gesture_handler/src/main/ets/EventDispatcher.ts +0 -53
- package/harmony/gesture_handler/src/main/ets/GestureHandler.ts +0 -663
- package/harmony/gesture_handler/src/main/ets/GestureHandlerArkUIAdapter.ts +0 -203
- package/harmony/gesture_handler/src/main/ets/GestureHandlerFactory.ts +0 -45
- package/harmony/gesture_handler/src/main/ets/GestureHandlerOrchestrator.ts +0 -280
- package/harmony/gesture_handler/src/main/ets/GestureHandlerPackage.ts +0 -22
- package/harmony/gesture_handler/src/main/ets/GestureHandlerRegistry.ts +0 -28
- package/harmony/gesture_handler/src/main/ets/InteractionManager.ts +0 -109
- package/harmony/gesture_handler/src/main/ets/LeastSquareSolver.ts +0 -182
- package/harmony/gesture_handler/src/main/ets/NativeViewGestureHandler.ts +0 -115
- package/harmony/gesture_handler/src/main/ets/OutgoingEvent.ts +0 -34
- package/harmony/gesture_handler/src/main/ets/PanGestureHandler.ts +0 -328
- package/harmony/gesture_handler/src/main/ets/PointerTracker.ts +0 -239
- package/harmony/gesture_handler/src/main/ets/RNGHError.ts +0 -5
- package/harmony/gesture_handler/src/main/ets/RNGHLogger.ts +0 -48
- package/harmony/gesture_handler/src/main/ets/RNGHRootTouchHandlerArkTS.ts +0 -60
- package/harmony/gesture_handler/src/main/ets/RNGHRootTouchHandlerCAPI.ts +0 -87
- package/harmony/gesture_handler/src/main/ets/RNGestureHandlerButton.ets +0 -38
- package/harmony/gesture_handler/src/main/ets/RNGestureHandlerModule.ts +0 -183
- package/harmony/gesture_handler/src/main/ets/RNGestureHandlerRootView.ets +0 -53
- package/harmony/gesture_handler/src/main/ets/RNOHScrollLocker.ts +0 -23
- package/harmony/gesture_handler/src/main/ets/State.ts +0 -47
- package/harmony/gesture_handler/src/main/ets/TapGestureHandler.ts +0 -206
- package/harmony/gesture_handler/src/main/ets/Vector2D.ts +0 -36
- package/harmony/gesture_handler/src/main/ets/VelocityTracker.ts +0 -98
- package/harmony/gesture_handler/src/main/ets/View.ts +0 -71
- package/harmony/gesture_handler/src/main/ets/ViewRegistry.ts +0 -43
- package/harmony/gesture_handler/src/main/ets/namespace/RNGestureHandlerButton.ts +0 -140
- package/harmony/gesture_handler/src/main/ets/namespace/RNGestureHandlerModule.ts +0 -25
- package/harmony/gesture_handler/src/main/ets/namespace/RNGestureHandlerRootView.ts +0 -101
- package/harmony/gesture_handler/src/main/ets/namespace/ts.ts +0 -3
- package/harmony/gesture_handler/src/main/ets/pages/Index.ets +0 -17
- package/harmony/gesture_handler/src/main/ets/types.ts +0 -25
- package/harmony/gesture_handler/src/main/ets/webviewability/WebviewAbility.ts +0 -41
- package/harmony/gesture_handler/src/main/module.json5 +0 -7
- package/harmony/gesture_handler/src/main/resources/base/element/color.json +0 -8
- package/harmony/gesture_handler/src/main/resources/base/element/string.json +0 -16
- package/harmony/gesture_handler/src/main/resources/base/media/icon.png +0 -0
- package/harmony/gesture_handler/src/main/resources/base/profile/main_pages.json +0 -5
- package/harmony/gesture_handler/src/main/resources/en_US/element/string.json +0 -16
- package/harmony/gesture_handler/src/main/resources/zh_CN/element/string.json +0 -16
- package/harmony/gesture_handler/ts.ts +0 -2
@@ -1,21 +0,0 @@
|
|
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,36 +0,0 @@
|
|
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 ¶meters)
|
32
|
-
: ConcreteComponentDescriptor(parameters) {}
|
33
|
-
};
|
34
|
-
|
35
|
-
} // namespace react
|
36
|
-
} // namespace facebook
|
@@ -1,27 +0,0 @@
|
|
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
|
@@ -1,32 +0,0 @@
|
|
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,22 +0,0 @@
|
|
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,15 +0,0 @@
|
|
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
|
@@ -1,72 +0,0 @@
|
|
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,36 +0,0 @@
|
|
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 RNGestureHandlerRootViewComponentName[] = "RNGestureHandlerRootView";
|
14
|
-
|
15
|
-
class RNGestureHandlerRootViewProps : public ViewProps {
|
16
|
-
public:
|
17
|
-
RNGestureHandlerRootViewProps() = default;
|
18
|
-
|
19
|
-
RNGestureHandlerRootViewProps(const PropsParserContext &context, const RNGestureHandlerRootViewProps &sourceProps, const RawProps &rawProps)
|
20
|
-
: ViewProps(context, sourceProps, rawProps) {}
|
21
|
-
};
|
22
|
-
|
23
|
-
using RNGestureHandlerRootViewShadowNode = ConcreteViewShadowNode<
|
24
|
-
RNGestureHandlerRootViewComponentName,
|
25
|
-
RNGestureHandlerRootViewProps,
|
26
|
-
ViewEventEmitter>;
|
27
|
-
|
28
|
-
class RNGestureHandlerRootViewComponentDescriptor final
|
29
|
-
: public ConcreteComponentDescriptor<RNGestureHandlerRootViewShadowNode> {
|
30
|
-
public:
|
31
|
-
RNGestureHandlerRootViewComponentDescriptor(ComponentDescriptorParameters const ¶meters)
|
32
|
-
: ConcreteComponentDescriptor(parameters) {}
|
33
|
-
};
|
34
|
-
|
35
|
-
} // namespace react
|
36
|
-
} // namespace facebook
|
@@ -1,78 +0,0 @@
|
|
1
|
-
#pragma once
|
2
|
-
#import "RNOH/CppComponentInstance.h"
|
3
|
-
#import "RNOH/arkui/StackNode.h"
|
4
|
-
#import "RNOH/arkui/ArkUINodeRegistry.h"
|
5
|
-
#import "RNOH/arkui/NativeNodeApi.h"
|
6
|
-
#import "RNGestureHandlerRootViewComponentDescriptor.h"
|
7
|
-
|
8
|
-
namespace rnoh {
|
9
|
-
class RNGestureHandlerRootViewComponentInstance
|
10
|
-
: public CppComponentInstance<facebook::react::RNGestureHandlerRootViewShadowNode>,
|
11
|
-
public TouchEventHandler {
|
12
|
-
private:
|
13
|
-
StackNode m_stackNode;
|
14
|
-
|
15
|
-
public:
|
16
|
-
RNGestureHandlerRootViewComponentInstance(Context context) : CppComponentInstance(std::move(context)) {
|
17
|
-
ArkUINodeRegistry::getInstance().registerTouchHandler(&m_stackNode, this);
|
18
|
-
NativeNodeApi::getInstance()->registerNodeEvent(m_stackNode.getArkUINodeHandle(), NODE_TOUCH_EVENT, 0);
|
19
|
-
m_deps->arkTSChannel->postMessage("RNGH::ROOT_CREATED", m_tag);
|
20
|
-
};
|
21
|
-
|
22
|
-
~RNGestureHandlerRootViewComponentInstance() {
|
23
|
-
ArkUINodeRegistry::getInstance().unregisterTouchHandler(&m_stackNode);
|
24
|
-
NativeNodeApi::getInstance()->unregisterNodeEvent(m_stackNode.getArkUINodeHandle(), NODE_TOUCH_EVENT);
|
25
|
-
}
|
26
|
-
|
27
|
-
StackNode &getLocalRootArkUINode() override { return m_stackNode; };
|
28
|
-
|
29
|
-
void onTouchEvent(ArkUI_NodeTouchEvent e) override {
|
30
|
-
folly::dynamic payload = folly::dynamic::object;
|
31
|
-
payload["action"] = static_cast<int>(e.action);
|
32
|
-
payload["actionTouch"] = this->convertNodeTouchPointToDynamic(e.actionTouch);
|
33
|
-
folly::dynamic touchPoints = folly::dynamic::array();
|
34
|
-
touchPoints.push_back(this->convertNodeTouchPointToDynamic(e.actionTouch));
|
35
|
-
payload["touchPoints"] = touchPoints;
|
36
|
-
payload["sourceType"] = static_cast<int>(e.sourceType);
|
37
|
-
payload["timestamp"] = e.timeStamp;
|
38
|
-
payload["rootTag"] = m_tag;
|
39
|
-
m_deps->arkTSChannel->postMessage("RNGH::TOUCH_EVENT", payload);
|
40
|
-
}
|
41
|
-
private:
|
42
|
-
folly::dynamic convertNodeTouchPointToDynamic(ArkUI_NodeTouchPoint actionTouch) {
|
43
|
-
folly::dynamic result = folly::dynamic::object;
|
44
|
-
result["contactAreaHeight"] = actionTouch.contactAreaHeight;
|
45
|
-
result["contactAreaWidth"] = actionTouch.contactAreaWidth;
|
46
|
-
result["id"] = actionTouch.id;
|
47
|
-
result["nodeX"] = actionTouch.nodeX;
|
48
|
-
result["nodeY"] = actionTouch.nodeY;
|
49
|
-
result["pressedTime"] = actionTouch.pressedTime;
|
50
|
-
result["pressure"] = actionTouch.pressure;
|
51
|
-
result["rawX"] = actionTouch.rawX;
|
52
|
-
result["rawY"] = actionTouch.rawY;
|
53
|
-
result["screenX"] = actionTouch.screenX;
|
54
|
-
result["screenY"] = actionTouch.screenY;
|
55
|
-
result["tiltX"] = actionTouch.tiltX;
|
56
|
-
result["tiltY"] = actionTouch.tiltY;
|
57
|
-
result["toolHeight"] = actionTouch.toolHeight;
|
58
|
-
result["toolWidth"] = actionTouch.toolWidth;
|
59
|
-
result["toolX"] = actionTouch.toolX;
|
60
|
-
result["toolY"] = actionTouch.toolY;
|
61
|
-
result["toolType"] = static_cast<int>(actionTouch.toolType);
|
62
|
-
result["windowX"] = actionTouch.windowX;
|
63
|
-
result["windowY"] = actionTouch.windowY;
|
64
|
-
return result;
|
65
|
-
}
|
66
|
-
|
67
|
-
protected:
|
68
|
-
void onChildInserted(ComponentInstance::Shared const &childComponentInstance, std::size_t index) override {
|
69
|
-
CppComponentInstance::onChildInserted(childComponentInstance, index);
|
70
|
-
m_stackNode.insertChild(childComponentInstance->getLocalRootArkUINode(), index);
|
71
|
-
};
|
72
|
-
|
73
|
-
void onChildRemoved(ComponentInstance::Shared const &childComponentInstance) override {
|
74
|
-
CppComponentInstance::onChildRemoved(childComponentInstance);
|
75
|
-
m_stackNode.removeChild(childComponentInstance->getLocalRootArkUINode());
|
76
|
-
};
|
77
|
-
};
|
78
|
-
} // namespace rnoh
|
@@ -1,25 +0,0 @@
|
|
1
|
-
#pragma once
|
2
|
-
|
3
|
-
// This file was generated.
|
4
|
-
|
5
|
-
#include "RNOHCorePackage/ComponentBinders/ViewComponentJSIBinder.h"
|
6
|
-
|
7
|
-
namespace rnoh {
|
8
|
-
class RNGestureHandlerRootViewJSIBinder : public ViewComponentJSIBinder {
|
9
|
-
protected:
|
10
|
-
facebook::jsi::Object createNativeProps(facebook::jsi::Runtime &rt) override {
|
11
|
-
auto object = ViewComponentJSIBinder::createNativeProps(rt);
|
12
|
-
return object;
|
13
|
-
}
|
14
|
-
|
15
|
-
facebook::jsi::Object createBubblingEventTypes(facebook::jsi::Runtime &rt) override {
|
16
|
-
facebook::jsi::Object events(rt);
|
17
|
-
return events;
|
18
|
-
}
|
19
|
-
|
20
|
-
facebook::jsi::Object createDirectEventTypes(facebook::jsi::Runtime &rt) override {
|
21
|
-
facebook::jsi::Object events(rt);
|
22
|
-
return events;
|
23
|
-
}
|
24
|
-
};
|
25
|
-
} // namespace rnoh
|
@@ -1,42 +0,0 @@
|
|
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,68 +0,0 @@
|
|
1
|
-
export interface HitSlop {
|
2
|
-
left?: number;
|
3
|
-
right?: number;
|
4
|
-
top?: number;
|
5
|
-
bottom?: number;
|
6
|
-
horizontal?: number;
|
7
|
-
vertical?: number;
|
8
|
-
width?: number;
|
9
|
-
height?: number;
|
10
|
-
}
|
11
|
-
|
12
|
-
export const Directions = {
|
13
|
-
RIGHT: 1,
|
14
|
-
LEFT: 2,
|
15
|
-
UP: 4,
|
16
|
-
DOWN: 8,
|
17
|
-
} as const;
|
18
|
-
|
19
|
-
export enum PointerType {
|
20
|
-
NONE = 'none',
|
21
|
-
MOUSE = 'mouse',
|
22
|
-
TOUCH = 'touch',
|
23
|
-
PEN = 'pen',
|
24
|
-
}
|
25
|
-
|
26
|
-
export enum EventType {
|
27
|
-
DOWN,
|
28
|
-
ADDITIONAL_POINTER_DOWN,
|
29
|
-
UP,
|
30
|
-
ADDITIONAL_POINTER_UP,
|
31
|
-
MOVE,
|
32
|
-
ENTER,
|
33
|
-
OUT,
|
34
|
-
CANCEL,
|
35
|
-
}
|
36
|
-
|
37
|
-
export type Touch = {id: number, x: number, y: number, absoluteX: number, absoluteY: number}
|
38
|
-
|
39
|
-
export enum TouchEventType {
|
40
|
-
UNDETERMINED = 0,
|
41
|
-
DOWN = 1,
|
42
|
-
MOVE = 2,
|
43
|
-
UP = 3,
|
44
|
-
CANCELLED = 4,
|
45
|
-
}
|
46
|
-
|
47
|
-
export interface AdaptedEvent {
|
48
|
-
x: number;
|
49
|
-
y: number;
|
50
|
-
offsetX: number;
|
51
|
-
offsetY: number;
|
52
|
-
pointerId: number;
|
53
|
-
eventType: EventType;
|
54
|
-
pointerType: PointerType;
|
55
|
-
buttons: number;
|
56
|
-
time: number;
|
57
|
-
allTouches?: Touch[];
|
58
|
-
changedTouches?: Touch[];
|
59
|
-
touchEventType?: TouchEventType;
|
60
|
-
}
|
61
|
-
|
62
|
-
export interface TrackerElement {
|
63
|
-
lastX: number;
|
64
|
-
lastY: number;
|
65
|
-
timeStamp: number;
|
66
|
-
velocityX: number;
|
67
|
-
velocityY: number;
|
68
|
-
}
|
@@ -1,53 +0,0 @@
|
|
1
|
-
import { RNInstance } from "@rnoh/react-native-openharmony/ts"
|
2
|
-
import { GestureStateChangeEvent, GestureUpdateEvent, GestureTouchEvent } from "./OutgoingEvent"
|
3
|
-
import { RNGHLogger } from './RNGHLogger'
|
4
|
-
|
5
|
-
export interface EventDispatcher {
|
6
|
-
onGestureHandlerStateChange(event: GestureStateChangeEvent): void
|
7
|
-
onGestureHandlerEvent(event: GestureStateChangeEvent | GestureUpdateEvent | GestureTouchEvent): void
|
8
|
-
}
|
9
|
-
|
10
|
-
export class JSEventDispatcher implements EventDispatcher {
|
11
|
-
constructor(private rnInstance: RNInstance, private logger: RNGHLogger) {
|
12
|
-
}
|
13
|
-
|
14
|
-
public onGestureHandlerStateChange(event: GestureStateChangeEvent) {
|
15
|
-
this.logger.info(`onGestureHandlerStateChange`)
|
16
|
-
this.rnInstance.emitDeviceEvent("onGestureHandlerStateChange", event)
|
17
|
-
}
|
18
|
-
|
19
|
-
public onGestureHandlerEvent(event: GestureStateChangeEvent | GestureUpdateEvent | GestureTouchEvent) {
|
20
|
-
this.logger.info(`onGestureHandlerEvent`)
|
21
|
-
this.rnInstance.emitDeviceEvent("onGestureHandlerEvent", event)
|
22
|
-
}
|
23
|
-
}
|
24
|
-
|
25
|
-
export class AnimatedEventDispatcher implements EventDispatcher {
|
26
|
-
constructor(private rnInstance: RNInstance, private logger: RNGHLogger, private viewTag: number) {
|
27
|
-
}
|
28
|
-
|
29
|
-
public onGestureHandlerStateChange(event: GestureStateChangeEvent) {
|
30
|
-
this.logger.info(`onGestureHandlerStateChange`)
|
31
|
-
this.rnInstance.emitDeviceEvent("onGestureHandlerStateChange", event)
|
32
|
-
}
|
33
|
-
|
34
|
-
public onGestureHandlerEvent(event: GestureStateChangeEvent | GestureUpdateEvent | GestureTouchEvent) {
|
35
|
-
this.logger.info(`onGestureHandlerEvent`)
|
36
|
-
this.rnInstance.emitComponentEvent(this.viewTag, "onGestureHandlerEvent", event)
|
37
|
-
}
|
38
|
-
}
|
39
|
-
|
40
|
-
export class ReanimatedEventDispatcher implements EventDispatcher {
|
41
|
-
constructor(private rnInstance: RNInstance, private logger: RNGHLogger, private viewTag: number) {
|
42
|
-
}
|
43
|
-
|
44
|
-
public onGestureHandlerStateChange(event: GestureStateChangeEvent) {
|
45
|
-
this.logger.info(`onGestureHandlerStateChange`)
|
46
|
-
this.rnInstance.emitComponentEvent(this.viewTag, "onGestureHandlerStateChange", event)
|
47
|
-
}
|
48
|
-
|
49
|
-
public onGestureHandlerEvent(event: GestureStateChangeEvent | GestureUpdateEvent | GestureTouchEvent) {
|
50
|
-
this.logger.info(`onGestureHandlerEvent`)
|
51
|
-
this.rnInstance.emitComponentEvent(this.viewTag, "onGestureHandlerEvent", event)
|
52
|
-
}
|
53
|
-
}
|