@react-native-ohos/react-native-keyboard-controller 1.12.8-rc.6 → 1.12.8

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.
Files changed (107) hide show
  1. package/harmony/keyboard_controller/BuildProfile.ets +16 -16
  2. package/harmony/keyboard_controller/Index.ets +24 -3
  3. package/harmony/keyboard_controller/oh-package-lock.json5 +2 -3
  4. package/harmony/keyboard_controller/oh-package.json5 +1 -1
  5. package/harmony/keyboard_controller/src/main/cpp/EventEmitters.h +24 -3
  6. package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewComponentDescriptor.h +24 -3
  7. package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewComponentInstance.cpp +122 -6
  8. package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewComponentInstance.h +30 -3
  9. package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewJSIBinder.h +24 -3
  10. package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaComponentDescriptor.h +24 -3
  11. package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaComponentInstance.cpp +24 -3
  12. package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaComponentInstance.h +24 -3
  13. package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaJSIBinder.h +24 -3
  14. package/harmony/keyboard_controller/src/main/cpp/RNKeyboardController.cpp +24 -3
  15. package/harmony/keyboard_controller/src/main/cpp/RNKeyboardController.h +24 -3
  16. package/harmony/keyboard_controller/src/main/cpp/RNKeyboardControllerPackage.cpp +24 -3
  17. package/harmony/keyboard_controller/src/main/cpp/RNKeyboardControllerPackage.h +24 -3
  18. package/harmony/keyboard_controller/src/main/cpp/RNStatusBarManagerCompat.cpp +24 -3
  19. package/harmony/keyboard_controller/src/main/cpp/RNStatusBarManagerCompat.h +24 -3
  20. package/harmony/keyboard_controller/src/main/cpp/ViewHierarchyNavigator.cpp +186 -0
  21. package/harmony/keyboard_controller/src/main/cpp/ViewHierarchyNavigator.h +112 -0
  22. package/harmony/keyboard_controller/src/main/cpp/keyboardControllerPackage.cpp +24 -3
  23. package/harmony/keyboard_controller/src/main/cpp/keyboardControllerPackage.h +24 -3
  24. package/harmony/keyboard_controller/src/main/ets/Logger.ts +24 -3
  25. package/harmony/keyboard_controller/src/main/ets/RNKeyboardControllerPackage.ets +29 -5
  26. package/harmony/keyboard_controller/src/main/ets/RNKeyboardControllerTurboModule.ts +38 -3
  27. package/harmony/keyboard_controller/src/main/ets/RNStatusBarManagerCompatTurboModule.ts +24 -3
  28. package/harmony/keyboard_controller/src/main/ets/Type.ts +24 -3
  29. package/harmony/keyboard_controller/ts.ets +24 -3
  30. package/harmony/keyboard_controller.har +0 -0
  31. package/lib/commonjs/animated.js +14 -11
  32. package/lib/commonjs/animated.js.map +1 -1
  33. package/lib/commonjs/constants.js +2 -0
  34. package/lib/commonjs/constants.js.map +1 -1
  35. package/lib/module/animated.js +14 -11
  36. package/lib/module/animated.js.map +1 -1
  37. package/lib/module/constants.js +2 -0
  38. package/lib/module/constants.js.map +1 -1
  39. package/package.json +3 -2
  40. package/src/animated.tsx +12 -8
  41. package/harmony/keyboard_controller/build/default/cache/default/default@HarCompileArkTS/esmodule/.ts_checker_cache +0 -5166
  42. package/harmony/keyboard_controller/build/default/cache/default/default@HarCompileArkTS/esmodule/.tsbuildinfo +0 -1
  43. package/harmony/keyboard_controller/build/default/cache/default/default@HarCompileArkTS/esmodule/.tsbuildinfo.linter +0 -1
  44. package/harmony/keyboard_controller/build/default/cache/default/default@HarCompileArkTS/esmodule/compileInfo.json +0 -1
  45. package/harmony/keyboard_controller/build/default/cache/default/default@HarCompileArkTS/esmodule/debug/compiler.cache/modules/Index.ets-96716712ed80a95f9b3cb8c16433a37c.msgpack +0 -0
  46. package/harmony/keyboard_controller/build/default/cache/default/default@HarCompileArkTS/esmodule/debug/compiler.cache/modules/Logger.ts-21e5e905df1c99fc6e6ca37bbbfcb51e.msgpack +0 -0
  47. package/harmony/keyboard_controller/build/default/cache/default/default@HarCompileArkTS/esmodule/debug/compiler.cache/modules/RNKeyboardControllerPackage.ets-c2108552e32e54da4e2ee2cd039239a4.msgpack +0 -0
  48. package/harmony/keyboard_controller/build/default/cache/default/default@HarCompileArkTS/esmodule/debug/compiler.cache/modules/RNKeyboardControllerTurboModule.ts-7c42679e7e488d1a60c8b4d54f079abb.msgpack +0 -0
  49. package/harmony/keyboard_controller/build/default/cache/default/default@HarCompileArkTS/esmodule/debug/compiler.cache/modules/RNStatusBarManagerCompatTurboModule.ts-c9b80946df3cc584c8042691aeb9fbb1.msgpack +0 -0
  50. package/harmony/keyboard_controller/build/default/cache/default/default@HarCompileArkTS/esmodule/debug/compiler.cache/modules/Type.ts-8709f2f912199ff74f40eb894b697a77.msgpack +0 -0
  51. package/harmony/keyboard_controller/build/default/cache/default/default@HarCompileArkTS/esmodule/debug/compiler.cache/modules/ts.ets-70cab636273e777c0f945b068fe2fec4.msgpack +0 -0
  52. package/harmony/keyboard_controller/build/default/cache/default/default@HarCompileArkTS/esmodule/debug/compiler.cache/other/pkgName2SourceRoots.msgpack +0 -1
  53. package/harmony/keyboard_controller/build/default/cache/default/default@HarCompileArkTS/esmodule/debug/compiler.cache/plugins/plugins.msgpack +0 -0
  54. package/harmony/keyboard_controller/build/default/cache/default/default@HarCompileArkTS/esmodule/debug/dep_info.json +0 -1
  55. package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/BuildProfile.ets +0 -17
  56. package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/Index.ets +0 -9
  57. package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/ResourceTable.txt +0 -1
  58. package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/build-profile.json5 +0 -31
  59. package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/consumer-rules.txt +0 -0
  60. package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/hvigorfile.ts +0 -6
  61. package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/obfuscation-rules.txt +0 -18
  62. package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/oh-package-lock.json5 +0 -20
  63. package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/oh-package.json5 +0 -1
  64. package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/cpp/CMakeLists.txt +0 -7
  65. package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/cpp/EventEmitters.cpp +0 -96
  66. package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/cpp/EventEmitters.h +0 -90
  67. package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/cpp/KeyboardControllerViewComponentDescriptor.h +0 -77
  68. package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/cpp/KeyboardControllerViewComponentInstance.cpp +0 -158
  69. package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/cpp/KeyboardControllerViewComponentInstance.h +0 -74
  70. package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/cpp/KeyboardControllerViewJSIBinder.h +0 -43
  71. package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/cpp/KeyboardGestureAreaComponentDescriptor.h +0 -64
  72. package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/cpp/KeyboardGestureAreaComponentInstance.cpp +0 -89
  73. package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/cpp/KeyboardGestureAreaComponentInstance.h +0 -63
  74. package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/cpp/KeyboardGestureAreaJSIBinder.h +0 -39
  75. package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/cpp/RNKeyboardController.cpp +0 -25
  76. package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/cpp/RNKeyboardController.h +0 -27
  77. package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/cpp/RNKeyboardControllerPackage.cpp +0 -43
  78. package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/cpp/RNKeyboardControllerPackage.h +0 -56
  79. package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/cpp/RNStatusBarManagerCompat.cpp +0 -24
  80. package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/cpp/RNStatusBarManagerCompat.h +0 -28
  81. package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/cpp/keyboardControllerPackage.cpp +0 -43
  82. package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/cpp/keyboardControllerPackage.h +0 -56
  83. package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/ets/Logger.ts +0 -46
  84. package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/ets/RNKeyboardControllerPackage.ets +0 -46
  85. package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/ets/RNKeyboardControllerTurboModule.ts +0 -210
  86. package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/ets/RNStatusBarManagerCompatTurboModule.ts +0 -98
  87. package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/ets/Type.ts +0 -41
  88. package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/module.json +0 -32
  89. package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/resources/base/element/string.json +0 -8
  90. package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/resources/en_US/element/string.json +0 -8
  91. package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/resources/zh_CN/element/string.json +0 -8
  92. package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/ts.ets +0 -9
  93. package/harmony/keyboard_controller/build/default/generated/pm/default/oh-package.json5 +0 -1
  94. package/harmony/keyboard_controller/build/default/generated/r/default/ResourceTable.h +0 -24
  95. package/harmony/keyboard_controller/build/default/intermediates/loader/default/loader.json +0 -28
  96. package/harmony/keyboard_controller/build/default/intermediates/merge_profile/default/module.json +0 -29
  97. package/harmony/keyboard_controller/build/default/intermediates/patch/default/base_native_libs.json +0 -1
  98. package/harmony/keyboard_controller/build/default/intermediates/process_profile/default/module.json +0 -32
  99. package/harmony/keyboard_controller/build/default/intermediates/res/default/ResourceTable.txt +0 -1
  100. package/harmony/keyboard_controller/build/default/intermediates/res/default/ark_module.json +0 -1
  101. package/harmony/keyboard_controller/build/default/intermediates/res/default/ids_map/id_defined.json +0 -7
  102. package/harmony/keyboard_controller/build/default/intermediates/res/default/module.json +0 -28
  103. package/harmony/keyboard_controller/build/default/intermediates/res/default/opt-compression.json +0 -1
  104. package/harmony/keyboard_controller/build/default/intermediates/res/default/resConfig.json +0 -1
  105. package/harmony/keyboard_controller/build/default/intermediates/res/default/resources.index +0 -0
  106. package/harmony/keyboard_controller/build/default/outputs/default/keyboard_controller.har +0 -0
  107. package/react-native-keyboard-controller.podspec +0 -61
@@ -1 +0,0 @@
1
- {"resolveConflictMode":false,"depName2DepInfo":{"keyboard_controller":{"dependencyType":"har","isByteCodeHar":false,"pkgRootPath":"E:\\github\\react-native-keyboard-controller\\harmony\\keyboard_controller","pkgName":"@react-native-ohos/react-native-keyboard-controller","pkgVersion":"1.12.8-rc.6"},"@rnoh/react-native-openharmony":{"dependencyType":"har","isByteCodeHar":false,"pkgRootPath":"E:\\code\\reanimated\\tester\\harmony\\oh_modules\\.ohpm\\@rnoh+react-native-openharmony@vxxmhmr1t+pcc5jbusidnjj9nnrdumn1pfcgh2cazim=\\oh_modules\\@rnoh\\react-native-openharmony","pkgName":"@rnoh/react-native-openharmony","pkgVersion":"0.72.59"},"@ohos/hypium":{"dependencyType":"other","isByteCodeHar":false,"pkgRootPath":"E:\\code\\reanimated\\tester\\harmony\\oh_modules\\.ohpm\\@ohos+hypium@1.0.6\\oh_modules\\@ohos\\hypium","pkgName":"@ohos/hypium","pkgVersion":"1.0.6"}}}
@@ -1,17 +0,0 @@
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.12.8-rc.6';
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
- }
@@ -1,9 +0,0 @@
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 { RNKeyboardControllerPackage } from './src/main/ets/RNKeyboardControllerPackage'
8
- export * from './ts';
9
- export default RNKeyboardControllerPackage
@@ -1,31 +0,0 @@
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
- }
@@ -1,6 +0,0 @@
1
- import { harTasks } from '@ohos/hvigor-ohos-plugin';
2
-
3
- export default {
4
- system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
5
- plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
6
- }
@@ -1,18 +0,0 @@
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
@@ -1,20 +0,0 @@
1
- {
2
- "meta": {
3
- "stableOrder": true,
4
- "enableUnifiedLockfile": false
5
- },
6
- "lockfileVersion": 3,
7
- "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
8
- "specifiers": {
9
- "@rnoh/react-native-openharmony@../../../../code/reanimated/tester/harmony/react-native-openharmony-0.72.59.har": "@rnoh/react-native-openharmony@../../../../code/reanimated/tester/harmony/react-native-openharmony-0.72.59.har"
10
- },
11
- "packages": {
12
- "@rnoh/react-native-openharmony@../../../../code/reanimated/tester/harmony/react-native-openharmony-0.72.59.har": {
13
- "name": "",
14
- "version": "0.72.59",
15
- "integrity": "",
16
- "resolved": "",
17
- "registryType": "local"
18
- }
19
- }
20
- }
@@ -1 +0,0 @@
1
- {"name":"@react-native-ohos/react-native-keyboard-controller","version":"1.12.8-rc.6","description":" control keyboard show or hide","main":"Index.ets","author":"","license":"MIT License","dependencies":{"@rnoh/react-native-openharmony":"file:../react_native_openharmony"},"metadata":{"sourceRoots":["./src/main"],"debug":true},"compatibleSdkVersionStage":"beta1","compatibleSdkVersion":12,"compatibleSdkType":"HarmonyOS","obfuscated":false}
@@ -1,7 +0,0 @@
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)
@@ -1,96 +0,0 @@
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
@@ -1,90 +0,0 @@
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
@@ -1,77 +0,0 @@
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
- KeyboardControllerViewProps() = default;
44
-
45
- KeyboardControllerViewProps(const PropsParserContext &context, const KeyboardControllerViewProps &sourceProps,
46
- const RawProps &rawProps)
47
- : ViewProps(context, sourceProps, rawProps),
48
- enabled(CoreFeatures::enablePropIteratorSetter
49
- ? sourceProps.enabled
50
- : convertRawProp(context, rawProps, "enabled", sourceProps.enabled, {false})),
51
- statusBarTranslucent(CoreFeatures::enablePropIteratorSetter
52
- ? sourceProps.statusBarTranslucent
53
- : convertRawProp(context, rawProps, "statusBarTranslucent",
54
- sourceProps.statusBarTranslucent, {false})),
55
- navigationBarTranslucent(CoreFeatures::enablePropIteratorSetter
56
- ? sourceProps.navigationBarTranslucent
57
- : convertRawProp(context, rawProps, "navigationBarTranslucent",
58
- sourceProps.navigationBarTranslucent, {false})) {}
59
- };
60
-
61
- using KeyboardControllerViewShadowNode =
62
- ConcreteViewShadowNode<KeyboardControllerViewName, KeyboardControllerViewProps, KeyboardControllerViewEventEmitter>;
63
-
64
- class KeyboardControllerViewComponentDescriptor final
65
- : public ConcreteComponentDescriptor<KeyboardControllerViewShadowNode> {
66
- public:
67
- KeyboardControllerViewComponentDescriptor(ComponentDescriptorParameters const &parameters)
68
- : ConcreteComponentDescriptor(parameters) {}
69
- };
70
-
71
-
72
- } // namespace react
73
- } // namespace facebook
74
-
75
- #endif
76
-
77
- #endif
@@ -1,158 +0,0 @@
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;
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
- }
49
-
50
- void KeyboardControllerViewComponentInstance::onCommandReceived(std::string const &commandName,
51
- folly::dynamic const &args) {
52
- CppComponentInstance::onCommandReceived(commandName, args);
53
- }
54
-
55
- ArkUINode &KeyboardControllerViewComponentInstance::getLocalRootArkUINode() { return m_customNode; }
56
- void KeyboardControllerViewComponentInstance::onClick() {}
57
- void KeyboardControllerViewComponentInstance::onMessageReceived(ArkTSMessage const &message) {
58
- DLOG(INFO) << "onMessageReceived";
59
- if (message.name == "keyboardHeightChange") {
60
- double height = message.payload.getDouble();
61
- DLOG(INFO) << "keyboardHeightChange: " << height;
62
- if (height > 0) {
63
- this->keyboardStatus = KeyboardControllerStatus::SHOW;
64
- this->keyboardHeight = height;
65
- }
66
- if (height == 0) {
67
- this->keyboardStatus = KeyboardControllerStatus::HIDE;
68
- }
69
- this->keyboardHeightChangeHandle();
70
- }
71
- if (message.name == "setFocusTo") {
72
- // to do
73
- }
74
- }
75
- void KeyboardControllerViewComponentInstance::setWindowSystemBarEnable() {
76
- auto rnInstancePtr = this->m_deps->rnInstance.lock();
77
- if (rnInstancePtr != nullptr) {
78
- auto turboModule = rnInstancePtr->getTurboModule("KeyboardController");
79
- auto arkTsTurboModule = std::dynamic_pointer_cast<rnoh::ArkTSTurboModule>(turboModule);
80
- arkTsTurboModule->callSync("setWindowSystemBarEnable", {this->statusBarTranslucent, this->navigationBarTranslucent});
81
- }
82
- }
83
-
84
- void KeyboardControllerViewComponentInstance::startKeyboardObserver() {
85
- auto rnInstancePtr = this->m_deps->rnInstance.lock();
86
- if (rnInstancePtr != nullptr) {
87
- auto turboModule = rnInstancePtr->getTurboModule("KeyboardController");
88
- auto arkTsTurboModule = std::dynamic_pointer_cast<rnoh::ArkTSTurboModule>(turboModule);
89
- arkTsTurboModule->callSync("startKeyboardObserver", {this->enabled});
90
- }
91
- }
92
-
93
- void KeyboardControllerViewComponentInstance::keyboardHeightChangeHandle() {
94
- auto rnInstancePtr = this->m_deps->rnInstance.lock();
95
- if (rnInstancePtr != nullptr && this->enabled) {
96
- if (this->keyboardStatus == KeyboardControllerStatus::HIDE) {
97
- facebook::react::KeyboardControllerViewEventEmitter::MoveEvent start = {this->keyboardHeight, 0, 0, m_tag};
98
- facebook::react::KeyboardControllerViewEventEmitter::MoveEvent end = {0, 0, 0, m_tag};
99
- m_eventEmitter->onKeyboardMoveStart(start);
100
- m_eventEmitter->onKeyboardMove(end);
101
- m_eventEmitter->onKeyboardMoveEnd(end);
102
- } else {
103
- facebook::react::KeyboardControllerViewEventEmitter::MoveEvent start = {0, 0, 0, m_tag};
104
- facebook::react::KeyboardControllerViewEventEmitter::MoveEvent end = {this->keyboardHeight, 1, 0, m_tag};
105
- m_eventEmitter->onKeyboardMoveStart(start);
106
- m_eventEmitter->onKeyboardMove(end);
107
- m_eventEmitter->onKeyboardMoveEnd(end);
108
- }
109
- }
110
- }
111
-
112
- /**
113
- * 遍历查找TextInput
114
- * */
115
- void KeyboardControllerViewComponentInstance::findTextInputComponents(
116
- ComponentInstance::Shared const &childComponentInstance) {
117
- std::string name = childComponentInstance->getComponentName();
118
- DLOG(INFO) << "###" << name;
119
- if (name.find("TextInput") != std::string::npos || name.find("TextArea") != std::string::npos) {
120
- auto input = std::dynamic_pointer_cast<TextInputComponentInstance>(childComponentInstance);
121
- ArkUINode &node = input->getLocalRootArkUINode();
122
- TextInputNode *inputNodePtr = dynamic_cast<TextInputNode *>(&node);
123
- if (!inputNodePtr) {
124
- TextAreaNode *textAreaNodePtr = dynamic_cast<TextAreaNode *>(&node);
125
- textAreaNodePtr->setTextAreaNodeDelegate(this);
126
- } else {
127
- inputNodePtr->setTextInputNodeDelegate(this);
128
- }
129
- this->textInputVector.push_back(input);
130
- }
131
- auto childrenComponentInstances = childComponentInstance->getChildren();
132
- if (childrenComponentInstances.empty()) {
133
- return;
134
- }
135
-
136
- std::vector<ComponentInstance::Shared>::iterator it1;
137
- for (it1 = childrenComponentInstances.begin(); it1 != childrenComponentInstances.end(); ++it1) {
138
- ComponentInstance::Shared const &t = *it1;
139
- findTextInputComponents(t);
140
- }
141
- }
142
-
143
- void KeyboardControllerViewComponentInstance::onChange(std::string text) {
144
- facebook::react::KeyboardControllerViewEventEmitter::TextChangeEvent event = {text};
145
- if(this->enabled){
146
- m_eventEmitter->onFocusedInputTextChanged(event);
147
- }
148
-
149
- }
150
- void KeyboardControllerViewComponentInstance::onTextSelectionChange(int32_t location, int32_t length) {
151
- DLOG(INFO) << " onKeyboardControllerView onTextSelectionChange";
152
- // to do
153
- };
154
- void KeyboardControllerViewComponentInstance::onFocus() { DLOG(INFO) << " onKeyboardControllerView onFocus"; }
155
- void KeyboardControllerViewComponentInstance::onBlur() { DLOG(INFO) << " onKeyboardControllerView onBlur"; }
156
-
157
-
158
- } // namespace rnoh
@@ -1,74 +0,0 @@
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 KEYBOARDCONTROLLERVIEWCOMPONENTINSTANCE_H
8
- #define KEYBOARDCONTROLLERVIEWCOMPONENTINSTANCE_H
9
-
10
- #ifndef TESTER_HARMONY_KEYBOARD_CONTROLLER_SRC_MAIN_CPP_KEYBOARDCONTROLLERVIEWCOMPONENTINSTANCE_H
11
- #define TESTER_HARMONY_KEYBOARD_CONTROLLER_SRC_MAIN_CPP_KEYBOARDCONTROLLERVIEWCOMPONENTINSTANCE_H
12
-
13
- #include <any>
14
- #include "RNOH/CppComponentInstance.h"
15
- #include "KeyboardControllerViewComponentDescriptor.h"
16
- #include "RNOHCorePackage/ComponentInstances/TextInputComponentInstance.h"
17
- #include "RNOH/arkui/CustomNode.h"
18
- #include "RNOH/ArkTSMessageHub.h"
19
- #include "RNOH/arkui/TextInputNode.h"
20
- #include "RNOH/arkui/TextAreaNode.h"
21
-
22
- namespace rnoh {
23
- enum KeyboardControllerStatus { HIDE = 0, SHOW = 1 };
24
- class KeyboardControllerViewComponentInstance
25
- : public CppComponentInstance<facebook::react::KeyboardControllerViewShadowNode>,
26
- public CustomNodeDelegate,
27
- public TextAreaNodeDelegate,
28
- public TextInputNodeDelegate,
29
- public ArkTSMessageHub::Observer {
30
- public:
31
- KeyboardControllerViewComponentInstance(Context context);
32
- void onKeyboardMoveStart();
33
- void onKeyboardMove();
34
- void onKeyboardMoveEnd();
35
- void onKeyboardMoveInteractive();
36
- void onFocusedInputLayoutChanged();
37
- void onFocusedInputTextChanged();
38
- void onFocusedInputSelectionChanged();
39
-
40
- void onChildInserted(ComponentInstance::Shared const &childComponentInstance, std::size_t index) override;
41
- void onChildRemoved(ComponentInstance::Shared const &childComponentInstance) override;
42
- void onPropsChanged(SharedConcreteProps const &props) override;
43
- void onCommandReceived(std::string const &commandName, folly::dynamic const &args) override;
44
- void onMessageReceived(ArkTSMessage const &message) override;
45
- ArkUINode &getLocalRootArkUINode() override;
46
- void onClick() override;
47
- // textArea textInput delegate
48
- void onChange(std::string text) override;
49
- void onBlur() override;
50
- void onFocus() override;
51
- void onTextSelectionChange(int32_t location, int32_t length) override;
52
-
53
- protected:
54
- private:
55
- bool enabled;
56
- bool statusBarTranslucent;
57
- bool navigationBarTranslucent;
58
- double keyboardHeight;
59
- std::map<std::string, std::any> dictionary;
60
- int keyboardStatus;
61
- std::vector<TextInputComponentInstance::Shared> textInputVector{};
62
- CustomNode m_customNode{};
63
- ComponentInstance::Shared currentResponder;
64
- void findTextInputComponents(ComponentInstance::Shared const &parentComponentInstance);
65
- void setWindowSystemBarEnable();
66
- void startKeyboardObserver();
67
- void closeKeyboardObserver();
68
- void keyboardHeightChangeHandle();
69
- };
70
- } // namespace rnoh
71
-
72
- #endif
73
-
74
- #endif