@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/package.json
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@react-native-ohos/react-native-keyboard-controller",
|
|
3
|
+
"version": "1.16.6-rc.1",
|
|
4
|
+
"description": "Keyboard manager which works in identical way on iOS and Android and harmony",
|
|
5
|
+
"main": "lib/commonjs/index",
|
|
6
|
+
"module": "lib/module/index",
|
|
7
|
+
"types": "lib/typescript/index.d.ts",
|
|
8
|
+
"react-native": "src/index",
|
|
9
|
+
"source": "src/index",
|
|
10
|
+
"files": [
|
|
11
|
+
"src",
|
|
12
|
+
"lib",
|
|
13
|
+
"android",
|
|
14
|
+
"ios",
|
|
15
|
+
"harmony",
|
|
16
|
+
"cpp",
|
|
17
|
+
"react-native-keyboard-controller.podspec",
|
|
18
|
+
"jest",
|
|
19
|
+
"!lib/typescript/example",
|
|
20
|
+
"!android/build",
|
|
21
|
+
"!android/.gradle",
|
|
22
|
+
"!android/gradle",
|
|
23
|
+
"!android/gradlew",
|
|
24
|
+
"!android/gradlew.bat",
|
|
25
|
+
"!ios/build",
|
|
26
|
+
"!ios/KeyboardControllerNative",
|
|
27
|
+
"!**/__tests__",
|
|
28
|
+
"!**/__fixtures__",
|
|
29
|
+
"!**/__mocks__"
|
|
30
|
+
],
|
|
31
|
+
"scripts": {
|
|
32
|
+
"format": "prettier '**/*' --ignore-unknown --write",
|
|
33
|
+
"test": "jest",
|
|
34
|
+
"typescript": "tsc --noEmit --project tsconfig.build.json",
|
|
35
|
+
"lint": "eslint --quiet \"**/*.{js,ts,tsx}\"",
|
|
36
|
+
"lint-clang": "find ios/ -iname *.h -o -iname *.m -o -iname *.mm | grep -v -e Pods -e build | xargs clang-format -i -n --Werror",
|
|
37
|
+
"prepare": "bob build",
|
|
38
|
+
"release": "release-it",
|
|
39
|
+
"example": "yarn --cwd example",
|
|
40
|
+
"pods": "cd example && pod-install --quiet",
|
|
41
|
+
"bootstrap": "yarn example && yarn && yarn pods"
|
|
42
|
+
},
|
|
43
|
+
"keywords": [
|
|
44
|
+
"react-native",
|
|
45
|
+
"keyboard",
|
|
46
|
+
"interactive",
|
|
47
|
+
"dismiss",
|
|
48
|
+
"animation",
|
|
49
|
+
"focused input",
|
|
50
|
+
"text changed",
|
|
51
|
+
"selection changed",
|
|
52
|
+
"avoiding view",
|
|
53
|
+
"avoid keyboard",
|
|
54
|
+
"sticky view",
|
|
55
|
+
"over keyboard view",
|
|
56
|
+
"keyboard aware scroll view",
|
|
57
|
+
"keyboard toolbar",
|
|
58
|
+
"keyboard done button",
|
|
59
|
+
"keyboard next button",
|
|
60
|
+
"keyboard previous button",
|
|
61
|
+
"ios",
|
|
62
|
+
"android",
|
|
63
|
+
"harmony"
|
|
64
|
+
],
|
|
65
|
+
"repository": "https://github.com/react-native-oh-library/react-native-keyboard-controller",
|
|
66
|
+
"author": "Kiryl Ziusko <zyusko.kirik@gmail.com> (https://github.com/kirillzyusko)",
|
|
67
|
+
"license": "MIT",
|
|
68
|
+
"bugs": {
|
|
69
|
+
"url": "https://github.com/react-native-oh-library/react-native-keyboard-controller/issues"
|
|
70
|
+
},
|
|
71
|
+
"homepage": "https://kirillzyusko.github.io/react-native-keyboard-controller/",
|
|
72
|
+
"publishConfig": {
|
|
73
|
+
"registry": "https://registry.npmjs.org/"
|
|
74
|
+
},
|
|
75
|
+
"devDependencies": {
|
|
76
|
+
"@commitlint/config-conventional": "^11.0.0",
|
|
77
|
+
"@react-native/babel-preset": "0.77.0",
|
|
78
|
+
"@react-native/eslint-config": "0.77.0",
|
|
79
|
+
"@release-it/conventional-changelog": "^2.0.0",
|
|
80
|
+
"@testing-library/react-hooks": "^8.0.1",
|
|
81
|
+
"@types/jest": "^29.5.13",
|
|
82
|
+
"@types/react": "^18.2.6",
|
|
83
|
+
"@typescript-eslint/eslint-plugin": "^6.7.4",
|
|
84
|
+
"@typescript-eslint/parser": "^6.7.4",
|
|
85
|
+
"clang-format": "^1.8.0",
|
|
86
|
+
"commitlint": "^11.0.0",
|
|
87
|
+
"eslint": "^8.19.0",
|
|
88
|
+
"eslint-config-prettier": "^8.5.0",
|
|
89
|
+
"eslint-import-resolver-typescript": "^3.6.1",
|
|
90
|
+
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
91
|
+
"eslint-plugin-ft-flow": "^3.0.11",
|
|
92
|
+
"eslint-plugin-import": "^2.28.1",
|
|
93
|
+
"eslint-plugin-jest": "^26.5.3",
|
|
94
|
+
"eslint-plugin-prettier": "^4.2.1",
|
|
95
|
+
"eslint-plugin-react-compiler": "^0.0.0-experimental-0998c1e-20240625",
|
|
96
|
+
"eslint-plugin-react-perf": "^3.3.2",
|
|
97
|
+
"husky": "^6.0.0",
|
|
98
|
+
"jest": "^29.6.3",
|
|
99
|
+
"pod-install": "^0.1.0",
|
|
100
|
+
"prettier": "^2.8.8",
|
|
101
|
+
"react": "18.3.1",
|
|
102
|
+
"react-native": "0.77.1",
|
|
103
|
+
"react-native-builder-bob": "^0.18.0",
|
|
104
|
+
"react-native-reanimated": "3.18.0",
|
|
105
|
+
"react-test-renderer": "18.2.0",
|
|
106
|
+
"release-it": "^14.2.2",
|
|
107
|
+
"typescript": "5.6.3"
|
|
108
|
+
},
|
|
109
|
+
"peerDependencies": {
|
|
110
|
+
"react": "*",
|
|
111
|
+
"react-native": "*",
|
|
112
|
+
"react-native-reanimated": ">=3.0.0",
|
|
113
|
+
"react-native-keyboard-controller": "1.16.5"
|
|
114
|
+
},
|
|
115
|
+
"jest": {
|
|
116
|
+
"preset": "react-native",
|
|
117
|
+
"modulePathIgnorePatterns": [
|
|
118
|
+
"<rootDir>/example/node_modules",
|
|
119
|
+
"<rootDir>/lib/"
|
|
120
|
+
]
|
|
121
|
+
},
|
|
122
|
+
"commitlint": {
|
|
123
|
+
"extends": [
|
|
124
|
+
"@commitlint/config-conventional"
|
|
125
|
+
]
|
|
126
|
+
},
|
|
127
|
+
"release-it": {
|
|
128
|
+
"git": {
|
|
129
|
+
"commitMessage": "chore: release ${version}",
|
|
130
|
+
"tagName": "v${version}"
|
|
131
|
+
},
|
|
132
|
+
"npm": {
|
|
133
|
+
"publish": true
|
|
134
|
+
},
|
|
135
|
+
"github": {
|
|
136
|
+
"release": true
|
|
137
|
+
},
|
|
138
|
+
"plugins": {
|
|
139
|
+
"@release-it/conventional-changelog": {
|
|
140
|
+
"preset": "angular"
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
"prettier": {
|
|
145
|
+
"quoteProps": "consistent",
|
|
146
|
+
"trailingComma": "all"
|
|
147
|
+
},
|
|
148
|
+
"react-native-builder-bob": {
|
|
149
|
+
"source": "src",
|
|
150
|
+
"output": "lib",
|
|
151
|
+
"targets": [
|
|
152
|
+
"commonjs",
|
|
153
|
+
"module",
|
|
154
|
+
[
|
|
155
|
+
"typescript",
|
|
156
|
+
{
|
|
157
|
+
"project": "tsconfig.build.json"
|
|
158
|
+
}
|
|
159
|
+
]
|
|
160
|
+
]
|
|
161
|
+
},
|
|
162
|
+
"codegenConfig": {
|
|
163
|
+
"name": "reactnativekeyboardcontroller",
|
|
164
|
+
"type": "all",
|
|
165
|
+
"jsSrcsDir": "./src/specs",
|
|
166
|
+
"android": {
|
|
167
|
+
"javaPackageName": "com.reactnativekeyboardcontroller"
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
"harmony": {
|
|
171
|
+
"alias": "react-native-keyboard-controller"
|
|
172
|
+
}
|
|
173
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
+
|
|
5
|
+
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
|
|
6
|
+
|
|
7
|
+
new_arch_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
|
|
8
|
+
|
|
9
|
+
Pod::Spec.new do |s|
|
|
10
|
+
s.name = "react-native-keyboard-controller"
|
|
11
|
+
s.version = package["version"]
|
|
12
|
+
s.summary = package["description"]
|
|
13
|
+
s.homepage = package["homepage"]
|
|
14
|
+
s.license = package["license"]
|
|
15
|
+
s.authors = package["author"]
|
|
16
|
+
|
|
17
|
+
s.platforms = { :ios => "11.0" }
|
|
18
|
+
s.source = { :git => "https://github.com/kirillzyusko/react-native-keyboard-controller.git", :tag => "#{s.version}" }
|
|
19
|
+
|
|
20
|
+
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
21
|
+
s.exclude_files = "ios/KeyboardControllerNative/**/*"
|
|
22
|
+
s.public_header_files = "ios/**/*.h"
|
|
23
|
+
|
|
24
|
+
# This guard prevent to install the dependencies when we run `pod install` in the old architecture.
|
|
25
|
+
if new_arch_enabled then
|
|
26
|
+
s.pod_target_xcconfig = {
|
|
27
|
+
# This is handy when we want to detect if new arch is enabled in Swift code
|
|
28
|
+
# and can be used like:
|
|
29
|
+
# #if KEYBOARD_CONTROLLER_NEW_ARCH_ENABLED
|
|
30
|
+
# // do sth when new arch is enabled
|
|
31
|
+
# #else
|
|
32
|
+
# // do sth when old arch is enabled
|
|
33
|
+
# #endif
|
|
34
|
+
"OTHER_SWIFT_FLAGS" => "-DKEYBOARD_CONTROLLER_NEW_ARCH_ENABLED"
|
|
35
|
+
}
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# install_modules_dependencies has been defined since React Native 71
|
|
39
|
+
if defined?(install_modules_dependencies)
|
|
40
|
+
install_modules_dependencies(s)
|
|
41
|
+
else
|
|
42
|
+
s.dependency 'React-Core'
|
|
43
|
+
|
|
44
|
+
# This guard prevent to install the dependencies when we run `pod install` in the old architecture.
|
|
45
|
+
if new_arch_enabled then
|
|
46
|
+
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
|
|
47
|
+
s.pod_target_xcconfig = s.pod_target_xcconfig | {
|
|
48
|
+
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
|
|
49
|
+
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
|
|
50
|
+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
s.dependency "React-RCTFabric"
|
|
54
|
+
s.dependency "React-Codegen"
|
|
55
|
+
s.dependency "RCT-Folly"
|
|
56
|
+
s.dependency "RCTRequired"
|
|
57
|
+
s.dependency "RCTTypeSafety"
|
|
58
|
+
s.dependency "ReactCommon/turbomodule/core"
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
package/src/animated.tsx
ADDED
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import React, { useEffect, useMemo, useState } from "react";
|
|
2
|
+
import { Animated, Platform, StyleSheet } from "react-native";
|
|
3
|
+
import Reanimated, { useSharedValue } from "react-native-reanimated";
|
|
4
|
+
|
|
5
|
+
import { KeyboardControllerView } from "./bindings";
|
|
6
|
+
import { KeyboardContext } from "./context";
|
|
7
|
+
import { useAnimatedValue, useSharedHandlers } from "./internal";
|
|
8
|
+
import { applyMonkeyPatch, revertMonkeyPatch } from "./monkey-patch";
|
|
9
|
+
import {
|
|
10
|
+
useAnimatedKeyboardHandler,
|
|
11
|
+
useFocusedInputLayoutHandler,
|
|
12
|
+
useFocusedInputSelectionHandler,
|
|
13
|
+
useFocusedInputTextHandler,
|
|
14
|
+
} from "./reanimated";
|
|
15
|
+
|
|
16
|
+
import type { KeyboardAnimationContext } from "./context";
|
|
17
|
+
import type {
|
|
18
|
+
FocusedInputHandler,
|
|
19
|
+
FocusedInputLayoutChangedEvent,
|
|
20
|
+
KeyboardControllerProps,
|
|
21
|
+
KeyboardHandler,
|
|
22
|
+
NativeEvent,
|
|
23
|
+
} from "./types";
|
|
24
|
+
import type { ViewStyle } from "react-native";
|
|
25
|
+
|
|
26
|
+
const KeyboardControllerViewAnimated = Reanimated.createAnimatedComponent(
|
|
27
|
+
Animated.createAnimatedComponent(
|
|
28
|
+
KeyboardControllerView,
|
|
29
|
+
) as React.FC<KeyboardControllerProps>,
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
type Styles = {
|
|
33
|
+
container: ViewStyle;
|
|
34
|
+
hidden: ViewStyle;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const styles = StyleSheet.create<Styles>({
|
|
38
|
+
container: {
|
|
39
|
+
flex: 1,
|
|
40
|
+
},
|
|
41
|
+
hidden: {
|
|
42
|
+
display: "none",
|
|
43
|
+
position: "absolute",
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
type KeyboardProviderProps = {
|
|
48
|
+
children: React.ReactNode;
|
|
49
|
+
/**
|
|
50
|
+
* Set the value to `true`, if you use translucent status bar on Android.
|
|
51
|
+
* If you already control status bar translucency via `react-native-screens`
|
|
52
|
+
* or `StatusBar` component from `react-native`, you can ignore it.
|
|
53
|
+
* Defaults to `false`.
|
|
54
|
+
*
|
|
55
|
+
* @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/14
|
|
56
|
+
* @platform android
|
|
57
|
+
*/
|
|
58
|
+
statusBarTranslucent?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Set the value to `true`, if you use translucent navigation bar on Android.
|
|
61
|
+
* Defaults to `false`.
|
|
62
|
+
*
|
|
63
|
+
* @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/119
|
|
64
|
+
* @platform android
|
|
65
|
+
*/
|
|
66
|
+
navigationBarTranslucent?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* A boolean property indicating whether to keep edge-to-edge mode always enabled (even when you disable the module).
|
|
69
|
+
* Defaults to `false`.
|
|
70
|
+
*
|
|
71
|
+
* @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/592
|
|
72
|
+
* @platform android
|
|
73
|
+
*/
|
|
74
|
+
preserveEdgeToEdge?: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* A boolean prop indicating whether the module is enabled. It indicate only initial state,
|
|
77
|
+
* i. e. if you try to change this prop after component mount it will not have any effect.
|
|
78
|
+
* To change the property in runtime use `useKeyboardController` hook and `setEnabled` method.
|
|
79
|
+
* Defaults to `true`.
|
|
80
|
+
*/
|
|
81
|
+
enabled?: boolean;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
// capture `Platform.OS` in separate variable to avoid deep workletization of entire RN package
|
|
85
|
+
// see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/393 and https://github.com/kirillzyusko/react-native-keyboard-controller/issues/294 for more details
|
|
86
|
+
const OS = Platform.OS;
|
|
87
|
+
|
|
88
|
+
export const KeyboardProvider = ({
|
|
89
|
+
children,
|
|
90
|
+
statusBarTranslucent,
|
|
91
|
+
navigationBarTranslucent,
|
|
92
|
+
preserveEdgeToEdge = true,
|
|
93
|
+
enabled: initiallyEnabled = true,
|
|
94
|
+
}: KeyboardProviderProps) => {
|
|
95
|
+
// state
|
|
96
|
+
const [enabled, setEnabled] = useState(initiallyEnabled);
|
|
97
|
+
// animated values
|
|
98
|
+
const progress = useAnimatedValue(0);
|
|
99
|
+
const height = useAnimatedValue(0);
|
|
100
|
+
// shared values
|
|
101
|
+
const progressSV = useSharedValue(0);
|
|
102
|
+
const heightSV = useSharedValue(0);
|
|
103
|
+
const layout = useSharedValue<FocusedInputLayoutChangedEvent | null>(null);
|
|
104
|
+
const [setKeyboardHandlers, broadcastKeyboardEvents] =
|
|
105
|
+
useSharedHandlers<KeyboardHandler>();
|
|
106
|
+
const [setInputHandlers, broadcastInputEvents] =
|
|
107
|
+
useSharedHandlers<FocusedInputHandler>();
|
|
108
|
+
// memo
|
|
109
|
+
const context = useMemo<KeyboardAnimationContext>(
|
|
110
|
+
() => ({
|
|
111
|
+
enabled,
|
|
112
|
+
animated: { progress: progress, height: Animated.multiply(height,-1) },
|
|
113
|
+
reanimated: { progress: progressSV, height: heightSV },
|
|
114
|
+
layout,
|
|
115
|
+
setKeyboardHandlers,
|
|
116
|
+
setInputHandlers,
|
|
117
|
+
setEnabled,
|
|
118
|
+
}),
|
|
119
|
+
[enabled],
|
|
120
|
+
);
|
|
121
|
+
const style = useMemo(
|
|
122
|
+
() => [
|
|
123
|
+
styles.hidden,
|
|
124
|
+
{ transform: [{ translateX: height }, { translateY: progress }] },
|
|
125
|
+
],
|
|
126
|
+
[],
|
|
127
|
+
);
|
|
128
|
+
const onKeyboardMove = useMemo(
|
|
129
|
+
() =>
|
|
130
|
+
Animated.event(
|
|
131
|
+
[
|
|
132
|
+
{
|
|
133
|
+
nativeEvent: {
|
|
134
|
+
progress,
|
|
135
|
+
height,
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
],
|
|
139
|
+
{ useNativeDriver:Platform.OS as string=='harmony'?false:true },
|
|
140
|
+
),
|
|
141
|
+
[],
|
|
142
|
+
);
|
|
143
|
+
// handlers
|
|
144
|
+
const updateSharedValues = (event: NativeEvent, platforms: string[]) => {
|
|
145
|
+
"worklet";
|
|
146
|
+
|
|
147
|
+
if (platforms.includes(OS)) {
|
|
148
|
+
// eslint-disable-next-line react-compiler/react-compiler
|
|
149
|
+
progressSV.value = event.progress;
|
|
150
|
+
heightSV.value = -event.height;
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
const keyboardHandler = useAnimatedKeyboardHandler(
|
|
154
|
+
{
|
|
155
|
+
onKeyboardMoveStart: (event: NativeEvent) => {
|
|
156
|
+
"worklet";
|
|
157
|
+
|
|
158
|
+
broadcastKeyboardEvents("onStart", event);
|
|
159
|
+
updateSharedValues(event, ["ios"]);
|
|
160
|
+
},
|
|
161
|
+
onKeyboardMove: (event: NativeEvent) => {
|
|
162
|
+
"worklet";
|
|
163
|
+
|
|
164
|
+
broadcastKeyboardEvents("onMove", event);
|
|
165
|
+
updateSharedValues(event, ["android"]);
|
|
166
|
+
},
|
|
167
|
+
onKeyboardMoveEnd: (event: NativeEvent) => {
|
|
168
|
+
"worklet";
|
|
169
|
+
broadcastKeyboardEvents("onEnd", event);
|
|
170
|
+
updateSharedValues(event, ['harmony']);
|
|
171
|
+
},
|
|
172
|
+
onKeyboardMoveInteractive: (event: NativeEvent) => {
|
|
173
|
+
"worklet";
|
|
174
|
+
|
|
175
|
+
updateSharedValues(event, ["android", "ios"]);
|
|
176
|
+
broadcastKeyboardEvents("onInteractive", event);
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
[],
|
|
180
|
+
);
|
|
181
|
+
const inputLayoutHandler = useFocusedInputLayoutHandler(
|
|
182
|
+
{
|
|
183
|
+
onFocusedInputLayoutChanged: (e) => {
|
|
184
|
+
"worklet";
|
|
185
|
+
|
|
186
|
+
if (e.target !== -1) {
|
|
187
|
+
layout.value = e;
|
|
188
|
+
} else {
|
|
189
|
+
layout.value = null;
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
[],
|
|
194
|
+
);
|
|
195
|
+
const inputTextHandler = useFocusedInputTextHandler(
|
|
196
|
+
{
|
|
197
|
+
onFocusedInputTextChanged: (e) => {
|
|
198
|
+
"worklet";
|
|
199
|
+
|
|
200
|
+
broadcastInputEvents("onChangeText", e);
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
[],
|
|
204
|
+
);
|
|
205
|
+
const inputSelectionHandler = useFocusedInputSelectionHandler(
|
|
206
|
+
{
|
|
207
|
+
onFocusedInputSelectionChanged: (e) => {
|
|
208
|
+
"worklet";
|
|
209
|
+
broadcastInputEvents("onSelectionChange", e);
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
[],
|
|
213
|
+
);
|
|
214
|
+
// effects
|
|
215
|
+
useEffect(() => {
|
|
216
|
+
if (enabled) {
|
|
217
|
+
applyMonkeyPatch();
|
|
218
|
+
} else {
|
|
219
|
+
revertMonkeyPatch();
|
|
220
|
+
}
|
|
221
|
+
}, [enabled]);
|
|
222
|
+
|
|
223
|
+
return (
|
|
224
|
+
<KeyboardContext.Provider value={context}>
|
|
225
|
+
<KeyboardControllerViewAnimated
|
|
226
|
+
enabled={enabled}
|
|
227
|
+
onKeyboardMoveReanimated={keyboardHandler}
|
|
228
|
+
onKeyboardMoveStart={OS === "ios" ? onKeyboardMove : undefined}
|
|
229
|
+
onKeyboardMove={OS === "android" ? onKeyboardMove : undefined}
|
|
230
|
+
onKeyboardMoveInteractive={onKeyboardMove}
|
|
231
|
+
onKeyboardMoveEnd={ OS as string === "harmony"?onKeyboardMove:undefined}
|
|
232
|
+
onFocusedInputLayoutChangedReanimated={inputLayoutHandler}
|
|
233
|
+
onFocusedInputTextChangedReanimated={inputTextHandler}
|
|
234
|
+
onFocusedInputSelectionChangedReanimated={inputSelectionHandler}
|
|
235
|
+
navigationBarTranslucent={navigationBarTranslucent}
|
|
236
|
+
statusBarTranslucent={statusBarTranslucent}
|
|
237
|
+
preserveEdgeToEdge={preserveEdgeToEdge}
|
|
238
|
+
style={styles.container}
|
|
239
|
+
>
|
|
240
|
+
<Reanimated.View>{children}</Reanimated.View>
|
|
241
|
+
{/* {children} */}
|
|
242
|
+
</KeyboardControllerViewAnimated>
|
|
243
|
+
<Animated.View
|
|
244
|
+
// we are using this small hack, because if the component (where
|
|
245
|
+
// animated value has been used) is unmounted, then animation will
|
|
246
|
+
// stop receiving events (seems like it's react-native optimization).
|
|
247
|
+
// So we need to keep a reference to the animated value, to keep it's
|
|
248
|
+
// always mounted (keep a reference to an animated value).
|
|
249
|
+
//
|
|
250
|
+
// To test why it's needed, try to open screen which consumes Animated.Value
|
|
251
|
+
// then close it and open it again (for example 'Animated transition').
|
|
252
|
+
style={style}
|
|
253
|
+
/>
|
|
254
|
+
</KeyboardContext.Provider>
|
|
255
|
+
);
|
|
256
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { NativeEventEmitter, Platform } from "react-native";
|
|
2
|
+
|
|
3
|
+
import type {
|
|
4
|
+
FocusedInputEventsModule,
|
|
5
|
+
KeyboardControllerNativeModule,
|
|
6
|
+
KeyboardControllerProps,
|
|
7
|
+
KeyboardEventsModule,
|
|
8
|
+
KeyboardGestureAreaProps,
|
|
9
|
+
OverKeyboardViewProps,
|
|
10
|
+
WindowDimensionsEventsModule,
|
|
11
|
+
} from "./types";
|
|
12
|
+
|
|
13
|
+
const LINKING_ERROR =
|
|
14
|
+
`The package 'react-native-keyboard-controller' doesn't seem to be linked. Make sure: \n\n` +
|
|
15
|
+
Platform.select({ ios: "- You have run 'pod install'\n", default: "" }) +
|
|
16
|
+
"- You rebuilt the app after installing the package\n" +
|
|
17
|
+
"- You are not using Expo Go\n";
|
|
18
|
+
|
|
19
|
+
const RCTKeyboardController =
|
|
20
|
+
require("./specs/NativeKeyboardController").default;
|
|
21
|
+
|
|
22
|
+
export const KeyboardControllerNative = (
|
|
23
|
+
RCTKeyboardController
|
|
24
|
+
? RCTKeyboardController
|
|
25
|
+
: new Proxy(
|
|
26
|
+
{},
|
|
27
|
+
{
|
|
28
|
+
get() {
|
|
29
|
+
throw new Error(LINKING_ERROR);
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
)
|
|
33
|
+
) as KeyboardControllerNativeModule;
|
|
34
|
+
|
|
35
|
+
const KEYBOARD_CONTROLLER_NAMESPACE = "KeyboardController::";
|
|
36
|
+
const eventEmitter = new NativeEventEmitter(KeyboardControllerNative);
|
|
37
|
+
|
|
38
|
+
export const KeyboardEvents: KeyboardEventsModule = {
|
|
39
|
+
addListener: (name, cb) =>
|
|
40
|
+
eventEmitter.addListener(KEYBOARD_CONTROLLER_NAMESPACE + name, cb),
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* This API is not documented, it's for internal usage only (for now), and is a subject to potential breaking changes in future.
|
|
45
|
+
* Use it with cautious.
|
|
46
|
+
*/
|
|
47
|
+
export const FocusedInputEvents: FocusedInputEventsModule = {
|
|
48
|
+
addListener: (name, cb) =>
|
|
49
|
+
eventEmitter.addListener(KEYBOARD_CONTROLLER_NAMESPACE + name, cb),
|
|
50
|
+
};
|
|
51
|
+
export const WindowDimensionsEvents: WindowDimensionsEventsModule = {
|
|
52
|
+
addListener: (name, cb) =>
|
|
53
|
+
eventEmitter.addListener(KEYBOARD_CONTROLLER_NAMESPACE + name, cb),
|
|
54
|
+
};
|
|
55
|
+
export const KeyboardControllerView: React.FC<KeyboardControllerProps> =
|
|
56
|
+
require("./specs/KeyboardControllerViewNativeComponent").default;
|
|
57
|
+
export const KeyboardGestureArea: React.FC<KeyboardGestureAreaProps> =
|
|
58
|
+
(Platform.OS === "android" && Platform.Version >= 30) || Platform.OS === "ios"
|
|
59
|
+
? require("./specs/KeyboardGestureAreaNativeComponent").default
|
|
60
|
+
: ({ children }: KeyboardGestureAreaProps) => children;
|
|
61
|
+
export const RCTOverKeyboardView: React.FC<OverKeyboardViewProps> =
|
|
62
|
+
require("./specs/OverKeyboardViewNativeComponent").default;
|
package/src/bindings.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { View } from "react-native";
|
|
2
|
+
|
|
3
|
+
import type {
|
|
4
|
+
FocusedInputEventsModule,
|
|
5
|
+
KeyboardControllerNativeModule,
|
|
6
|
+
KeyboardControllerProps,
|
|
7
|
+
KeyboardEventsModule,
|
|
8
|
+
KeyboardGestureAreaProps,
|
|
9
|
+
OverKeyboardViewProps,
|
|
10
|
+
WindowDimensionsEventsModule,
|
|
11
|
+
} from "./types";
|
|
12
|
+
import type { EmitterSubscription } from "react-native";
|
|
13
|
+
|
|
14
|
+
const NOOP = () => {};
|
|
15
|
+
|
|
16
|
+
export const KeyboardControllerNative: KeyboardControllerNativeModule = {
|
|
17
|
+
setDefaultMode: NOOP,
|
|
18
|
+
setInputMode: NOOP,
|
|
19
|
+
dismiss: NOOP,
|
|
20
|
+
setFocusTo: NOOP,
|
|
21
|
+
addListener: NOOP,
|
|
22
|
+
removeListeners: NOOP,
|
|
23
|
+
};
|
|
24
|
+
export const KeyboardEvents: KeyboardEventsModule = {
|
|
25
|
+
addListener: () => ({ remove: NOOP } as EmitterSubscription),
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* This API is not documented, it's for internal usage only (for now), and is a subject to potential breaking changes in future.
|
|
29
|
+
* Use it with cautious.
|
|
30
|
+
*/
|
|
31
|
+
export const FocusedInputEvents: FocusedInputEventsModule = {
|
|
32
|
+
addListener: () => ({ remove: NOOP } as EmitterSubscription),
|
|
33
|
+
};
|
|
34
|
+
export const WindowDimensionsEvents: WindowDimensionsEventsModule = {
|
|
35
|
+
addListener: () => ({ remove: NOOP } as EmitterSubscription),
|
|
36
|
+
};
|
|
37
|
+
export const KeyboardControllerView =
|
|
38
|
+
View as unknown as React.FC<KeyboardControllerProps>;
|
|
39
|
+
export const KeyboardGestureArea =
|
|
40
|
+
View as unknown as React.FC<KeyboardGestureAreaProps>;
|
|
41
|
+
export const RCTOverKeyboardView =
|
|
42
|
+
View as unknown as React.FC<OverKeyboardViewProps>;
|