@react-native-ohos/react-native-keyboard-controller 1.16.6-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 +7 -0
- package/harmony/keyboard_controller/ResourceTable.txt +1 -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 +73 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewComponentInstance.cpp +172 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewComponentInstance.h +76 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewJSIBinder.h +44 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaComponentDescriptor.h +58 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaComponentInstance.cpp +87 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaComponentInstance.h +62 -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/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.ts +45 -0
- package/harmony/keyboard_controller/src/main/ets/RNKeyboardControllerTurboModule.ts +238 -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.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.ts +9 -0
- package/harmony/keyboard_controller.har +0 -0
- package/lib/commonjs/animated.js +176 -0
- package/lib/commonjs/animated.js.map +1 -0
- package/lib/commonjs/bindings.js +39 -0
- package/lib/commonjs/bindings.js.map +1 -0
- package/lib/commonjs/bindings.native.js +39 -0
- package/lib/commonjs/bindings.native.js.map +1 -0
- package/lib/commonjs/components/KeyboardAvoidingView/hooks.js +126 -0
- package/lib/commonjs/components/KeyboardAvoidingView/hooks.js.map +1 -0
- package/lib/commonjs/components/KeyboardAvoidingView/index.js +120 -0
- package/lib/commonjs/components/KeyboardAvoidingView/index.js.map +1 -0
- package/lib/commonjs/components/KeyboardAwareScrollView/index.js +262 -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 +41 -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 +161 -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 +27 -0
- package/lib/commonjs/constants.js.map +1 -0
- package/lib/commonjs/context.js +45 -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 +34 -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 +136 -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/module.js +47 -0
- package/lib/commonjs/module.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/specs/OverKeyboardViewNativeComponent.js +10 -0
- package/lib/commonjs/specs/OverKeyboardViewNativeComponent.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/commonjs/views/OverKeyboardView/index.js +42 -0
- package/lib/commonjs/views/OverKeyboardView/index.js.map +1 -0
- package/lib/commonjs/views/index.js +14 -0
- package/lib/commonjs/views/index.js.map +1 -0
- package/lib/module/animated.js +168 -0
- package/lib/module/animated.js.map +1 -0
- package/lib/module/bindings.js +33 -0
- package/lib/module/bindings.js.map +1 -0
- package/lib/module/bindings.native.js +33 -0
- package/lib/module/bindings.native.js.map +1 -0
- package/lib/module/components/KeyboardAvoidingView/hooks.js +118 -0
- package/lib/module/components/KeyboardAvoidingView/hooks.js.map +1 -0
- package/lib/module/components/KeyboardAvoidingView/index.js +113 -0
- package/lib/module/components/KeyboardAvoidingView/index.js.map +1 -0
- package/lib/module/components/KeyboardAwareScrollView/index.js +255 -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 +34 -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 +149 -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 +21 -0
- package/lib/module/constants.js.map +1 -0
- package/lib/module/context.js +38 -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 +27 -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 +12 -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/module.js +41 -0
- package/lib/module/module.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/specs/OverKeyboardViewNativeComponent.js +3 -0
- package/lib/module/specs/OverKeyboardViewNativeComponent.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/module/views/OverKeyboardView/index.js +35 -0
- package/lib/module/views/OverKeyboardView/index.js.map +1 -0
- package/lib/module/views/index.js +2 -0
- package/lib/module/views/index.js.map +1 -0
- package/lib/typescript/animated.d.ts +39 -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 +10 -0
- package/lib/typescript/components/KeyboardAvoidingView/index.d.ts +40 -0
- package/lib/typescript/components/KeyboardAwareScrollView/index.d.ts +29 -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 +39 -0
- package/lib/typescript/components/KeyboardToolbar/Arrow.d.ts +9 -0
- package/lib/typescript/components/KeyboardToolbar/Button.d.ts +16 -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 +52 -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 +10 -0
- package/lib/typescript/internal.d.ts +30 -0
- package/lib/typescript/module.d.ts +2 -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 +54 -0
- package/lib/typescript/specs/KeyboardGestureAreaNativeComponent.d.ts +12 -0
- package/lib/typescript/specs/NativeKeyboardController.d.ts +12 -0
- package/lib/typescript/specs/NativeStatusBarManagerCompat.d.ts +10 -0
- package/lib/typescript/specs/OverKeyboardViewNativeComponent.d.ts +7 -0
- package/lib/typescript/types.d.ts +161 -0
- package/lib/typescript/utils.d.ts +1 -0
- package/lib/typescript/views/OverKeyboardView/index.d.ts +5 -0
- package/lib/typescript/views/index.d.ts +1 -0
- package/package.json +173 -0
- package/react-native-keyboard-controller.podspec +61 -0
- package/src/animated.tsx +256 -0
- package/src/bindings.native.ts +62 -0
- package/src/bindings.ts +42 -0
- package/src/components/KeyboardAvoidingView/hooks.ts +123 -0
- package/src/components/KeyboardAvoidingView/index.tsx +188 -0
- package/src/components/KeyboardAwareScrollView/index.tsx +389 -0
- package/src/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.ts +133 -0
- package/src/components/KeyboardAwareScrollView/utils.ts +41 -0
- package/src/components/KeyboardStickyView/index.tsx +66 -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 +223 -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 +68 -0
- package/src/hooks/index.ts +90 -0
- package/src/hooks/useWindowDimensions/index.android.ts +38 -0
- package/src/hooks/useWindowDimensions/index.ts +1 -0
- package/src/index.ts +23 -0
- package/src/internal.ts +84 -0
- package/src/module.ts +52 -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 +71 -0
- package/src/specs/KeyboardGestureAreaNativeComponent.ts +20 -0
- package/src/specs/NativeKeyboardController.ts +19 -0
- package/src/specs/NativeStatusBarManagerCompat.ts +14 -0
- package/src/specs/OverKeyboardViewNativeComponent.ts +12 -0
- package/src/types.ts +243 -0
- package/src/utils.ts +1 -0
- package/src/views/OverKeyboardView/index.tsx +43 -0
- package/src/views/index.ts +1 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Kiryl Ziusko
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"Name": "react-native-keyboard-controller",
|
|
4
|
+
"License": "MIT License",
|
|
5
|
+
"License File": "https://github.com/kirillzyusko/react-native-keyboard-controller/blob/main/LICENSE",
|
|
6
|
+
"Version Number": "1.16.5",
|
|
7
|
+
"Owner" : "xiafeng@huawei.com",
|
|
8
|
+
"Upstream URL": "https://github.com/kirillzyusko/react-native-keyboard-controller",
|
|
9
|
+
"Description": "Keyboard manager which works in identical way on iOS and Android and harmony"
|
|
10
|
+
}
|
|
11
|
+
]
|
package/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# @react-native-ohos/react-native-keyboard-controller
|
|
2
|
+
|
|
3
|
+
本项目基于 [react-native-keyboard-controller (原库NPM包名)](https://github.com/kirillzyusko/react-native-keyboard-controller)
|
|
4
|
+
|
|
5
|
+
## 文档地址 / Documentation URL
|
|
6
|
+
|
|
7
|
+
[中文 / Chinese](https://gitee.com/react-native-oh-library/usage-docs/blob/master/zh-cn/react-native-keyboard-controller.md)
|
|
8
|
+
|
|
9
|
+
[英文 / English](https://gitee.com/react-native-oh-library/usage-docs/blob/master/en/react-native-keyboard-controller.md)
|
|
10
|
+
|
|
11
|
+
## Codegen
|
|
12
|
+
|
|
13
|
+
该库已接入 codegen,具体请查阅文档。
|
|
14
|
+
|
|
15
|
+
The library has been integrated with codegen. Please refer to the documentation for details.
|
|
16
|
+
|
|
17
|
+
## 请悉知 / Acknowledgements
|
|
18
|
+
|
|
19
|
+
本项目基于 [The MIT License (MIT)](https://github.com/kirillzyusko/react-native-keyboard-controller/blob/main/LICENSE) ,请自由地享受和参与开源。
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Use these variables when you tailor your ArkTS code. They must be of the const type.
|
|
3
|
+
*/
|
|
4
|
+
export const HAR_VERSION = '1.16.6-rc.1';
|
|
5
|
+
export const BUILD_MODE_NAME = 'debug';
|
|
6
|
+
export const DEBUG = true;
|
|
7
|
+
export const TARGET_NAME = 'default';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* BuildProfile Class is used only for compatibility purposes.
|
|
11
|
+
*/
|
|
12
|
+
export default class BuildProfile {
|
|
13
|
+
static readonly HAR_VERSION = HAR_VERSION;
|
|
14
|
+
static readonly BUILD_MODE_NAME = BUILD_MODE_NAME;
|
|
15
|
+
static readonly DEBUG = DEBUG;
|
|
16
|
+
static readonly TARGET_NAME = TARGET_NAME;
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
string page_show 0x03000000
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"apiType": "stageMode",
|
|
3
|
+
"buildOption": {
|
|
4
|
+
},
|
|
5
|
+
"buildOptionSet": [
|
|
6
|
+
{
|
|
7
|
+
"name": "release",
|
|
8
|
+
"arkOptions": {
|
|
9
|
+
"obfuscation": {
|
|
10
|
+
"ruleOptions": {
|
|
11
|
+
"enable": true,
|
|
12
|
+
"files": [
|
|
13
|
+
"./obfuscation-rules.txt"
|
|
14
|
+
]
|
|
15
|
+
},
|
|
16
|
+
"consumerFiles": [
|
|
17
|
+
"./consumer-rules.txt"
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
"targets": [
|
|
24
|
+
{
|
|
25
|
+
"name": "default"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"name": "ohosTest"
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Define project specific obfuscation rules here.
|
|
2
|
+
# You can include the obfuscation configuration files in the current module's build-profile.json5.
|
|
3
|
+
#
|
|
4
|
+
# For more details, see
|
|
5
|
+
# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5
|
|
6
|
+
|
|
7
|
+
# Obfuscation options:
|
|
8
|
+
# -disable-obfuscation: disable all obfuscations
|
|
9
|
+
# -enable-property-obfuscation: obfuscate the property names
|
|
10
|
+
# -enable-toplevel-obfuscation: obfuscate the names in the global scope
|
|
11
|
+
# -compact: remove unnecessary blank spaces and all line feeds
|
|
12
|
+
# -remove-log: remove all console.* statements
|
|
13
|
+
# -print-namecache: print the name cache that contains the mapping from the old names to new names
|
|
14
|
+
# -apply-namecache: reuse the given cache file
|
|
15
|
+
|
|
16
|
+
# Keep options:
|
|
17
|
+
# -keep-property-name: specifies property names that you want to keep
|
|
18
|
+
# -keep-global-name: specifies names that you want to keep in the global scope
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@react-native-ohos/react-native-keyboard-controller",
|
|
3
|
+
"version": "1.16.6-rc.1",
|
|
4
|
+
"description": " control keyboard show or hide",
|
|
5
|
+
"main": "Index.ets",
|
|
6
|
+
"author": "",
|
|
7
|
+
"license": "MIT License",
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"@rnoh/react-native-openharmony": "file:../react_native_openharmony",
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.13)
|
|
2
|
+
set(CMAKE_VERBOSE_MAKEFILE on)
|
|
3
|
+
|
|
4
|
+
file(GLOB rnoh_keyboard_controller_SRC CONFIGURE_DEPENDS *.cpp)
|
|
5
|
+
add_library(rnoh_keyboard_controller SHARED ${rnoh_keyboard_controller_SRC})
|
|
6
|
+
target_include_directories(rnoh_keyboard_controller PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
|
7
|
+
target_link_libraries(rnoh_keyboard_controller PUBLIC rnoh)
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* MIT License
|
|
6
|
+
*
|
|
7
|
+
* Copyright (C) 2024 Huawei Device Co., Ltd.
|
|
8
|
+
*
|
|
9
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
11
|
+
* in the Software without restriction, including without limitation the rights
|
|
12
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
14
|
+
* furnished to do so, subject to the following conditions:
|
|
15
|
+
*
|
|
16
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
17
|
+
* copies or substantial portions of the Software.
|
|
18
|
+
*
|
|
19
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
25
|
+
* SOFTWARE.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
#include <glog/logging.h>
|
|
29
|
+
#include "EventEmitters.h"
|
|
30
|
+
|
|
31
|
+
namespace facebook {
|
|
32
|
+
namespace react {
|
|
33
|
+
|
|
34
|
+
void KeyboardControllerViewEventEmitter::onKeyboardMoveStart(MoveEvent event) const {
|
|
35
|
+
dispatchEvent("KeyboardMoveStart", [event = std::move(event)](jsi::Runtime &runtime) {
|
|
36
|
+
auto payload = jsi::Object(runtime);
|
|
37
|
+
payload.setProperty(runtime, "height", event.height);
|
|
38
|
+
payload.setProperty(runtime, "target", event.target);
|
|
39
|
+
payload.setProperty(runtime, "duration", event.duration);
|
|
40
|
+
payload.setProperty(runtime, "progress", event.progress);
|
|
41
|
+
return payload;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
void KeyboardControllerViewEventEmitter::onKeyboardMove(MoveEvent event) const {
|
|
46
|
+
dispatchEvent("KeyboardMove", [event = std::move(event)](jsi::Runtime &runtime) {
|
|
47
|
+
auto payload = jsi::Object(runtime);
|
|
48
|
+
payload.setProperty(runtime, "height", event.height);
|
|
49
|
+
payload.setProperty(runtime, "target", event.target);
|
|
50
|
+
payload.setProperty(runtime, "duration", event.duration);
|
|
51
|
+
payload.setProperty(runtime, "progress", event.progress);
|
|
52
|
+
return payload;
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
void KeyboardControllerViewEventEmitter::onKeyboardMoveEnd(MoveEvent event) const {
|
|
56
|
+
dispatchEvent("KeyboardMoveEnd", [event = std::move(event)](jsi::Runtime &runtime) {
|
|
57
|
+
auto payload = jsi::Object(runtime);
|
|
58
|
+
payload.setProperty(runtime, "height", event.height);
|
|
59
|
+
payload.setProperty(runtime, "target", event.target);
|
|
60
|
+
payload.setProperty(runtime, "duration", event.duration);
|
|
61
|
+
payload.setProperty(runtime, "progress", event.progress);
|
|
62
|
+
return payload;
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
void KeyboardControllerViewEventEmitter::onKeyboardMoveInteractive(MoveEvent event) const {
|
|
66
|
+
dispatchEvent("KeyboardMoveInteractive", [event = std::move(event)](jsi::Runtime &runtime) {
|
|
67
|
+
auto payload = jsi::Object(runtime);
|
|
68
|
+
payload.setProperty(runtime, "height", event.height);
|
|
69
|
+
payload.setProperty(runtime, "target", event.target);
|
|
70
|
+
payload.setProperty(runtime, "duration", event.duration);
|
|
71
|
+
payload.setProperty(runtime, "progress", event.progress);
|
|
72
|
+
return payload;
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
void KeyboardControllerViewEventEmitter::onFocusedInputLayoutChanged(InputLayoutEvent event) const {
|
|
76
|
+
dispatchEvent("FocusedInputLayoutChanged", [event = std::move(event)](jsi::Runtime &runtime) {
|
|
77
|
+
auto payload = jsi::Object(runtime);
|
|
78
|
+
return payload;
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
void KeyboardControllerViewEventEmitter::onFocusedInputTextChanged(TextChangeEvent event) const {
|
|
82
|
+
dispatchEvent("FocusedInputTextChanged", [event = std::move(event)](jsi::Runtime &runtime) {
|
|
83
|
+
auto payload = jsi::Object(runtime);
|
|
84
|
+
payload.setProperty(runtime, "text", event.text);
|
|
85
|
+
return payload;
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
void KeyboardControllerViewEventEmitter::onFocusedInputSelectionChanged(InputSectionEvent event) const {
|
|
89
|
+
dispatchEvent("FocusedInputSelectionChanged", [event = std::move(event)](jsi::Runtime &runtime) {
|
|
90
|
+
auto payload = jsi::Object(runtime);
|
|
91
|
+
return payload;
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
} // namespace react
|
|
96
|
+
} // namespace facebook
|
|
@@ -0,0 +1,90 @@
|
|
|
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_EVENTEMITTERS_H
|
|
8
|
+
#define TESTER_HARMONY_KEYBOARD_CONTROLLER_SRC_MAIN_CPP_EVENTEMITTERS_H
|
|
9
|
+
|
|
10
|
+
#ifndef EVENTEMITTERS_H
|
|
11
|
+
#define EVENTEMITTERS_H
|
|
12
|
+
|
|
13
|
+
#pragma once
|
|
14
|
+
#include <react/renderer/components/view/ViewEventEmitter.h>
|
|
15
|
+
#include <react/renderer/core/EventEmitter.h>
|
|
16
|
+
#include <jsi/jsi.h>
|
|
17
|
+
|
|
18
|
+
namespace facebook {
|
|
19
|
+
namespace react {
|
|
20
|
+
class JSI_EXPORT KeyboardController : public EventEmitter {
|
|
21
|
+
public:
|
|
22
|
+
using EventEmitter::EventEmitter;
|
|
23
|
+
struct KeyboardEvent {
|
|
24
|
+
double height;
|
|
25
|
+
float duration;
|
|
26
|
+
double timestamp;
|
|
27
|
+
int target;
|
|
28
|
+
};
|
|
29
|
+
void keyboardWillShow(KeyboardEvent value) const;
|
|
30
|
+
void keyboardDidShow(KeyboardEvent value) const;
|
|
31
|
+
void keyboardWillHide(KeyboardEvent value) const;
|
|
32
|
+
void keyboardDidHide(KeyboardEvent value) const;
|
|
33
|
+
void focusDidSet(KeyboardEvent value) const;
|
|
34
|
+
};
|
|
35
|
+
class JSI_EXPORT KeyboardControllerViewEventEmitter : public ViewEventEmitter {
|
|
36
|
+
public:
|
|
37
|
+
using ViewEventEmitter::ViewEventEmitter;
|
|
38
|
+
|
|
39
|
+
struct MoveEvent {
|
|
40
|
+
double height;
|
|
41
|
+
double progress;
|
|
42
|
+
float duration;
|
|
43
|
+
int target;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
struct InputLayoutEvent {
|
|
47
|
+
int parentScrollViewTarget;
|
|
48
|
+
int target;
|
|
49
|
+
struct layout {
|
|
50
|
+
double absoluteX;
|
|
51
|
+
double absoluteY;
|
|
52
|
+
double x;
|
|
53
|
+
double y;
|
|
54
|
+
double width;
|
|
55
|
+
double height;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
struct TextChangeEvent {
|
|
59
|
+
std::string text;
|
|
60
|
+
};
|
|
61
|
+
struct InputSectionEvent {
|
|
62
|
+
int target;
|
|
63
|
+
struct selection {
|
|
64
|
+
struct start {
|
|
65
|
+
double x;
|
|
66
|
+
double y;
|
|
67
|
+
int position;
|
|
68
|
+
};
|
|
69
|
+
struct end {
|
|
70
|
+
double x;
|
|
71
|
+
double y;
|
|
72
|
+
int position;
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
void onKeyboardMoveStart(MoveEvent value) const;
|
|
78
|
+
void onKeyboardMove(MoveEvent value) const;
|
|
79
|
+
void onKeyboardMoveEnd(MoveEvent value) const;
|
|
80
|
+
void onKeyboardMoveInteractive(MoveEvent value) const;
|
|
81
|
+
void onFocusedInputLayoutChanged(InputLayoutEvent value) const;
|
|
82
|
+
void onFocusedInputTextChanged(TextChangeEvent value) const;
|
|
83
|
+
void onFocusedInputSelectionChanged(InputSectionEvent value) const;
|
|
84
|
+
};
|
|
85
|
+
} // namespace react
|
|
86
|
+
} // namespace facebook
|
|
87
|
+
|
|
88
|
+
#endif
|
|
89
|
+
|
|
90
|
+
#endif
|
|
@@ -0,0 +1,73 @@
|
|
|
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_KEYBOARDCONTROLLERVIEWCOMPONENTDESCRIPTOR_H
|
|
8
|
+
#define TESTER_HARMONY_KEYBOARD_CONTROLLER_SRC_MAIN_CPP_KEYBOARDCONTROLLERVIEWCOMPONENTDESCRIPTOR_H
|
|
9
|
+
|
|
10
|
+
#ifndef KEYBOARDCONTROLLERVIEWCOMPONENTDESCRIPTOR_H
|
|
11
|
+
#define KEYBOARDCONTROLLERVIEWCOMPONENTDESCRIPTOR_H
|
|
12
|
+
|
|
13
|
+
/*
|
|
14
|
+
* Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* This code was generated by "react-native codegen-harmony"
|
|
19
|
+
*
|
|
20
|
+
* Do not edit this file as changes may cause incorrect behavior and will be
|
|
21
|
+
* lost once the code is regenerated.
|
|
22
|
+
*
|
|
23
|
+
* @generatorVersion: 1
|
|
24
|
+
*/
|
|
25
|
+
#pragma once
|
|
26
|
+
|
|
27
|
+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
28
|
+
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
29
|
+
#include <react/renderer/components/view/ViewShadowNode.h>
|
|
30
|
+
#include <react/renderer/core/propsConversions.h>
|
|
31
|
+
#include "EventEmitters.h"
|
|
32
|
+
|
|
33
|
+
namespace facebook {
|
|
34
|
+
namespace react {
|
|
35
|
+
|
|
36
|
+
inline const char KeyboardControllerViewName[] = "RNKeyboardControllerView";
|
|
37
|
+
|
|
38
|
+
class KeyboardControllerViewProps : public ViewProps {
|
|
39
|
+
public:
|
|
40
|
+
bool enabled;
|
|
41
|
+
bool statusBarTranslucent;
|
|
42
|
+
bool navigationBarTranslucent;
|
|
43
|
+
bool preserveEdgeToEdge;
|
|
44
|
+
KeyboardControllerViewProps() = default;
|
|
45
|
+
|
|
46
|
+
KeyboardControllerViewProps(const PropsParserContext &context, const KeyboardControllerViewProps &sourceProps,
|
|
47
|
+
const RawProps &rawProps)
|
|
48
|
+
: ViewProps(context, sourceProps, rawProps),
|
|
49
|
+
enabled(convertRawProp(context, rawProps, "enabled", sourceProps.enabled, {false})),
|
|
50
|
+
statusBarTranslucent(convertRawProp(context, rawProps, "statusBarTranslucent",
|
|
51
|
+
sourceProps.statusBarTranslucent, {false})),
|
|
52
|
+
navigationBarTranslucent(convertRawProp(context, rawProps, "navigationBarTranslucent",
|
|
53
|
+
sourceProps.navigationBarTranslucent, {false})),
|
|
54
|
+
preserveEdgeToEdge(convertRawProp(context, rawProps, "preserveEdgeToEdge", sourceProps.preserveEdgeToEdge, {true})){}
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
using KeyboardControllerViewShadowNode =
|
|
58
|
+
ConcreteViewShadowNode<KeyboardControllerViewName, KeyboardControllerViewProps, KeyboardControllerViewEventEmitter>;
|
|
59
|
+
|
|
60
|
+
class KeyboardControllerViewComponentDescriptor final
|
|
61
|
+
: public ConcreteComponentDescriptor<KeyboardControllerViewShadowNode> {
|
|
62
|
+
public:
|
|
63
|
+
KeyboardControllerViewComponentDescriptor(ComponentDescriptorParameters const ¶meters)
|
|
64
|
+
: ConcreteComponentDescriptor(parameters) {}
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
} // namespace react
|
|
69
|
+
} // namespace facebook
|
|
70
|
+
|
|
71
|
+
#endif
|
|
72
|
+
|
|
73
|
+
#endif
|
|
@@ -0,0 +1,172 @@
|
|
|
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 "KeyboardControllerViewComponentInstance.h"
|
|
8
|
+
#include <folly/dynamic.h>
|
|
9
|
+
#include <iostream>
|
|
10
|
+
|
|
11
|
+
namespace rnoh {
|
|
12
|
+
using KeyboardControllerStatus = rnoh::KeyboardControllerStatus;
|
|
13
|
+
KeyboardControllerViewComponentInstance::KeyboardControllerViewComponentInstance(Context context)
|
|
14
|
+
: CppComponentInstance(std::move(context)), ArkTSMessageHub::Observer(m_deps->arkTSMessageHub) {
|
|
15
|
+
DLOG(INFO) << "KeyboardControllerViewComponentInstance";
|
|
16
|
+
|
|
17
|
+
m_customNode.setCustomNodeDelegate(this);
|
|
18
|
+
}
|
|
19
|
+
void KeyboardControllerViewComponentInstance::onChildInserted(ComponentInstance::Shared const &childComponentInstance,
|
|
20
|
+
std::size_t index) {
|
|
21
|
+
CppComponentInstance::onChildInserted(childComponentInstance, index);
|
|
22
|
+
m_customNode.insertChild(childComponentInstance->getLocalRootArkUINode(), index + 1);
|
|
23
|
+
DLOG(INFO) << "###111" << childComponentInstance->getComponentName();
|
|
24
|
+
findTextInputComponents(childComponentInstance);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
void KeyboardControllerViewComponentInstance::onChildRemoved(ComponentInstance::Shared const &childComponentInstance) {
|
|
28
|
+
CppComponentInstance::onChildRemoved(childComponentInstance);
|
|
29
|
+
m_customNode.removeChild(childComponentInstance->getLocalRootArkUINode());
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
void KeyboardControllerViewComponentInstance::onPropsChanged(SharedConcreteProps const &props) {
|
|
33
|
+
DLOG(INFO) << "###onPropsChanged" << props->enabled << props->statusBarTranslucent
|
|
34
|
+
<< props->navigationBarTranslucent << props->preserveEdgeToEdge;
|
|
35
|
+
CppComponentInstance::onPropsChanged(props);
|
|
36
|
+
if (this->enabled != props->enabled) {
|
|
37
|
+
this->enabled = props->enabled;
|
|
38
|
+
this->startKeyboardObserver();
|
|
39
|
+
}
|
|
40
|
+
if (this->navigationBarTranslucent != props->navigationBarTranslucent) {
|
|
41
|
+
this->navigationBarTranslucent = props->navigationBarTranslucent;
|
|
42
|
+
this->setWindowSystemBarEnable();
|
|
43
|
+
}
|
|
44
|
+
if (this->statusBarTranslucent != props->statusBarTranslucent) {
|
|
45
|
+
this->statusBarTranslucent = props->statusBarTranslucent;
|
|
46
|
+
this->setWindowSystemBarEnable();
|
|
47
|
+
}
|
|
48
|
+
if (this->preserveEdgeToEdge != props->preserveEdgeToEdge) {
|
|
49
|
+
this->preserveEdgeToEdge = props->preserveEdgeToEdge;
|
|
50
|
+
this->setWindowLayoutFullScreen();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
void KeyboardControllerViewComponentInstance::onCommandReceived(std::string const &commandName,
|
|
55
|
+
folly::dynamic const &args) {
|
|
56
|
+
CppComponentInstance::onCommandReceived(commandName, args);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
ArkUINode &KeyboardControllerViewComponentInstance::getLocalRootArkUINode() { return m_customNode; }
|
|
60
|
+
void KeyboardControllerViewComponentInstance::onClick() {}
|
|
61
|
+
void KeyboardControllerViewComponentInstance::onMessageReceived(ArkTSMessage const &message) {
|
|
62
|
+
DLOG(INFO) << "onMessageReceived";
|
|
63
|
+
if (message.name == "keyboardHeightChange") {
|
|
64
|
+
double height = message.payload.getDouble();
|
|
65
|
+
DLOG(INFO) << "keyboardHeightChange: " << height;
|
|
66
|
+
if (height > 0) {
|
|
67
|
+
this->keyboardStatus = KeyboardControllerStatus::SHOW;
|
|
68
|
+
this->keyboardHeight = height;
|
|
69
|
+
}
|
|
70
|
+
if (height == 0) {
|
|
71
|
+
this->keyboardStatus = KeyboardControllerStatus::HIDE;
|
|
72
|
+
}
|
|
73
|
+
this->keyboardHeightChangeHandle();
|
|
74
|
+
}
|
|
75
|
+
if (message.name == "setFocusTo") {
|
|
76
|
+
// to do
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
void KeyboardControllerViewComponentInstance::setWindowSystemBarEnable() {
|
|
80
|
+
auto rnInstancePtr = this->m_deps->rnInstance.lock();
|
|
81
|
+
if (rnInstancePtr != nullptr) {
|
|
82
|
+
auto turboModule = rnInstancePtr->getTurboModule("KeyboardController");
|
|
83
|
+
auto arkTsTurboModule = std::dynamic_pointer_cast<rnoh::ArkTSTurboModule>(turboModule);
|
|
84
|
+
arkTsTurboModule->callSync("setWindowSystemBarEnable", {this->statusBarTranslucent, this->navigationBarTranslucent});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
void KeyboardControllerViewComponentInstance::startKeyboardObserver() {
|
|
89
|
+
auto rnInstancePtr = this->m_deps->rnInstance.lock();
|
|
90
|
+
if (rnInstancePtr != nullptr) {
|
|
91
|
+
auto turboModule = rnInstancePtr->getTurboModule("KeyboardController");
|
|
92
|
+
auto arkTsTurboModule = std::dynamic_pointer_cast<rnoh::ArkTSTurboModule>(turboModule);
|
|
93
|
+
arkTsTurboModule->callSync("startKeyboardObserver", {this->enabled});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
void KeyboardControllerViewComponentInstance::keyboardHeightChangeHandle() {
|
|
99
|
+
auto rnInstancePtr = this->m_deps->rnInstance.lock();
|
|
100
|
+
if (rnInstancePtr != nullptr && this->enabled) {
|
|
101
|
+
if (this->keyboardStatus == KeyboardControllerStatus::HIDE) {
|
|
102
|
+
facebook::react::KeyboardControllerViewEventEmitter::MoveEvent start = {this->keyboardHeight, 0, 0, m_tag};
|
|
103
|
+
facebook::react::KeyboardControllerViewEventEmitter::MoveEvent end = {0, 0, 0, m_tag};
|
|
104
|
+
m_eventEmitter->onKeyboardMoveStart(start);
|
|
105
|
+
m_eventEmitter->onKeyboardMove(end);
|
|
106
|
+
m_eventEmitter->onKeyboardMoveEnd(end);
|
|
107
|
+
} else {
|
|
108
|
+
facebook::react::KeyboardControllerViewEventEmitter::MoveEvent start = {0, 0, 0, m_tag};
|
|
109
|
+
facebook::react::KeyboardControllerViewEventEmitter::MoveEvent end = {this->keyboardHeight, 1, 0, m_tag};
|
|
110
|
+
m_eventEmitter->onKeyboardMoveStart(start);
|
|
111
|
+
m_eventEmitter->onKeyboardMove(end);
|
|
112
|
+
m_eventEmitter->onKeyboardMoveEnd(end);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
void KeyboardControllerViewComponentInstance::setWindowLayoutFullScreen() {
|
|
118
|
+
auto rnInstancePtr = this->m_deps->rnInstance.lock();
|
|
119
|
+
if (rnInstancePtr != nullptr) {
|
|
120
|
+
auto turboModule = rnInstancePtr->getTurboModule("KeyboardController");
|
|
121
|
+
auto arkTsTurboModule = std::dynamic_pointer_cast<rnoh::ArkTSTurboModule>(turboModule);
|
|
122
|
+
arkTsTurboModule->callSync("setWindowLayoutFullScreen", {this->preserveEdgeToEdge});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* 遍历查找TextInput
|
|
128
|
+
* */
|
|
129
|
+
void KeyboardControllerViewComponentInstance::findTextInputComponents(
|
|
130
|
+
ComponentInstance::Shared const &childComponentInstance) {
|
|
131
|
+
std::string name = childComponentInstance->getComponentName();
|
|
132
|
+
DLOG(INFO) << "###" << name;
|
|
133
|
+
if (name.find("TextInput") != std::string::npos || name.find("TextArea") != std::string::npos) {
|
|
134
|
+
auto input = std::dynamic_pointer_cast<TextInputComponentInstance>(childComponentInstance);
|
|
135
|
+
ArkUINode &node = input->getLocalRootArkUINode();
|
|
136
|
+
TextInputNode *inputNodePtr = dynamic_cast<TextInputNode *>(&node);
|
|
137
|
+
if (!inputNodePtr) {
|
|
138
|
+
TextAreaNode *textAreaNodePtr = dynamic_cast<TextAreaNode *>(&node);
|
|
139
|
+
textAreaNodePtr->setTextAreaNodeDelegate(this);
|
|
140
|
+
} else {
|
|
141
|
+
inputNodePtr->setTextInputNodeDelegate(this);
|
|
142
|
+
}
|
|
143
|
+
this->textInputVector.push_back(input);
|
|
144
|
+
}
|
|
145
|
+
auto childrenComponentInstances = childComponentInstance->getChildren();
|
|
146
|
+
if (childrenComponentInstances.empty()) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
std::vector<ComponentInstance::Shared>::iterator it1;
|
|
151
|
+
for (it1 = childrenComponentInstances.begin(); it1 != childrenComponentInstances.end(); ++it1) {
|
|
152
|
+
ComponentInstance::Shared const &t = *it1;
|
|
153
|
+
findTextInputComponents(t);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
void KeyboardControllerViewComponentInstance::onChange(std::string text) {
|
|
158
|
+
facebook::react::KeyboardControllerViewEventEmitter::TextChangeEvent event = {text};
|
|
159
|
+
if(this->enabled){
|
|
160
|
+
m_eventEmitter->onFocusedInputTextChanged(event);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
}
|
|
164
|
+
void KeyboardControllerViewComponentInstance::onTextSelectionChange(int32_t location, int32_t length) {
|
|
165
|
+
DLOG(INFO) << " onKeyboardControllerView onTextSelectionChange";
|
|
166
|
+
// to do
|
|
167
|
+
};
|
|
168
|
+
void KeyboardControllerViewComponentInstance::onFocus() { DLOG(INFO) << " onKeyboardControllerView onFocus"; }
|
|
169
|
+
void KeyboardControllerViewComponentInstance::onBlur() { DLOG(INFO) << " onKeyboardControllerView onBlur"; }
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
} // namespace rnoh
|