@react-native-ohos/react-native-keyboard-controller 1.12.8-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.OpenSource +11 -0
- package/README.md +19 -0
- package/harmony/keyboard_controller/BuildProfile.ets +17 -0
- package/harmony/keyboard_controller/Index.ets +9 -0
- package/harmony/keyboard_controller/ResourceTable.txt +9 -0
- package/harmony/keyboard_controller/build-profile.json5 +31 -0
- package/harmony/keyboard_controller/consumer-rules.txt +0 -0
- package/harmony/keyboard_controller/hvigorfile.ts +6 -0
- package/harmony/keyboard_controller/obfuscation-rules.txt +18 -0
- package/harmony/keyboard_controller/oh-package.json5 +11 -0
- package/harmony/keyboard_controller/src/main/cpp/CMakeLists.txt +7 -0
- package/harmony/keyboard_controller/src/main/cpp/EventEmitters.cpp +96 -0
- package/harmony/keyboard_controller/src/main/cpp/EventEmitters.h +90 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewComponentDescriptor.h +77 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewComponentInstance.cpp +158 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewComponentInstance.h +74 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewJSIBinder.h +43 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaComponentDescriptor.h +64 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaComponentInstance.cpp +89 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaComponentInstance.h +63 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaJSIBinder.h +39 -0
- package/harmony/keyboard_controller/src/main/cpp/RNKeyboardController.cpp +25 -0
- package/harmony/keyboard_controller/src/main/cpp/RNKeyboardController.h +27 -0
- package/harmony/keyboard_controller/src/main/cpp/RNKeyboardControllerPackage.cpp +43 -0
- package/harmony/keyboard_controller/src/main/cpp/RNKeyboardControllerPackage.h +56 -0
- package/harmony/keyboard_controller/src/main/cpp/RNStatusBarManagerCompat.cpp +24 -0
- package/harmony/keyboard_controller/src/main/cpp/RNStatusBarManagerCompat.h +28 -0
- package/harmony/keyboard_controller/src/main/cpp/keyboardControllerPackage.cpp +43 -0
- package/harmony/keyboard_controller/src/main/cpp/keyboardControllerPackage.h +56 -0
- package/harmony/keyboard_controller/src/main/ets/Logger.ts +46 -0
- package/harmony/keyboard_controller/src/main/ets/RNKeyboardControllerPackage.ets +46 -0
- package/harmony/keyboard_controller/src/main/ets/RNKeyboardControllerTurboModule.ts +210 -0
- package/harmony/keyboard_controller/src/main/ets/RNStatusBarManagerCompatTurboModule.ts +98 -0
- package/harmony/keyboard_controller/src/main/ets/Type.ts +41 -0
- package/harmony/keyboard_controller/src/main/module.json +29 -0
- package/harmony/keyboard_controller/src/main/module.json5 +11 -0
- package/harmony/keyboard_controller/src/main/resources/base/element/string.json +8 -0
- package/harmony/keyboard_controller/src/main/resources/en_US/element/string.json +8 -0
- package/harmony/keyboard_controller/src/main/resources/zh_CN/element/string.json +8 -0
- package/harmony/keyboard_controller/ts.ets +9 -0
- package/harmony/keyboard_controller.har +0 -0
- package/lib/commonjs/animated.js +174 -0
- package/lib/commonjs/animated.js.map +1 -0
- package/lib/commonjs/bindings.js +38 -0
- package/lib/commonjs/bindings.js.map +1 -0
- package/lib/commonjs/bindings.native.js +37 -0
- package/lib/commonjs/bindings.native.js.map +1 -0
- package/lib/commonjs/components/KeyboardAvoidingView/hooks.js +66 -0
- package/lib/commonjs/components/KeyboardAvoidingView/hooks.js.map +1 -0
- package/lib/commonjs/components/KeyboardAvoidingView/index.js +102 -0
- package/lib/commonjs/components/KeyboardAvoidingView/index.js.map +1 -0
- package/lib/commonjs/components/KeyboardAwareScrollView/index.js +255 -0
- package/lib/commonjs/components/KeyboardAwareScrollView/index.js.map +1 -0
- package/lib/commonjs/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js +110 -0
- package/lib/commonjs/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js.map +1 -0
- package/lib/commonjs/components/KeyboardAwareScrollView/utils.js +37 -0
- package/lib/commonjs/components/KeyboardAwareScrollView/utils.js.map +1 -0
- package/lib/commonjs/components/KeyboardStickyView/index.js +40 -0
- package/lib/commonjs/components/KeyboardStickyView/index.js.map +1 -0
- package/lib/commonjs/components/KeyboardToolbar/Arrow.js +76 -0
- package/lib/commonjs/components/KeyboardToolbar/Arrow.js.map +1 -0
- package/lib/commonjs/components/KeyboardToolbar/Button.js +70 -0
- package/lib/commonjs/components/KeyboardToolbar/Button.js.map +1 -0
- package/lib/commonjs/components/KeyboardToolbar/colors.js +21 -0
- package/lib/commonjs/components/KeyboardToolbar/colors.js.map +1 -0
- package/lib/commonjs/components/KeyboardToolbar/colors.native.js +40 -0
- package/lib/commonjs/components/KeyboardToolbar/colors.native.js.map +1 -0
- package/lib/commonjs/components/KeyboardToolbar/index.js +152 -0
- package/lib/commonjs/components/KeyboardToolbar/index.js.map +1 -0
- package/lib/commonjs/components/KeyboardToolbar/types.js +6 -0
- package/lib/commonjs/components/KeyboardToolbar/types.js.map +1 -0
- package/lib/commonjs/components/hooks/useColorScheme.js +10 -0
- package/lib/commonjs/components/hooks/useColorScheme.js.map +1 -0
- package/lib/commonjs/components/index.js +42 -0
- package/lib/commonjs/components/index.js.map +1 -0
- package/lib/commonjs/constants.js +25 -0
- package/lib/commonjs/constants.js.map +1 -0
- package/lib/commonjs/context.js +42 -0
- package/lib/commonjs/context.js.map +1 -0
- package/lib/commonjs/hooks/index.js +104 -0
- package/lib/commonjs/hooks/index.js.map +1 -0
- package/lib/commonjs/hooks/useWindowDimensions/index.android.js +29 -0
- package/lib/commonjs/hooks/useWindowDimensions/index.android.js.map +1 -0
- package/lib/commonjs/hooks/useWindowDimensions/index.js +13 -0
- package/lib/commonjs/hooks/useWindowDimensions/index.js.map +1 -0
- package/lib/commonjs/index.js +116 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/internal.js +73 -0
- package/lib/commonjs/internal.js.map +1 -0
- package/lib/commonjs/monkey-patch.android.js +57 -0
- package/lib/commonjs/monkey-patch.android.js.map +1 -0
- package/lib/commonjs/monkey-patch.js +11 -0
- package/lib/commonjs/monkey-patch.js.map +1 -0
- package/lib/commonjs/reanimated.js +12 -0
- package/lib/commonjs/reanimated.js.map +1 -0
- package/lib/commonjs/reanimated.native.js +88 -0
- package/lib/commonjs/reanimated.native.js.map +1 -0
- package/lib/commonjs/specs/KeyboardControllerViewNativeComponent.js +10 -0
- package/lib/commonjs/specs/KeyboardControllerViewNativeComponent.js.map +1 -0
- package/lib/commonjs/specs/KeyboardGestureAreaNativeComponent.js +12 -0
- package/lib/commonjs/specs/KeyboardGestureAreaNativeComponent.js.map +1 -0
- package/lib/commonjs/specs/NativeKeyboardController.js +9 -0
- package/lib/commonjs/specs/NativeKeyboardController.js.map +1 -0
- package/lib/commonjs/specs/NativeStatusBarManagerCompat.js +9 -0
- package/lib/commonjs/specs/NativeStatusBarManagerCompat.js.map +1 -0
- package/lib/commonjs/types.js +6 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/commonjs/utils.js +9 -0
- package/lib/commonjs/utils.js.map +1 -0
- package/lib/module/animated.js +166 -0
- package/lib/module/animated.js.map +1 -0
- package/lib/module/bindings.js +32 -0
- package/lib/module/bindings.js.map +1 -0
- package/lib/module/bindings.native.js +31 -0
- package/lib/module/bindings.native.js.map +1 -0
- package/lib/module/components/KeyboardAvoidingView/hooks.js +59 -0
- package/lib/module/components/KeyboardAvoidingView/hooks.js.map +1 -0
- package/lib/module/components/KeyboardAvoidingView/index.js +95 -0
- package/lib/module/components/KeyboardAvoidingView/index.js.map +1 -0
- package/lib/module/components/KeyboardAwareScrollView/index.js +248 -0
- package/lib/module/components/KeyboardAwareScrollView/index.js.map +1 -0
- package/lib/module/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js +103 -0
- package/lib/module/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js.map +1 -0
- package/lib/module/components/KeyboardAwareScrollView/utils.js +29 -0
- package/lib/module/components/KeyboardAwareScrollView/utils.js.map +1 -0
- package/lib/module/components/KeyboardStickyView/index.js +33 -0
- package/lib/module/components/KeyboardStickyView/index.js.map +1 -0
- package/lib/module/components/KeyboardToolbar/Arrow.js +68 -0
- package/lib/module/components/KeyboardToolbar/Arrow.js.map +1 -0
- package/lib/module/components/KeyboardToolbar/Button.js +62 -0
- package/lib/module/components/KeyboardToolbar/Button.js.map +1 -0
- package/lib/module/components/KeyboardToolbar/colors.js +15 -0
- package/lib/module/components/KeyboardToolbar/colors.js.map +1 -0
- package/lib/module/components/KeyboardToolbar/colors.native.js +34 -0
- package/lib/module/components/KeyboardToolbar/colors.native.js.map +1 -0
- package/lib/module/components/KeyboardToolbar/index.js +140 -0
- package/lib/module/components/KeyboardToolbar/index.js.map +1 -0
- package/lib/module/components/KeyboardToolbar/types.js +2 -0
- package/lib/module/components/KeyboardToolbar/types.js.map +1 -0
- package/lib/module/components/hooks/useColorScheme.js +4 -0
- package/lib/module/components/hooks/useColorScheme.js.map +1 -0
- package/lib/module/components/index.js +5 -0
- package/lib/module/components/index.js.map +1 -0
- package/lib/module/constants.js +19 -0
- package/lib/module/constants.js.map +1 -0
- package/lib/module/context.js +35 -0
- package/lib/module/context.js.map +1 -0
- package/lib/module/hooks/index.js +68 -0
- package/lib/module/hooks/index.js.map +1 -0
- package/lib/module/hooks/useWindowDimensions/index.android.js +22 -0
- package/lib/module/hooks/useWindowDimensions/index.android.js.map +1 -0
- package/lib/module/hooks/useWindowDimensions/index.js +2 -0
- package/lib/module/hooks/useWindowDimensions/index.js.map +1 -0
- package/lib/module/index.js +10 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/internal.js +66 -0
- package/lib/module/internal.js.map +1 -0
- package/lib/module/monkey-patch.android.js +47 -0
- package/lib/module/monkey-patch.android.js.map +1 -0
- package/lib/module/monkey-patch.js +5 -0
- package/lib/module/monkey-patch.js.map +1 -0
- package/lib/module/reanimated.js +6 -0
- package/lib/module/reanimated.js.map +1 -0
- package/lib/module/reanimated.native.js +78 -0
- package/lib/module/reanimated.native.js.map +1 -0
- package/lib/module/specs/KeyboardControllerViewNativeComponent.js +3 -0
- package/lib/module/specs/KeyboardControllerViewNativeComponent.js.map +1 -0
- package/lib/module/specs/KeyboardGestureAreaNativeComponent.js +5 -0
- package/lib/module/specs/KeyboardGestureAreaNativeComponent.js.map +1 -0
- package/lib/module/specs/NativeKeyboardController.js +3 -0
- package/lib/module/specs/NativeKeyboardController.js.map +1 -0
- package/lib/module/specs/NativeStatusBarManagerCompat.js +3 -0
- package/lib/module/specs/NativeStatusBarManagerCompat.js.map +1 -0
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/utils.js +2 -0
- package/lib/module/utils.js.map +1 -0
- package/lib/typescript/animated.d.ts +31 -0
- package/lib/typescript/bindings.d.ts +12 -0
- package/lib/typescript/bindings.native.d.ts +12 -0
- package/lib/typescript/components/KeyboardAvoidingView/hooks.d.ts +6 -0
- package/lib/typescript/components/KeyboardAvoidingView/index.d.ts +50 -0
- package/lib/typescript/components/KeyboardAwareScrollView/index.d.ts +25 -0
- package/lib/typescript/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.d.ts +6 -0
- package/lib/typescript/components/KeyboardAwareScrollView/utils.d.ts +2 -0
- package/lib/typescript/components/KeyboardStickyView/index.d.ts +35 -0
- package/lib/typescript/components/KeyboardToolbar/Arrow.d.ts +9 -0
- package/lib/typescript/components/KeyboardToolbar/Button.d.ts +15 -0
- package/lib/typescript/components/KeyboardToolbar/colors.d.ts +2 -0
- package/lib/typescript/components/KeyboardToolbar/colors.native.d.ts +2 -0
- package/lib/typescript/components/KeyboardToolbar/index.d.ts +50 -0
- package/lib/typescript/components/KeyboardToolbar/types.d.ts +18 -0
- package/lib/typescript/components/hooks/useColorScheme.d.ts +2 -0
- package/lib/typescript/components/index.d.ts +8 -0
- package/lib/typescript/constants.d.ts +16 -0
- package/lib/typescript/context.d.ts +23 -0
- package/lib/typescript/hooks/index.d.ts +17 -0
- package/lib/typescript/hooks/useWindowDimensions/index.android.d.ts +2 -0
- package/lib/typescript/hooks/useWindowDimensions/index.d.ts +1 -0
- package/lib/typescript/index.d.ts +8 -0
- package/lib/typescript/internal.d.ts +30 -0
- package/lib/typescript/monkey-patch.android.d.ts +2 -0
- package/lib/typescript/monkey-patch.d.ts +2 -0
- package/lib/typescript/reanimated.d.ts +5 -0
- package/lib/typescript/reanimated.native.d.ts +7 -0
- package/lib/typescript/specs/KeyboardControllerViewNativeComponent.d.ts +53 -0
- package/lib/typescript/specs/KeyboardGestureAreaNativeComponent.d.ts +10 -0
- package/lib/typescript/specs/NativeKeyboardController.d.ts +12 -0
- package/lib/typescript/specs/NativeStatusBarManagerCompat.d.ts +10 -0
- package/lib/typescript/types.d.ts +133 -0
- package/lib/typescript/utils.d.ts +1 -0
- package/package.json +177 -0
- package/react-native-keyboard-controller.podspec +61 -0
- package/src/animated.tsx +246 -0
- package/src/bindings.native.ts +57 -0
- package/src/bindings.ts +38 -0
- package/src/components/KeyboardAvoidingView/hooks.ts +58 -0
- package/src/components/KeyboardAvoidingView/index.tsx +156 -0
- package/src/components/KeyboardAwareScrollView/index.tsx +373 -0
- package/src/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.ts +133 -0
- package/src/components/KeyboardAwareScrollView/utils.ts +41 -0
- package/src/components/KeyboardStickyView/index.tsx +57 -0
- package/src/components/KeyboardToolbar/Arrow.tsx +80 -0
- package/src/components/KeyboardToolbar/Button.tsx +98 -0
- package/src/components/KeyboardToolbar/colors.native.ts +37 -0
- package/src/components/KeyboardToolbar/colors.ts +16 -0
- package/src/components/KeyboardToolbar/index.tsx +211 -0
- package/src/components/KeyboardToolbar/types.ts +40 -0
- package/src/components/hooks/useColorScheme.ts +5 -0
- package/src/components/index.ts +11 -0
- package/src/constants.ts +19 -0
- package/src/context.ts +65 -0
- package/src/hooks/index.ts +90 -0
- package/src/hooks/useWindowDimensions/index.android.ts +33 -0
- package/src/hooks/useWindowDimensions/index.ts +1 -0
- package/src/index.ts +21 -0
- package/src/internal.ts +84 -0
- package/src/monkey-patch.android.ts +44 -0
- package/src/monkey-patch.ts +4 -0
- package/src/reanimated.native.ts +132 -0
- package/src/reanimated.ts +29 -0
- package/src/specs/KeyboardControllerViewNativeComponent.ts +70 -0
- package/src/specs/KeyboardGestureAreaNativeComponent.ts +15 -0
- package/src/specs/NativeKeyboardController.ts +19 -0
- package/src/specs/NativeStatusBarManagerCompat.ts +14 -0
- package/src/types.ts +211 -0
- package/src/utils.ts +1 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
|
|
3
|
+
* Use of this source code is governed by a MIT license that can be
|
|
4
|
+
* found in the LICENSE file.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
#ifndef TESTER_HARMONY_KEYBOARD_CONTROLLER_SRC_MAIN_CPP_KEYBOARDCONTROLLERVIEWJSIBINDER_H
|
|
8
|
+
#define TESTER_HARMONY_KEYBOARD_CONTROLLER_SRC_MAIN_CPP_KEYBOARDCONTROLLERVIEWJSIBINDER_H
|
|
9
|
+
|
|
10
|
+
#pragma once
|
|
11
|
+
#include "RNOHCorePackage/ComponentBinders/ViewComponentJSIBinder.h"
|
|
12
|
+
namespace rnoh {
|
|
13
|
+
class KeyboardControllerViewJSIBinder : public ViewComponentJSIBinder {
|
|
14
|
+
protected:
|
|
15
|
+
facebook::jsi::Object createNativeProps(facebook::jsi::Runtime &rt) override {
|
|
16
|
+
auto object = ViewComponentJSIBinder::createNativeProps(rt);
|
|
17
|
+
object.setProperty(rt, "enabled", "bool");
|
|
18
|
+
object.setProperty(rt, "statusBarTranslucent", "bool");
|
|
19
|
+
object.setProperty(rt, "navigationBarTranslucent", "bool");
|
|
20
|
+
return object;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
facebook::jsi::Object createBubblingEventTypes(facebook::jsi::Runtime &rt) override {
|
|
24
|
+
facebook::jsi::Object events(rt);
|
|
25
|
+
return events;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
facebook::jsi::Object createDirectEventTypes(facebook::jsi::Runtime &rt) override {
|
|
29
|
+
facebook::jsi::Object events(rt);
|
|
30
|
+
events.setProperty(rt, "topKeyboardMoveStart", createDirectEvent(rt, "onKeyboardMoveStart"));
|
|
31
|
+
events.setProperty(rt, "topKeyboardMove", createDirectEvent(rt, "onKeyboardMove"));
|
|
32
|
+
events.setProperty(rt, "topKeyboardMoveEnd", createDirectEvent(rt, "onKeyboardMoveEnd"));
|
|
33
|
+
events.setProperty(rt, "topKeyboardMoveInteractive", createDirectEvent(rt, "onKeyboardMoveInteractive"));
|
|
34
|
+
events.setProperty(rt, "topFocusedInputLayoutChanged", createDirectEvent(rt, "onFocusedInputLayoutChanged"));
|
|
35
|
+
events.setProperty(rt, "topFocusedInputTextChanged", createDirectEvent(rt, "onFocusedInputTextChanged"));
|
|
36
|
+
events.setProperty(rt, "topFocusedInputSelectionChanged",
|
|
37
|
+
createDirectEvent(rt, "onFocusedInputSelectionChanged"));
|
|
38
|
+
return events;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
} // namespace rnoh
|
|
42
|
+
|
|
43
|
+
#endif
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
|
|
3
|
+
* Use of this source code is governed by a MIT license that can be
|
|
4
|
+
* found in the LICENSE file.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
#ifndef TESTER_HARMONY_KEYBOARD_CONTROLLER_SRC_MAIN_CPP_KEYBOARDGESTUREAREACOMPONENTDESCRIPTOR_H
|
|
8
|
+
#define TESTER_HARMONY_KEYBOARD_CONTROLLER_SRC_MAIN_CPP_KEYBOARDGESTUREAREACOMPONENTDESCRIPTOR_H
|
|
9
|
+
|
|
10
|
+
#ifndef KEYBOARDGESTUREAREACOMPONENTDESCRIPTOR_H
|
|
11
|
+
#define KEYBOARDGESTUREAREACOMPONENTDESCRIPTOR_H
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
#pragma once
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
18
|
+
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
19
|
+
#include <react/renderer/components/view/ViewShadowNode.h>
|
|
20
|
+
#include <react/renderer/core/propsConversions.h>
|
|
21
|
+
#include "EventEmitters.h"
|
|
22
|
+
|
|
23
|
+
namespace facebook {
|
|
24
|
+
namespace react {
|
|
25
|
+
|
|
26
|
+
inline const char KeyboardGestureAreaComponentName[] = "RNKeyboardGestureArea";
|
|
27
|
+
|
|
28
|
+
class KeyboardGestureAreaProps : public ViewProps {
|
|
29
|
+
public:
|
|
30
|
+
bool showOnSwipeUp;
|
|
31
|
+
bool enableSwipeToDismiss;
|
|
32
|
+
std::string interpolator;
|
|
33
|
+
KeyboardGestureAreaProps() = default;
|
|
34
|
+
|
|
35
|
+
KeyboardGestureAreaProps(const PropsParserContext &context, const KeyboardGestureAreaProps &sourceProps,
|
|
36
|
+
const RawProps &rawProps)
|
|
37
|
+
: ViewProps(context, sourceProps, rawProps),
|
|
38
|
+
showOnSwipeUp(CoreFeatures::enablePropIteratorSetter
|
|
39
|
+
? sourceProps.showOnSwipeUp
|
|
40
|
+
: convertRawProp(context, rawProps, "showOnSwipeUp", sourceProps.showOnSwipeUp, {false})),
|
|
41
|
+
enableSwipeToDismiss(CoreFeatures::enablePropIteratorSetter
|
|
42
|
+
? sourceProps.enableSwipeToDismiss
|
|
43
|
+
: convertRawProp(context, rawProps, "enableSwipeToDismiss",
|
|
44
|
+
sourceProps.enableSwipeToDismiss, {false})),
|
|
45
|
+
interpolator(CoreFeatures::enablePropIteratorSetter
|
|
46
|
+
? sourceProps.interpolator
|
|
47
|
+
: convertRawProp(context, rawProps, "interpolator", sourceProps.interpolator, {"linear"})) {}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
using KeyboardGestureAreaShadowNode =
|
|
51
|
+
ConcreteViewShadowNode<KeyboardGestureAreaComponentName, KeyboardGestureAreaProps, ViewEventEmitter>;
|
|
52
|
+
|
|
53
|
+
class KeyboardGestureAreaComponentDescriptor final : public ConcreteComponentDescriptor<KeyboardGestureAreaShadowNode> {
|
|
54
|
+
public:
|
|
55
|
+
KeyboardGestureAreaComponentDescriptor(ComponentDescriptorParameters const ¶meters)
|
|
56
|
+
: ConcreteComponentDescriptor(parameters) {}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
} // namespace react
|
|
60
|
+
} // namespace facebook
|
|
61
|
+
|
|
62
|
+
#endif
|
|
63
|
+
|
|
64
|
+
#endif
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
|
|
3
|
+
* Use of this source code is governed by a MIT license that can be
|
|
4
|
+
* found in the LICENSE file.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
#include "KeyboardGestureAreaComponentInstance.h"
|
|
8
|
+
#include <folly/dynamic.h>
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
namespace rnoh {
|
|
12
|
+
KeyboardGestureAreaComponentInstance::KeyboardGestureAreaComponentInstance(Context context)
|
|
13
|
+
: CppComponentInstance(std::move(context)) {
|
|
14
|
+
DLOG(INFO) << "KeyboardGestureAreaComponentInstance";
|
|
15
|
+
ArkUINodeRegistry::getInstance().registerTouchHandler(&m_stackNode, this);
|
|
16
|
+
NativeNodeApi::getInstance()->registerNodeEvent(m_stackNode.getArkUINodeHandle(), NODE_TOUCH_EVENT,
|
|
17
|
+
NODE_TOUCH_EVENT, 0);
|
|
18
|
+
}
|
|
19
|
+
void KeyboardGestureAreaComponentInstance::onTouchEvent(ArkUI_UIInputEvent *e) {
|
|
20
|
+
auto action = OH_ArkUI_UIInputEvent_GetAction(e);
|
|
21
|
+
DLOG(INFO) << "KeyboardGestureAreaComponentInstance onTouchEvent" << action;
|
|
22
|
+
if (action == UI_TOUCH_EVENT_ACTION_DOWN) {
|
|
23
|
+
this->swipeToDismiss();
|
|
24
|
+
}
|
|
25
|
+
if (action == UI_TOUCH_EVENT_ACTION_UP) {
|
|
26
|
+
this->swipeToUp();
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
void KeyboardGestureAreaComponentInstance::onChildInserted(ComponentInstance::Shared const &childComponentInstance,
|
|
30
|
+
std::size_t index) {
|
|
31
|
+
CppComponentInstance::onChildInserted(childComponentInstance, index);
|
|
32
|
+
m_stackNode.insertChild(childComponentInstance->getLocalRootArkUINode(), index + 1);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
void KeyboardGestureAreaComponentInstance::onChildRemoved(ComponentInstance::Shared const &childComponentInstance) {
|
|
36
|
+
CppComponentInstance::onChildRemoved(childComponentInstance);
|
|
37
|
+
m_stackNode.removeChild(childComponentInstance->getLocalRootArkUINode());
|
|
38
|
+
}
|
|
39
|
+
ArkUINode &KeyboardGestureAreaComponentInstance::getLocalRootArkUINode() { return m_stackNode; }
|
|
40
|
+
void KeyboardGestureAreaComponentInstance::onPropsChanged(SharedConcreteProps const &props) {
|
|
41
|
+
DLOG(INFO) << "###onPropsChanged";
|
|
42
|
+
CppComponentInstance::onPropsChanged(props);
|
|
43
|
+
this->showOnSwipeUp = props->showOnSwipeUp;
|
|
44
|
+
this->enableSwipeToDismiss = props->enableSwipeToDismiss;
|
|
45
|
+
this->interpolator = props->interpolator;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
void KeyboardGestureAreaComponentInstance::onCommandReceived(std::string const &commandName,
|
|
49
|
+
folly::dynamic const &args) {
|
|
50
|
+
CppComponentInstance::onCommandReceived(commandName, args);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
void KeyboardGestureAreaComponentInstance::handleTouchEvent(ArkUI_UIInputEvent *e) {
|
|
54
|
+
auto action = OH_ArkUI_UIInputEvent_GetAction(e);
|
|
55
|
+
if (action == UI_TOUCH_EVENT_ACTION_DOWN) {
|
|
56
|
+
this->swipeToDismiss();
|
|
57
|
+
}
|
|
58
|
+
if (action == UI_TOUCH_EVENT_ACTION_UP) {
|
|
59
|
+
this->swipeToUp();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
void KeyboardGestureAreaComponentInstance::swipeToDismiss() {
|
|
63
|
+
if (!this->enableSwipeToDismiss) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
auto rnInstancePtr = this->m_deps->rnInstance.lock();
|
|
67
|
+
if (rnInstancePtr != nullptr) {
|
|
68
|
+
auto turboModule = rnInstancePtr->getTurboModule("KeyboardController");
|
|
69
|
+
auto arkTsTurboModule = std::dynamic_pointer_cast<rnoh::ArkTSTurboModule>(turboModule);
|
|
70
|
+
arkTsTurboModule->callSync("dismiss", {});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
void KeyboardGestureAreaComponentInstance::swipeToUp() {
|
|
74
|
+
if (!this->showOnSwipeUp) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
auto rnInstancePtr = this->m_deps->rnInstance.lock();
|
|
78
|
+
if (rnInstancePtr != nullptr) {
|
|
79
|
+
auto turboModule = rnInstancePtr->getTurboModule("KeyboardController");
|
|
80
|
+
auto arkTsTurboModule = std::dynamic_pointer_cast<rnoh::ArkTSTurboModule>(turboModule);
|
|
81
|
+
arkTsTurboModule->callSync("show", {});
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
void KeyboardGestureAreaComponentInstance::executeInterpolator() {
|
|
85
|
+
// to do
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
} // namespace rnoh
|
|
89
|
+
// namespace rnoh
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
|
|
3
|
+
* Use of this source code is governed by a MIT license that can be
|
|
4
|
+
* found in the LICENSE file.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
#ifndef KEYBOARDGESTUREAREACOMPONENTINSTANCE_H
|
|
8
|
+
#define KEYBOARDGESTUREAREACOMPONENTINSTANCE_H
|
|
9
|
+
|
|
10
|
+
#ifndef TESTER_HARMONY_KEYBOARD_CONTROLLER_SRC_MAIN_CPP_KEYBOARDGESTUREAREACOMPONENTINSTANCE_H
|
|
11
|
+
#define TESTER_HARMONY_KEYBOARD_CONTROLLER_SRC_MAIN_CPP_KEYBOARDGESTUREAREACOMPONENTINSTANCE_H
|
|
12
|
+
|
|
13
|
+
#include <iostream>
|
|
14
|
+
#include <deque>
|
|
15
|
+
#include "RNOH/CppComponentInstance.h"
|
|
16
|
+
#include "KeyboardGestureAreaComponentDescriptor.h"
|
|
17
|
+
#include "RNOH/arkui/StackNode.h"
|
|
18
|
+
#include "RNOH/arkui/ArkUINodeRegistry.h"
|
|
19
|
+
namespace rnoh {
|
|
20
|
+
|
|
21
|
+
class KeyboardGestureAreaComponentInstance
|
|
22
|
+
: public CppComponentInstance<facebook::react::KeyboardGestureAreaShadowNode>,
|
|
23
|
+
public TouchEventHandler {
|
|
24
|
+
public:
|
|
25
|
+
KeyboardGestureAreaComponentInstance(Context context);
|
|
26
|
+
~KeyboardGestureAreaComponentInstance()
|
|
27
|
+
{
|
|
28
|
+
// Clean-up code here
|
|
29
|
+
std::cout << "KeyboardGestureAreaComponentInstance destroyed." << std::endl;
|
|
30
|
+
NativeNodeApi::getInstance()->unregisterNodeEvent(m_stackNode.getArkUINodeHandle(), NODE_TOUCH_EVENT);
|
|
31
|
+
ArkUINodeRegistry::getInstance().unregisterTouchHandler(&m_stackNode);
|
|
32
|
+
}
|
|
33
|
+
void onTouchEvent(ArkUI_UIInputEvent *e) override;
|
|
34
|
+
void onChildInserted(ComponentInstance::Shared const &childComponentInstance, std::size_t index) override;
|
|
35
|
+
void onChildRemoved(ComponentInstance::Shared const &childComponentInstance) override;
|
|
36
|
+
void onPropsChanged(SharedConcreteProps const &props) override;
|
|
37
|
+
void onCommandReceived(std::string const &commandName, folly::dynamic const &args) override;
|
|
38
|
+
ArkUINode &getLocalRootArkUINode() override;
|
|
39
|
+
protected:
|
|
40
|
+
private:
|
|
41
|
+
bool showOnSwipeUp;
|
|
42
|
+
bool enableSwipeToDismiss;
|
|
43
|
+
std::string interpolator;
|
|
44
|
+
double keyboardHeight;
|
|
45
|
+
size_t maxSize;
|
|
46
|
+
std::deque<folly::dynamic> buffer;
|
|
47
|
+
StackNode m_stackNode;
|
|
48
|
+
struct TouchPoint {
|
|
49
|
+
facebook::react::Float pointerId;
|
|
50
|
+
facebook::react::Float windowX;
|
|
51
|
+
facebook::react::Float windowY;
|
|
52
|
+
};
|
|
53
|
+
folly::dynamic convertNodeTouchPointToDynamic(ArkUI_UIInputEvent *e, int32_t index);
|
|
54
|
+
void swipeToUp();
|
|
55
|
+
void swipeToDismiss();
|
|
56
|
+
void executeInterpolator();
|
|
57
|
+
void handleTouchEvent(ArkUI_UIInputEvent *e);
|
|
58
|
+
};
|
|
59
|
+
} // namespace rnoh
|
|
60
|
+
|
|
61
|
+
#endif
|
|
62
|
+
|
|
63
|
+
#endif
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
|
|
3
|
+
* Use of this source code is governed by a MIT license that can be
|
|
4
|
+
* found in the LICENSE file.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
#ifndef TESTER_HARMONY_KEYBOARD_CONTROLLER_SRC_MAIN_CPP_KEYBOARDGESTUREAREAJSIBINDER_H
|
|
8
|
+
#define TESTER_HARMONY_KEYBOARD_CONTROLLER_SRC_MAIN_CPP_KEYBOARDGESTUREAREAJSIBINDER_H
|
|
9
|
+
|
|
10
|
+
#pragma once
|
|
11
|
+
#include "RNOHCorePackage/ComponentBinders/ViewComponentJSIBinder.h"
|
|
12
|
+
|
|
13
|
+
namespace rnoh {
|
|
14
|
+
class KeyboardGestureAreaJSIBinder : public ViewComponentJSIBinder {
|
|
15
|
+
protected:
|
|
16
|
+
facebook::jsi::Object createNativeProps(facebook::jsi::Runtime &rt) override
|
|
17
|
+
{
|
|
18
|
+
auto object = ViewComponentJSIBinder::createNativeProps(rt);
|
|
19
|
+
object.setProperty(rt, "interpolator", "String");
|
|
20
|
+
object.setProperty(rt, "showOnSwipeUp", "bool");
|
|
21
|
+
object.setProperty(rt, "enableSwipeToDismiss", "bool");
|
|
22
|
+
return object;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
facebook::jsi::Object createBubblingEventTypes(facebook::jsi::Runtime &rt) override
|
|
26
|
+
{
|
|
27
|
+
facebook::jsi::Object events(rt);
|
|
28
|
+
return events;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
facebook::jsi::Object createDirectEventTypes(facebook::jsi::Runtime &rt) override
|
|
32
|
+
{
|
|
33
|
+
facebook::jsi::Object events(rt);
|
|
34
|
+
return events;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
} // namespace rnoh
|
|
38
|
+
|
|
39
|
+
#endif
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
|
|
3
|
+
* Use of this source code is governed by a MIT license that can be
|
|
4
|
+
* found in the LICENSE file.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
#include "RNKeyboardController.h"
|
|
9
|
+
|
|
10
|
+
namespace rnoh {
|
|
11
|
+
using namespace facebook;
|
|
12
|
+
KeyboardController::KeyboardController(const ArkTSTurboModule::Context ctx, const std::string name) : ArkTSTurboModule(ctx, name)
|
|
13
|
+
{
|
|
14
|
+
methodMap_ = {
|
|
15
|
+
ARK_METHOD_METADATA(getConstants, 0),
|
|
16
|
+
ARK_METHOD_METADATA(setInputMode, 1),
|
|
17
|
+
ARK_METHOD_METADATA(setDefaultMode, 0),
|
|
18
|
+
ARK_METHOD_METADATA(dismiss, 0),
|
|
19
|
+
ARK_METHOD_METADATA(setFocusTo, 1),
|
|
20
|
+
ARK_METHOD_METADATA(addListener, 1),
|
|
21
|
+
ARK_METHOD_METADATA(removeListeners, 1),
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
} // namespace rnoh
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
|
|
3
|
+
* Use of this source code is governed by a MIT license that can be
|
|
4
|
+
* found in the LICENSE file.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
#ifndef TESTER_HARMONY_KEYBOARD_CONTROLLER_SRC_MAIN_CPP_RNKEYBOARDCONTROLLER_H
|
|
8
|
+
#define TESTER_HARMONY_KEYBOARD_CONTROLLER_SRC_MAIN_CPP_RNKEYBOARDCONTROLLER_H
|
|
9
|
+
|
|
10
|
+
#ifndef RNKEYBOARDCONTROLLER_H
|
|
11
|
+
#define RNKEYBOARDCONTROLLER_H
|
|
12
|
+
#pragma once
|
|
13
|
+
|
|
14
|
+
#include "RNOH/ArkTSTurboModule.h"
|
|
15
|
+
|
|
16
|
+
namespace rnoh {
|
|
17
|
+
|
|
18
|
+
class JSI_EXPORT KeyboardController : public ArkTSTurboModule {
|
|
19
|
+
public:
|
|
20
|
+
KeyboardController(const ArkTSTurboModule::Context ctx, const std::string name);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
} // namespace rnoh
|
|
24
|
+
|
|
25
|
+
#endif
|
|
26
|
+
|
|
27
|
+
#endif
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
|
|
3
|
+
* Use of this source code is governed by a MIT license that can be
|
|
4
|
+
* found in the LICENSE file.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
#include "RNKeyboardControllerPackage.h"
|
|
8
|
+
#include "KeyboardControllerViewJSIBinder.h"
|
|
9
|
+
#include "KeyboardGestureAreaJSIBinder.h"
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
using namespace facebook;
|
|
13
|
+
using namespace rnoh;
|
|
14
|
+
|
|
15
|
+
std::vector<facebook::react::ComponentDescriptorProvider>
|
|
16
|
+
RNKeyboardControllerPackage::createComponentDescriptorProviders() {
|
|
17
|
+
return {facebook::react::concreteComponentDescriptorProvider<
|
|
18
|
+
facebook::react::KeyboardControllerViewComponentDescriptor>(),
|
|
19
|
+
facebook::react::concreteComponentDescriptorProvider<
|
|
20
|
+
facebook::react::KeyboardGestureAreaComponentDescriptor>()};
|
|
21
|
+
}
|
|
22
|
+
ComponentJSIBinderByString RNKeyboardControllerPackage::createComponentJSIBinderByName() {
|
|
23
|
+
return {{"RNKeyboardControllerView", std::make_shared<KeyboardControllerViewJSIBinder>()},
|
|
24
|
+
{"RNKeyboardGestureArea", std::make_shared<KeyboardGestureAreaJSIBinder>()}};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
std::unique_ptr<TurboModuleFactoryDelegate> RNKeyboardControllerPackage::createTurboModuleFactoryDelegate() {
|
|
28
|
+
return std::make_unique<KeyboardControllerTurboModuleFactoryDelegate>();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
ComponentInstanceFactoryDelegate::Shared RNKeyboardControllerPackage::createComponentInstanceFactoryDelegate() {
|
|
32
|
+
return std::make_shared<KeyboardControllerComponentInstanceFactoryDelegate>();
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
ComponentInstance::Shared RNKeyboardControllerPackage::createComponentInstance(const ComponentInstance::Context &ctx) {
|
|
36
|
+
if (ctx.componentName == "RNKeyboardControllerView") {
|
|
37
|
+
return std::make_shared<KeyboardControllerViewComponentInstance>(ctx);
|
|
38
|
+
}
|
|
39
|
+
if (ctx.componentName == "RNKeyboardGestureArea") {
|
|
40
|
+
return std::make_shared<KeyboardGestureAreaComponentInstance>(ctx);
|
|
41
|
+
}
|
|
42
|
+
return nullptr;
|
|
43
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
|
|
3
|
+
* Use of this source code is governed by a MIT license that can be
|
|
4
|
+
* found in the LICENSE file.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
#ifndef TESTER_HARMONY_KEYBOARD_CONTROLLER_SRC_MAIN_CPP_RNKEYBOARDCONTROLLERPACKAGE_H
|
|
8
|
+
#define TESTER_HARMONY_KEYBOARD_CONTROLLER_SRC_MAIN_CPP_RNKEYBOARDCONTROLLERPACKAGE_H
|
|
9
|
+
|
|
10
|
+
#ifndef RNKEYBOARDCONTROLLERPACKAGE_H
|
|
11
|
+
#define RNKEYBOARDCONTROLLERPACKAGE_H
|
|
12
|
+
|
|
13
|
+
#include "KeyboardGestureAreaComponentInstance.h"
|
|
14
|
+
#include "RNOH/Package.h"
|
|
15
|
+
#include "RNKeyboardController.h"
|
|
16
|
+
#include "RNStatusBarManagerCompat.h"
|
|
17
|
+
#include "KeyboardControllerViewComponentInstance.h"
|
|
18
|
+
namespace rnoh {
|
|
19
|
+
class KeyboardControllerComponentInstanceFactoryDelegate : public ComponentInstanceFactoryDelegate {
|
|
20
|
+
public:
|
|
21
|
+
ComponentInstance::Shared create(ComponentInstance::Context ctx) override {
|
|
22
|
+
if (ctx.componentName == "RNKeyboardControllerView") {
|
|
23
|
+
return std::make_shared<KeyboardControllerViewComponentInstance>(ctx);
|
|
24
|
+
}
|
|
25
|
+
if (ctx.componentName == "RNKeyboardGestureArea") {
|
|
26
|
+
return std::make_shared<KeyboardGestureAreaComponentInstance>(ctx);
|
|
27
|
+
}
|
|
28
|
+
return nullptr;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
class KeyboardControllerTurboModuleFactoryDelegate : public TurboModuleFactoryDelegate {
|
|
32
|
+
public:
|
|
33
|
+
SharedTurboModule createTurboModule(Context ctx, const std::string &name) const override {
|
|
34
|
+
if (name == "KeyboardController") {
|
|
35
|
+
return std::make_shared<KeyboardController>(ctx, name);
|
|
36
|
+
}
|
|
37
|
+
if (name == "StatusBarManagerCompat") {
|
|
38
|
+
return std::make_shared<StatusBarManagerCompat>(ctx, name);
|
|
39
|
+
}
|
|
40
|
+
return nullptr;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
class RNKeyboardControllerPackage : public Package{
|
|
44
|
+
public:
|
|
45
|
+
RNKeyboardControllerPackage(Package::Context ctx) : Package(ctx) {}
|
|
46
|
+
std::unique_ptr<TurboModuleFactoryDelegate> createTurboModuleFactoryDelegate() override;
|
|
47
|
+
std::vector<facebook::react::ComponentDescriptorProvider> createComponentDescriptorProviders() override;
|
|
48
|
+
ComponentJSIBinderByString createComponentJSIBinderByName() override;
|
|
49
|
+
ComponentInstance::Shared createComponentInstance(const ComponentInstance::Context &ctx) override;
|
|
50
|
+
ComponentInstanceFactoryDelegate::Shared createComponentInstanceFactoryDelegate() override;
|
|
51
|
+
};
|
|
52
|
+
} // namespace rnoh
|
|
53
|
+
|
|
54
|
+
#endif
|
|
55
|
+
|
|
56
|
+
#endif
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
|
|
3
|
+
* Use of this source code is governed by a MIT license that can be
|
|
4
|
+
* found in the LICENSE file.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
#include "RNStatusBarManagerCompat.h"
|
|
9
|
+
|
|
10
|
+
namespace rnoh {
|
|
11
|
+
using namespace facebook;
|
|
12
|
+
|
|
13
|
+
StatusBarManagerCompat::StatusBarManagerCompat(const ArkTSTurboModule::Context ctx, const std::string name) : ArkTSTurboModule(ctx, name)
|
|
14
|
+
{
|
|
15
|
+
methodMap_ = {
|
|
16
|
+
ARK_METHOD_METADATA(getConstants, 0),
|
|
17
|
+
ARK_METHOD_METADATA(setHidden, 1),
|
|
18
|
+
ARK_METHOD_METADATA(setColor, 2),
|
|
19
|
+
ARK_METHOD_METADATA(setTranslucent, 1),
|
|
20
|
+
ARK_METHOD_METADATA(setStyle, 1),
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
} // namespace rnoh
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
|
|
3
|
+
* Use of this source code is governed by a MIT license that can be
|
|
4
|
+
* found in the LICENSE file.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
#ifndef TESTER_HARMONY_KEYBOARD_CONTROLLER_SRC_MAIN_CPP_RNSTATUSBARMANAGERCOMPAT_H
|
|
8
|
+
#define TESTER_HARMONY_KEYBOARD_CONTROLLER_SRC_MAIN_CPP_RNSTATUSBARMANAGERCOMPAT_H
|
|
9
|
+
|
|
10
|
+
#ifndef RNSTATUSBARMANAGERCOMPAT_H
|
|
11
|
+
#define RNSTATUSBARMANAGERCOMPAT_H
|
|
12
|
+
|
|
13
|
+
#pragma once
|
|
14
|
+
|
|
15
|
+
#include "RNOH/ArkTSTurboModule.h"
|
|
16
|
+
|
|
17
|
+
namespace rnoh {
|
|
18
|
+
|
|
19
|
+
class JSI_EXPORT StatusBarManagerCompat : public ArkTSTurboModule {
|
|
20
|
+
public:
|
|
21
|
+
StatusBarManagerCompat(const ArkTSTurboModule::Context ctx, const std::string name);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
} // namespace rnoh
|
|
25
|
+
|
|
26
|
+
#endif
|
|
27
|
+
|
|
28
|
+
#endif
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
|
|
3
|
+
* Use of this source code is governed by a MIT license that can be
|
|
4
|
+
* found in the LICENSE file.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
#include "keyboardControllerPackage.h"
|
|
8
|
+
#include "KeyboardControllerViewJSIBinder.h"
|
|
9
|
+
#include "KeyboardGestureAreaJSIBinder.h"
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
using namespace facebook;
|
|
13
|
+
using namespace rnoh;
|
|
14
|
+
|
|
15
|
+
std::vector<facebook::react::ComponentDescriptorProvider>
|
|
16
|
+
KeyboardControllerPackage::createComponentDescriptorProviders() {
|
|
17
|
+
return {facebook::react::concreteComponentDescriptorProvider<
|
|
18
|
+
facebook::react::KeyboardControllerViewComponentDescriptor>(),
|
|
19
|
+
facebook::react::concreteComponentDescriptorProvider<
|
|
20
|
+
facebook::react::KeyboardGestureAreaComponentDescriptor>()};
|
|
21
|
+
}
|
|
22
|
+
ComponentJSIBinderByString KeyboardControllerPackage::createComponentJSIBinderByName() {
|
|
23
|
+
return {{"RNKeyboardControllerView", std::make_shared<KeyboardControllerViewJSIBinder>()},
|
|
24
|
+
{"RNKeyboardGestureArea", std::make_shared<KeyboardGestureAreaJSIBinder>()}};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
std::unique_ptr<TurboModuleFactoryDelegate> KeyboardControllerPackage::createTurboModuleFactoryDelegate() {
|
|
28
|
+
return std::make_unique<KeyboardControllerTurboModuleFactoryDelegate>();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
ComponentInstanceFactoryDelegate::Shared KeyboardControllerPackage::createComponentInstanceFactoryDelegate() {
|
|
32
|
+
return std::make_shared<KeyboardControllerComponentInstanceFactoryDelegate>();
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
ComponentInstance::Shared KeyboardControllerPackage::createComponentInstance(const ComponentInstance::Context &ctx) {
|
|
36
|
+
if (ctx.componentName == "RNKeyboardControllerView") {
|
|
37
|
+
return std::make_shared<KeyboardControllerViewComponentInstance>(ctx);
|
|
38
|
+
}
|
|
39
|
+
if (ctx.componentName == "RNKeyboardGestureArea") {
|
|
40
|
+
return std::make_shared<KeyboardGestureAreaComponentInstance>(ctx);
|
|
41
|
+
}
|
|
42
|
+
return nullptr;
|
|
43
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
|
|
3
|
+
* Use of this source code is governed by a MIT license that can be
|
|
4
|
+
* found in the LICENSE file.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
#ifndef TESTER_HARMONY_KEYBOARD_CONTROLLER_SRC_MAIN_CPP_KEYBOARDCONTROLLERPACKAGE_H
|
|
8
|
+
#define TESTER_HARMONY_KEYBOARD_CONTROLLER_SRC_MAIN_CPP_KEYBOARDCONTROLLERPACKAGE_H
|
|
9
|
+
|
|
10
|
+
#ifndef KEYBOARDCONTROLLERPACKAGE_H
|
|
11
|
+
#define KEYBOARDCONTROLLERPACKAGE_H
|
|
12
|
+
|
|
13
|
+
#include "KeyboardGestureAreaComponentInstance.h"
|
|
14
|
+
#include "RNOH/Package.h"
|
|
15
|
+
#include "RNKeyboardController.h"
|
|
16
|
+
#include "RNStatusBarManagerCompat.h"
|
|
17
|
+
#include "KeyboardControllerViewComponentInstance.h"
|
|
18
|
+
namespace rnoh {
|
|
19
|
+
class KeyboardControllerComponentInstanceFactoryDelegate : public ComponentInstanceFactoryDelegate {
|
|
20
|
+
public:
|
|
21
|
+
ComponentInstance::Shared create(ComponentInstance::Context ctx) override {
|
|
22
|
+
if (ctx.componentName == "RNKeyboardControllerView") {
|
|
23
|
+
return std::make_shared<KeyboardControllerViewComponentInstance>(ctx);
|
|
24
|
+
}
|
|
25
|
+
if (ctx.componentName == "RNKeyboardGestureArea") {
|
|
26
|
+
return std::make_shared<KeyboardGestureAreaComponentInstance>(ctx);
|
|
27
|
+
}
|
|
28
|
+
return nullptr;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
class KeyboardControllerTurboModuleFactoryDelegate : public TurboModuleFactoryDelegate {
|
|
32
|
+
public:
|
|
33
|
+
SharedTurboModule createTurboModule(Context ctx, const std::string &name) const override {
|
|
34
|
+
if (name == "KeyboardController") {
|
|
35
|
+
return std::make_shared<KeyboardController>(ctx, name);
|
|
36
|
+
}
|
|
37
|
+
if (name == "StatusBarManagerCompat") {
|
|
38
|
+
return std::make_shared<StatusBarManagerCompat>(ctx, name);
|
|
39
|
+
}
|
|
40
|
+
return nullptr;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
class KeyboardControllerPackage : public Package{
|
|
44
|
+
public:
|
|
45
|
+
KeyboardControllerPackage(Package::Context ctx) : Package(ctx) {}
|
|
46
|
+
std::unique_ptr<TurboModuleFactoryDelegate> createTurboModuleFactoryDelegate() override;
|
|
47
|
+
std::vector<facebook::react::ComponentDescriptorProvider> createComponentDescriptorProviders() override;
|
|
48
|
+
ComponentJSIBinderByString createComponentJSIBinderByName() override;
|
|
49
|
+
ComponentInstance::Shared createComponentInstance(const ComponentInstance::Context &ctx) override;
|
|
50
|
+
ComponentInstanceFactoryDelegate::Shared createComponentInstanceFactoryDelegate() override;
|
|
51
|
+
};
|
|
52
|
+
} // namespace rnoh
|
|
53
|
+
|
|
54
|
+
#endif
|
|
55
|
+
|
|
56
|
+
#endif
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
|
|
3
|
+
* Use of this source code is governed by a MIT license that can be
|
|
4
|
+
* found in the LICENSE file.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import hilog from '@ohos.hilog';
|
|
8
|
+
|
|
9
|
+
class Logger {
|
|
10
|
+
private domain: number;
|
|
11
|
+
private prefix: string;
|
|
12
|
+
private format: string = '%{public}s, %{public}s';
|
|
13
|
+
private isDebug: boolean;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* constructor.
|
|
17
|
+
*
|
|
18
|
+
* @param Prefix Identifies the log tag.
|
|
19
|
+
* @param domain Domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFFF.
|
|
20
|
+
*/
|
|
21
|
+
constructor(prefix: string = 'MyApp', domain: number = 0xFF00, isDebug = false) {
|
|
22
|
+
this.prefix = prefix;
|
|
23
|
+
this.domain = domain;
|
|
24
|
+
this.isDebug = isDebug;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
debug(...args: string[]): void {
|
|
28
|
+
if(this.isDebug) {
|
|
29
|
+
hilog.debug(this.domain, this.prefix, this.format, args);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
info(...args: string[]): void {
|
|
34
|
+
hilog.info(this.domain, this.prefix, this.format, args);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
warn(...args: string[]): void {
|
|
38
|
+
hilog.warn(this.domain, this.prefix, this.format, args);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
error(...args: string[]): void {
|
|
42
|
+
hilog.error(this.domain, this.prefix, this.format, args);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export default new Logger('RNSVG', 0xFF00, false)
|