@react-native-oh-tpl/react-native-gesture-handler 2.12.9-1 → 2.14.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 +2 -3
- package/lib/commonjs/RNGestureHandlerModule.js.map +1 -1
- package/lib/commonjs/components/GestureHandlerRootView.js +3 -3
- package/lib/commonjs/components/GestureHandlerRootView.js.map +1 -1
- package/lib/commonjs/handlers/createHandler.js +15 -18
- package/lib/commonjs/handlers/createHandler.js.map +1 -1
- package/lib/commonjs/index.js +94 -137
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/specs/NativeRNGestureHandlerModule.js +1 -2
- package/lib/commonjs/specs/NativeRNGestureHandlerModule.js.map +1 -1
- package/lib/commonjs/specs/RNGestureHandlerButtonNativeComponent.js +2 -3
- package/lib/commonjs/specs/RNGestureHandlerButtonNativeComponent.js.map +1 -1
- package/lib/commonjs/specs/RNGestureHandlerRootViewNativeComponent.js +2 -3
- 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 +12 -15
- 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 +74 -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 -6
- 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 -18
- 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 -123
- 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,123 +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
|
-
#include "RNOH/arkui/TouchEventDispatcher.h"
|
8
|
-
|
9
|
-
namespace rnoh {
|
10
|
-
class RNGestureHandlerRootViewComponentInstance
|
11
|
-
: public CppComponentInstance<facebook::react::RNGestureHandlerRootViewShadowNode>,
|
12
|
-
public TouchEventHandler {
|
13
|
-
private:
|
14
|
-
StackNode m_stackNode;
|
15
|
-
|
16
|
-
public:
|
17
|
-
RNGestureHandlerRootViewComponentInstance(Context context) : CppComponentInstance(std::move(context)) {
|
18
|
-
ArkUINodeRegistry::getInstance().registerTouchHandler(&m_stackNode, this);
|
19
|
-
NativeNodeApi::getInstance()->registerNodeEvent(m_stackNode.getArkUINodeHandle(), NODE_TOUCH_EVENT, 0, nullptr);
|
20
|
-
m_deps->arkTSChannel->postMessage("RNGH::ROOT_CREATED", m_tag);
|
21
|
-
};
|
22
|
-
|
23
|
-
~RNGestureHandlerRootViewComponentInstance() {
|
24
|
-
ArkUINodeRegistry::getInstance().unregisterTouchHandler(&m_stackNode);
|
25
|
-
NativeNodeApi::getInstance()->unregisterNodeEvent(m_stackNode.getArkUINodeHandle(), NODE_TOUCH_EVENT);
|
26
|
-
}
|
27
|
-
|
28
|
-
StackNode &getLocalRootArkUINode() override { return m_stackNode; };
|
29
|
-
|
30
|
-
void onTouchEvent(ArkUI_UIInputEvent *e) override {
|
31
|
-
folly::dynamic payload = folly::dynamic::object;
|
32
|
-
payload["action"] = static_cast<int>(OH_ArkUI_UIInputEvent_GetAction(e));
|
33
|
-
payload["actionTouch"] = this->convertNodeTouchPointToDynamic(getActiveTouchFromEvent(e));
|
34
|
-
folly::dynamic touchPoints = folly::dynamic::array();
|
35
|
-
touchPoints.push_back(this->convertNodeTouchPointToDynamic(getActiveTouchFromEvent(e)));
|
36
|
-
payload["touchPoints"] = touchPoints;
|
37
|
-
payload["sourceType"] = static_cast<int>(OH_ArkUI_UIInputEvent_GetSourceType(e));
|
38
|
-
payload["timestamp"] = OH_ArkUI_UIInputEvent_GetEventTime(e);
|
39
|
-
payload["rootTag"] = m_tag;
|
40
|
-
m_deps->arkTSChannel->postMessage("RNGH::TOUCH_EVENT", payload);
|
41
|
-
}
|
42
|
-
|
43
|
-
private:
|
44
|
-
struct TouchPoint {
|
45
|
-
int32_t contactAreaHeight;
|
46
|
-
int32_t contactAreaWidth;
|
47
|
-
int32_t id;
|
48
|
-
int32_t nodeX;
|
49
|
-
int32_t nodeY;
|
50
|
-
int64_t pressedTime;
|
51
|
-
double pressure;
|
52
|
-
int32_t rawX;
|
53
|
-
int32_t rawY;
|
54
|
-
int32_t screenX;
|
55
|
-
int32_t screenY;
|
56
|
-
double tiltX;
|
57
|
-
double tiltY;
|
58
|
-
int32_t toolHeight;
|
59
|
-
int32_t toolWidth;
|
60
|
-
int32_t toolX;
|
61
|
-
int32_t toolY;
|
62
|
-
int32_t toolType;
|
63
|
-
int32_t windowX;
|
64
|
-
int32_t windowY;
|
65
|
-
};
|
66
|
-
|
67
|
-
TouchPoint getActiveTouchFromEvent(ArkUI_UIInputEvent *event) {
|
68
|
-
TouchPoint actionTouch{};
|
69
|
-
actionTouch = TouchPoint{
|
70
|
-
.contactAreaHeight = int32_t(OH_ArkUI_PointerEvent_GetTouchAreaHeight(event, 0)),
|
71
|
-
.contactAreaWidth = int32_t(OH_ArkUI_PointerEvent_GetTouchAreaWidth(event, 0)),
|
72
|
-
.id = OH_ArkUI_PointerEvent_GetPointerId(event, 0),
|
73
|
-
.nodeX = int32_t(OH_ArkUI_PointerEvent_GetX(event)),
|
74
|
-
.nodeY = int32_t(OH_ArkUI_PointerEvent_GetY(event)),
|
75
|
-
.pressure = double(OH_ArkUI_PointerEvent_GetPressure(event, 0)),
|
76
|
-
.screenX = int32_t(OH_ArkUI_PointerEvent_GetDisplayX(event)),
|
77
|
-
.screenY = int32_t(OH_ArkUI_PointerEvent_GetDisplayY(event)),
|
78
|
-
.tiltX = double(OH_ArkUI_PointerEvent_GetTiltX(event, 0)),
|
79
|
-
.tiltY = double(OH_ArkUI_PointerEvent_GetTiltX(event, 0)),
|
80
|
-
.toolType = int32_t(OH_ArkUI_UIInputEvent_GetToolType(event)),
|
81
|
-
.windowX = int32_t(OH_ArkUI_PointerEvent_GetWindowX(event)),
|
82
|
-
.windowY = int32_t(OH_ArkUI_PointerEvent_GetWindowY(event)),
|
83
|
-
};
|
84
|
-
return actionTouch;
|
85
|
-
}
|
86
|
-
|
87
|
-
folly::dynamic convertNodeTouchPointToDynamic(TouchPoint actionTouch) {
|
88
|
-
folly::dynamic result = folly::dynamic::object;
|
89
|
-
result["contactAreaHeight"] = actionTouch.contactAreaHeight;
|
90
|
-
result["contactAreaWidth"] = actionTouch.contactAreaWidth;
|
91
|
-
result["id"] = actionTouch.id;
|
92
|
-
result["nodeX"] = actionTouch.nodeX;
|
93
|
-
result["nodeY"] = actionTouch.nodeY;
|
94
|
-
// result["pressedTime"] = actionTouch.pressedTime;
|
95
|
-
result["pressure"] = actionTouch.pressure;
|
96
|
-
// result["rawX"] = actionTouch.rawX;
|
97
|
-
// result["rawY"] = actionTouch.rawY;
|
98
|
-
result["screenX"] = actionTouch.screenX;
|
99
|
-
result["screenY"] = actionTouch.screenY;
|
100
|
-
result["tiltX"] = actionTouch.tiltX;
|
101
|
-
result["tiltY"] = actionTouch.tiltY;
|
102
|
-
// result["toolHeight"] = actionTouch.toolHeight;
|
103
|
-
// result["toolWidth"] = actionTouch.toolWidth;
|
104
|
-
// result["toolX"] = actionTouch.toolX;
|
105
|
-
// result["toolY"] = actionTouch.toolY;
|
106
|
-
result["toolType"] = static_cast<int>(actionTouch.toolType);
|
107
|
-
result["windowX"] = actionTouch.windowX;
|
108
|
-
result["windowY"] = actionTouch.windowY;
|
109
|
-
return result;
|
110
|
-
}
|
111
|
-
|
112
|
-
protected:
|
113
|
-
void onChildInserted(ComponentInstance::Shared const &childComponentInstance, std::size_t index) override {
|
114
|
-
CppComponentInstance::onChildInserted(childComponentInstance, index);
|
115
|
-
m_stackNode.insertChild(childComponentInstance->getLocalRootArkUINode(), index);
|
116
|
-
};
|
117
|
-
|
118
|
-
void onChildRemoved(ComponentInstance::Shared const &childComponentInstance) override {
|
119
|
-
CppComponentInstance::onChildRemoved(childComponentInstance);
|
120
|
-
m_stackNode.removeChild(childComponentInstance->getLocalRootArkUINode());
|
121
|
-
};
|
122
|
-
};
|
123
|
-
} // namespace rnoh
|
@@ -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
|
-
}
|