@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.
- package/harmony/keyboard_controller/BuildProfile.ets +16 -16
- package/harmony/keyboard_controller/Index.ets +24 -3
- package/harmony/keyboard_controller/oh-package-lock.json5 +2 -3
- package/harmony/keyboard_controller/oh-package.json5 +1 -1
- package/harmony/keyboard_controller/src/main/cpp/EventEmitters.h +24 -3
- package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewComponentDescriptor.h +24 -3
- package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewComponentInstance.cpp +122 -6
- package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewComponentInstance.h +30 -3
- package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewJSIBinder.h +24 -3
- package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaComponentDescriptor.h +24 -3
- package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaComponentInstance.cpp +24 -3
- package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaComponentInstance.h +24 -3
- package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaJSIBinder.h +24 -3
- package/harmony/keyboard_controller/src/main/cpp/RNKeyboardController.cpp +24 -3
- package/harmony/keyboard_controller/src/main/cpp/RNKeyboardController.h +24 -3
- package/harmony/keyboard_controller/src/main/cpp/RNKeyboardControllerPackage.cpp +24 -3
- package/harmony/keyboard_controller/src/main/cpp/RNKeyboardControllerPackage.h +24 -3
- package/harmony/keyboard_controller/src/main/cpp/RNStatusBarManagerCompat.cpp +24 -3
- package/harmony/keyboard_controller/src/main/cpp/RNStatusBarManagerCompat.h +24 -3
- package/harmony/keyboard_controller/src/main/cpp/ViewHierarchyNavigator.cpp +186 -0
- package/harmony/keyboard_controller/src/main/cpp/ViewHierarchyNavigator.h +112 -0
- package/harmony/keyboard_controller/src/main/cpp/keyboardControllerPackage.cpp +24 -3
- package/harmony/keyboard_controller/src/main/cpp/keyboardControllerPackage.h +24 -3
- package/harmony/keyboard_controller/src/main/ets/Logger.ts +24 -3
- package/harmony/keyboard_controller/src/main/ets/RNKeyboardControllerPackage.ets +29 -5
- package/harmony/keyboard_controller/src/main/ets/RNKeyboardControllerTurboModule.ts +38 -3
- package/harmony/keyboard_controller/src/main/ets/RNStatusBarManagerCompatTurboModule.ts +24 -3
- package/harmony/keyboard_controller/src/main/ets/Type.ts +24 -3
- package/harmony/keyboard_controller/ts.ets +24 -3
- package/harmony/keyboard_controller.har +0 -0
- package/lib/commonjs/animated.js +14 -11
- package/lib/commonjs/animated.js.map +1 -1
- package/lib/commonjs/constants.js +2 -0
- package/lib/commonjs/constants.js.map +1 -1
- package/lib/module/animated.js +14 -11
- package/lib/module/animated.js.map +1 -1
- package/lib/module/constants.js +2 -0
- package/lib/module/constants.js.map +1 -1
- package/package.json +3 -2
- package/src/animated.tsx +12 -8
- package/harmony/keyboard_controller/build/default/cache/default/default@HarCompileArkTS/esmodule/.ts_checker_cache +0 -5166
- package/harmony/keyboard_controller/build/default/cache/default/default@HarCompileArkTS/esmodule/.tsbuildinfo +0 -1
- package/harmony/keyboard_controller/build/default/cache/default/default@HarCompileArkTS/esmodule/.tsbuildinfo.linter +0 -1
- package/harmony/keyboard_controller/build/default/cache/default/default@HarCompileArkTS/esmodule/compileInfo.json +0 -1
- package/harmony/keyboard_controller/build/default/cache/default/default@HarCompileArkTS/esmodule/debug/compiler.cache/modules/Index.ets-96716712ed80a95f9b3cb8c16433a37c.msgpack +0 -0
- package/harmony/keyboard_controller/build/default/cache/default/default@HarCompileArkTS/esmodule/debug/compiler.cache/modules/Logger.ts-21e5e905df1c99fc6e6ca37bbbfcb51e.msgpack +0 -0
- package/harmony/keyboard_controller/build/default/cache/default/default@HarCompileArkTS/esmodule/debug/compiler.cache/modules/RNKeyboardControllerPackage.ets-c2108552e32e54da4e2ee2cd039239a4.msgpack +0 -0
- package/harmony/keyboard_controller/build/default/cache/default/default@HarCompileArkTS/esmodule/debug/compiler.cache/modules/RNKeyboardControllerTurboModule.ts-7c42679e7e488d1a60c8b4d54f079abb.msgpack +0 -0
- package/harmony/keyboard_controller/build/default/cache/default/default@HarCompileArkTS/esmodule/debug/compiler.cache/modules/RNStatusBarManagerCompatTurboModule.ts-c9b80946df3cc584c8042691aeb9fbb1.msgpack +0 -0
- package/harmony/keyboard_controller/build/default/cache/default/default@HarCompileArkTS/esmodule/debug/compiler.cache/modules/Type.ts-8709f2f912199ff74f40eb894b697a77.msgpack +0 -0
- package/harmony/keyboard_controller/build/default/cache/default/default@HarCompileArkTS/esmodule/debug/compiler.cache/modules/ts.ets-70cab636273e777c0f945b068fe2fec4.msgpack +0 -0
- package/harmony/keyboard_controller/build/default/cache/default/default@HarCompileArkTS/esmodule/debug/compiler.cache/other/pkgName2SourceRoots.msgpack +0 -1
- package/harmony/keyboard_controller/build/default/cache/default/default@HarCompileArkTS/esmodule/debug/compiler.cache/plugins/plugins.msgpack +0 -0
- package/harmony/keyboard_controller/build/default/cache/default/default@HarCompileArkTS/esmodule/debug/dep_info.json +0 -1
- package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/BuildProfile.ets +0 -17
- package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/Index.ets +0 -9
- package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/ResourceTable.txt +0 -1
- package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/build-profile.json5 +0 -31
- package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/consumer-rules.txt +0 -0
- package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/hvigorfile.ts +0 -6
- package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/obfuscation-rules.txt +0 -18
- package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/oh-package-lock.json5 +0 -20
- package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/oh-package.json5 +0 -1
- package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/cpp/CMakeLists.txt +0 -7
- package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/cpp/EventEmitters.cpp +0 -96
- package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/cpp/EventEmitters.h +0 -90
- package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/cpp/KeyboardControllerViewComponentDescriptor.h +0 -77
- package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/cpp/KeyboardControllerViewComponentInstance.cpp +0 -158
- package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/cpp/KeyboardControllerViewComponentInstance.h +0 -74
- package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/cpp/KeyboardControllerViewJSIBinder.h +0 -43
- package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/cpp/KeyboardGestureAreaComponentDescriptor.h +0 -64
- package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/cpp/KeyboardGestureAreaComponentInstance.cpp +0 -89
- package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/cpp/KeyboardGestureAreaComponentInstance.h +0 -63
- package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/cpp/KeyboardGestureAreaJSIBinder.h +0 -39
- package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/cpp/RNKeyboardController.cpp +0 -25
- package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/cpp/RNKeyboardController.h +0 -27
- package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/cpp/RNKeyboardControllerPackage.cpp +0 -43
- package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/cpp/RNKeyboardControllerPackage.h +0 -56
- package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/cpp/RNStatusBarManagerCompat.cpp +0 -24
- package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/cpp/RNStatusBarManagerCompat.h +0 -28
- package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/cpp/keyboardControllerPackage.cpp +0 -43
- package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/cpp/keyboardControllerPackage.h +0 -56
- package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/ets/Logger.ts +0 -46
- package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/ets/RNKeyboardControllerPackage.ets +0 -46
- package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/ets/RNKeyboardControllerTurboModule.ts +0 -210
- package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/ets/RNStatusBarManagerCompatTurboModule.ts +0 -98
- package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/ets/Type.ts +0 -41
- package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/module.json +0 -32
- package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/resources/base/element/string.json +0 -8
- package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/resources/en_US/element/string.json +0 -8
- package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/src/main/resources/zh_CN/element/string.json +0 -8
- package/harmony/keyboard_controller/build/default/cache/default/default@PackageHar/ts.ets +0 -9
- package/harmony/keyboard_controller/build/default/generated/pm/default/oh-package.json5 +0 -1
- package/harmony/keyboard_controller/build/default/generated/r/default/ResourceTable.h +0 -24
- package/harmony/keyboard_controller/build/default/intermediates/loader/default/loader.json +0 -28
- package/harmony/keyboard_controller/build/default/intermediates/merge_profile/default/module.json +0 -29
- package/harmony/keyboard_controller/build/default/intermediates/patch/default/base_native_libs.json +0 -1
- package/harmony/keyboard_controller/build/default/intermediates/process_profile/default/module.json +0 -32
- package/harmony/keyboard_controller/build/default/intermediates/res/default/ResourceTable.txt +0 -1
- package/harmony/keyboard_controller/build/default/intermediates/res/default/ark_module.json +0 -1
- package/harmony/keyboard_controller/build/default/intermediates/res/default/ids_map/id_defined.json +0 -7
- package/harmony/keyboard_controller/build/default/intermediates/res/default/module.json +0 -28
- package/harmony/keyboard_controller/build/default/intermediates/res/default/opt-compression.json +0 -1
- package/harmony/keyboard_controller/build/default/intermediates/res/default/resConfig.json +0 -1
- package/harmony/keyboard_controller/build/default/intermediates/res/default/resources.index +0 -0
- package/harmony/keyboard_controller/build/default/outputs/default/keyboard_controller.har +0 -0
- package/react-native-keyboard-controller.podspec +0 -61
|
@@ -1,7 +1,28 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (c)
|
|
3
|
-
|
|
4
|
-
|
|
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.
|
|
5
26
|
*/
|
|
6
27
|
|
|
7
28
|
export * from './src/main/ets/RNKeyboardControllerPackage';
|
|
Binary file
|
package/lib/commonjs/animated.js
CHANGED
|
@@ -80,17 +80,20 @@ const KeyboardProvider = ({
|
|
|
80
80
|
|
|
81
81
|
if (platforms.includes(OS)) {
|
|
82
82
|
// eslint-disable-next-line react-compiler/react-compiler
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
83
|
+
if (_reactNative.Platform.OS == 'harmony') {
|
|
84
|
+
const dur = 460;
|
|
85
|
+
progressSV.value = (0, _reactNativeReanimated.withTiming)(event.progress, {
|
|
86
|
+
duration: dur,
|
|
87
|
+
easing: _reactNativeReanimated.Easing.out(_reactNativeReanimated.Easing.exp)
|
|
88
|
+
});
|
|
89
|
+
heightSV.value = (0, _reactNativeReanimated.withTiming)(-event.height, {
|
|
90
|
+
duration: dur,
|
|
91
|
+
easing: _reactNativeReanimated.Easing.out(_reactNativeReanimated.Easing.exp)
|
|
92
|
+
});
|
|
93
|
+
} else {
|
|
94
|
+
progressSV.value = event.progress;
|
|
95
|
+
heightSV.value = -event.height;
|
|
96
|
+
}
|
|
94
97
|
}
|
|
95
98
|
};
|
|
96
99
|
const keyboardHandler = (0, _reanimated.useAnimatedKeyboardHandler)({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeReanimated","_bindings","_context","_internal","_monkeyPatch","_reanimated","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","KeyboardControllerViewAnimated","Reanimated","createAnimatedComponent","Animated","KeyboardControllerView","styles","StyleSheet","create","container","flex","hidden","display","position","OS","Platform","KeyboardProvider","children","statusBarTranslucent","navigationBarTranslucent","enabled","initiallyEnabled","setEnabled","useState","progress","useAnimatedValue","height","progressSV","useSharedValue","heightSV","layout","setKeyboardHandlers","broadcastKeyboardEvents","useSharedHandlers","setInputHandlers","broadcastInputEvents","context","useMemo","animated","multiply","reanimated","style","transform","translateX","translateY","onKeyboardMove","event","nativeEvent","useNativeDriver","updateSharedValues","platforms","includes","dur","value","withTiming","duration","easing","Easing","out","exp","keyboardHandler","useAnimatedKeyboardHandler","onKeyboardMoveStart","onKeyboardMoveEnd","onKeyboardMoveInteractive","inputLayoutHandler","useFocusedInputLayoutHandler","onFocusedInputLayoutChanged","target","inputTextHandler","useFocusedInputTextHandler","onFocusedInputTextChanged","inputSelectionHandler","useFocusedInputSelectionHandler","onFocusedInputSelectionChanged","useEffect","applyMonkeyPatch","revertMonkeyPatch","createElement","KeyboardContext","Provider","onKeyboardMoveReanimated","undefined","onFocusedInputLayoutChangedReanimated","onFocusedInputTextChangedReanimated","onFocusedInputSelectionChangedReanimated","View","exports"],"sources":["animated.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useState } from \"react\";\r\nimport { Animated, Platform, StyleSheet } from \"react-native\";\r\nimport Reanimated, { useSharedValue, Easing, withTiming } from \"react-native-reanimated\";\r\n\r\nimport { KeyboardControllerView } from \"./bindings\";\r\nimport { KeyboardContext } from \"./context\";\r\nimport { useAnimatedValue, useSharedHandlers } from \"./internal\";\r\nimport { applyMonkeyPatch, revertMonkeyPatch } from \"./monkey-patch\";\r\nimport {\r\n useAnimatedKeyboardHandler,\r\n useFocusedInputLayoutHandler,\r\n useFocusedInputSelectionHandler,\r\n useFocusedInputTextHandler,\r\n} from \"./reanimated\";\r\n\r\nimport type { KeyboardAnimationContext } from \"./context\";\r\nimport type {\r\n FocusedInputHandler,\r\n FocusedInputLayoutChangedEvent,\r\n KeyboardControllerProps,\r\n KeyboardHandler,\r\n NativeEvent,\r\n} from \"./types\";\r\nimport type { ViewStyle } from \"react-native\";\r\n\r\nconst KeyboardControllerViewAnimated = Reanimated.createAnimatedComponent(\r\n Animated.createAnimatedComponent(\r\n KeyboardControllerView,\r\n ) as React.FC<KeyboardControllerProps>,\r\n);\r\n\r\ntype Styles = {\r\n container: ViewStyle;\r\n hidden: ViewStyle;\r\n};\r\n\r\nconst styles = StyleSheet.create<Styles>({\r\n container: {\r\n flex: 1,\r\n },\r\n hidden: {\r\n display: \"none\",\r\n position: \"absolute\",\r\n },\r\n});\r\n\r\ntype KeyboardProviderProps = {\r\n children: React.ReactNode;\r\n /**\r\n * Set the value to `true`, if you use translucent status bar on Android.\r\n * If you already control status bar translucency via `react-native-screens`\r\n * or `StatusBar` component from `react-native`, you can ignore it.\r\n * Defaults to `false`.\r\n *\r\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/14\r\n * @platform android\r\n */\r\n statusBarTranslucent?: boolean;\r\n /**\r\n * Set the value to `true`, if you use translucent navigation bar on Android.\r\n * Defaults to `false`.\r\n *\r\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/119\r\n * @platform android\r\n */\r\n navigationBarTranslucent?: boolean;\r\n /**\r\n * A boolean prop indicating whether the module is enabled. It indicate only initial state,\r\n * i. e. if you try to change this prop after component mount it will not have any effect.\r\n * To change the property in runtime use `useKeyboardController` hook and `setEnabled` method.\r\n * Defaults to `true`.\r\n */\r\n enabled?: boolean;\r\n};\r\n\r\n// capture `Platform.OS` in separate variable to avoid deep workletization of entire RN package\r\n// 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\r\nconst OS = Platform.OS;\r\n\r\nexport const KeyboardProvider = ({\r\n children,\r\n statusBarTranslucent,\r\n navigationBarTranslucent,\r\n enabled: initiallyEnabled = true,\r\n}: KeyboardProviderProps) => {\r\n // state\r\n const [enabled, setEnabled] = useState(initiallyEnabled);\r\n // animated values\r\n const progress = useAnimatedValue(0);\r\n const height = useAnimatedValue(0);\r\n // shared values\r\n const progressSV = useSharedValue(0);\r\n const heightSV = useSharedValue(0);\r\n const layout = useSharedValue<FocusedInputLayoutChangedEvent | null>(null);\r\n const [setKeyboardHandlers, broadcastKeyboardEvents] =\r\n useSharedHandlers<KeyboardHandler>();\r\n const [setInputHandlers, broadcastInputEvents] =\r\n useSharedHandlers<FocusedInputHandler>();\r\n // memo\r\n const context = useMemo<KeyboardAnimationContext>(\r\n () => ({\r\n enabled,\r\n animated: { progress: progress, height: Animated.multiply(height,-1) },\r\n reanimated: { progress: progressSV, height: heightSV },\r\n layout,\r\n setKeyboardHandlers,\r\n setInputHandlers,\r\n setEnabled,\r\n }),\r\n [enabled],\r\n );\r\n const style = useMemo(\r\n () => [\r\n styles.hidden,\r\n { transform: [{ translateX: height }, { translateY: progress }] },\r\n ],\r\n [],\r\n );\r\n const onKeyboardMove = useMemo(\r\n () =>\r\n Animated.event(\r\n [\r\n {\r\n nativeEvent: {\r\n progress,\r\n height,\r\n },\r\n },\r\n ],\r\n { useNativeDriver:Platform.OS as string=='harmony'?false:true },\r\n ),\r\n [],\r\n );\r\n // handlers\r\n const updateSharedValues = (event: NativeEvent, platforms: string[]) => {\r\n \"worklet\";\r\n\r\n if (platforms.includes(OS)) {\r\n // eslint-disable-next-line react-compiler/react-compiler\r\n // progressSV.value = event.progress;\r\n // heightSV.value = -event.height;\r\n const dur = 460\r\n progressSV.value = withTiming(event.progress, { duration: dur, easing: Easing.out(Easing.exp) });\r\n heightSV.value = withTiming(-event.height,{ duration: dur, easing: Easing.out(Easing.exp)});\r\n }\r\n };\r\n const keyboardHandler = useAnimatedKeyboardHandler(\r\n {\r\n onKeyboardMoveStart: (event: NativeEvent) => {\r\n \"worklet\";\r\n\r\n broadcastKeyboardEvents(\"onStart\", event);\r\n updateSharedValues(event, [\"ios\"]);\r\n },\r\n onKeyboardMove: (event: NativeEvent) => {\r\n \"worklet\";\r\n\r\n broadcastKeyboardEvents(\"onMove\", event);\r\n updateSharedValues(event, [\"android\"]);\r\n },\r\n onKeyboardMoveEnd: (event: NativeEvent) => {\r\n \"worklet\";\r\n broadcastKeyboardEvents(\"onEnd\", event);\r\n updateSharedValues(event, ['harmony']);\r\n },\r\n onKeyboardMoveInteractive: (event: NativeEvent) => {\r\n \"worklet\";\r\n\r\n updateSharedValues(event, [\"android\", \"ios\"]);\r\n broadcastKeyboardEvents(\"onInteractive\", event);\r\n },\r\n },\r\n [],\r\n );\r\n const inputLayoutHandler = useFocusedInputLayoutHandler(\r\n {\r\n onFocusedInputLayoutChanged: (e) => {\r\n \"worklet\";\r\n\r\n if (e.target !== -1) {\r\n layout.value = e;\r\n } else {\r\n layout.value = null;\r\n }\r\n },\r\n },\r\n [],\r\n );\r\n const inputTextHandler = useFocusedInputTextHandler(\r\n {\r\n onFocusedInputTextChanged: (e) => {\r\n \"worklet\";\r\n\r\n broadcastInputEvents(\"onChangeText\", e);\r\n },\r\n },\r\n [],\r\n );\r\n const inputSelectionHandler = useFocusedInputSelectionHandler(\r\n {\r\n onFocusedInputSelectionChanged: (e) => {\r\n \"worklet\";\r\n broadcastInputEvents(\"onSelectionChange\", e);\r\n },\r\n },\r\n [],\r\n );\r\n // effects\r\n useEffect(() => {\r\n if (enabled) {\r\n applyMonkeyPatch();\r\n } else {\r\n revertMonkeyPatch();\r\n }\r\n }, [enabled]);\r\n\r\n return (\r\n <KeyboardContext.Provider value={context}>\r\n <KeyboardControllerViewAnimated\r\n enabled={enabled}\r\n onKeyboardMoveReanimated={keyboardHandler}\r\n onKeyboardMoveStart={OS === \"ios\" ? onKeyboardMove : undefined}\r\n onKeyboardMove={OS === \"android\" ? onKeyboardMove : undefined}\r\n onKeyboardMoveInteractive={onKeyboardMove}\r\n onKeyboardMoveEnd={ OS as string === \"harmony\"?onKeyboardMove:undefined}\r\n onFocusedInputLayoutChangedReanimated={inputLayoutHandler}\r\n onFocusedInputTextChangedReanimated={inputTextHandler}\r\n onFocusedInputSelectionChangedReanimated={inputSelectionHandler}\r\n navigationBarTranslucent={navigationBarTranslucent}\r\n statusBarTranslucent={statusBarTranslucent}\r\n style={styles.container}\r\n >\r\n <Reanimated.View style={styles.container}>{children}</Reanimated.View>\r\n {/* {children} */}\r\n </KeyboardControllerViewAnimated>\r\n <Animated.View\r\n // we are using this small hack, because if the component (where\r\n // animated value has been used) is unmounted, then animation will\r\n // stop receiving events (seems like it's react-native optimization).\r\n // So we need to keep a reference to the animated value, to keep it's\r\n // always mounted (keep a reference to an animated value).\r\n //\r\n // To test why it's needed, try to open screen which consumes Animated.Value\r\n // then close it and open it again (for example 'Animated transition').\r\n style={style}\r\n />\r\n </KeyboardContext.Provider>\r\n );\r\n};\r\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAH,uBAAA,CAAAC,OAAA;AAEA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AAKsB,SAAAD,wBAAAS,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAX,uBAAA,YAAAA,CAAAS,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAA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/B,EAAE,KAAK,SAAS,GAAG+B,cAAc,GAAGqC,SAAU;IAC9DlB,yBAAyB,EAAEnB,cAAe;IAC1CkB,iBAAiB,EAAGjD,EAAE,KAAe,SAAS,GAAC+B,cAAc,GAACqC,SAAU;IACxEC,qCAAqC,EAAElB,kBAAmB;IAC1DmB,mCAAmC,EAAEf,gBAAiB;IACtDgB,wCAAwC,EAAEb,qBAAsB;IAChErD,wBAAwB,EAAEA,wBAAyB;IACnDD,oBAAoB,EAAEA,oBAAqB;IAC3CuB,KAAK,EAAEnC,MAAM,CAACG;EAAU,gBAExBrC,MAAA,CAAAoB,OAAA,CAAAsF,aAAA,CAACtG,sBAAA,CAAAgB,OAAU,CAAC8F,IAAI;IAAC7C,KAAK,EAAEnC,MAAM,CAACG;EAAU,GAAEQ,QAA0B,CAEvC,CAAC,eACjC7C,MAAA,CAAAoB,OAAA,CAAAsF,aAAA,CAACvG,YAAA,CAAA6B,QAAQ,CAACkF,IAAI;IACZ;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA7C,KAAK,EAAEA;EAAM,CACd,CACuB,CAAC;AAE/B,CAAC;AAAC8C,OAAA,CAAAvE,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeReanimated","_bindings","_context","_internal","_monkeyPatch","_reanimated","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","KeyboardControllerViewAnimated","Reanimated","createAnimatedComponent","Animated","KeyboardControllerView","styles","StyleSheet","create","container","flex","hidden","display","position","OS","Platform","KeyboardProvider","children","statusBarTranslucent","navigationBarTranslucent","enabled","initiallyEnabled","setEnabled","useState","progress","useAnimatedValue","height","progressSV","useSharedValue","heightSV","layout","setKeyboardHandlers","broadcastKeyboardEvents","useSharedHandlers","setInputHandlers","broadcastInputEvents","context","useMemo","animated","multiply","reanimated","style","transform","translateX","translateY","onKeyboardMove","event","nativeEvent","useNativeDriver","updateSharedValues","platforms","includes","dur","value","withTiming","duration","easing","Easing","out","exp","keyboardHandler","useAnimatedKeyboardHandler","onKeyboardMoveStart","onKeyboardMoveEnd","onKeyboardMoveInteractive","inputLayoutHandler","useFocusedInputLayoutHandler","onFocusedInputLayoutChanged","target","inputTextHandler","useFocusedInputTextHandler","onFocusedInputTextChanged","inputSelectionHandler","useFocusedInputSelectionHandler","onFocusedInputSelectionChanged","useEffect","applyMonkeyPatch","revertMonkeyPatch","createElement","KeyboardContext","Provider","onKeyboardMoveReanimated","undefined","onFocusedInputLayoutChangedReanimated","onFocusedInputTextChangedReanimated","onFocusedInputSelectionChangedReanimated","View","exports"],"sources":["animated.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useState } from \"react\";\r\nimport { Animated, Platform, StyleSheet } from \"react-native\";\r\nimport Reanimated, { useSharedValue, Easing, withTiming } from \"react-native-reanimated\";\r\n\r\nimport { KeyboardControllerView } from \"./bindings\";\r\nimport { KeyboardContext } from \"./context\";\r\nimport { useAnimatedValue, useSharedHandlers } from \"./internal\";\r\nimport { applyMonkeyPatch, revertMonkeyPatch } from \"./monkey-patch\";\r\nimport {\r\n useAnimatedKeyboardHandler,\r\n useFocusedInputLayoutHandler,\r\n useFocusedInputSelectionHandler,\r\n useFocusedInputTextHandler,\r\n} from \"./reanimated\";\r\n\r\nimport type { KeyboardAnimationContext } from \"./context\";\r\nimport type {\r\n FocusedInputHandler,\r\n FocusedInputLayoutChangedEvent,\r\n KeyboardControllerProps,\r\n KeyboardHandler,\r\n NativeEvent,\r\n} from \"./types\";\r\nimport type { ViewStyle } from \"react-native\";\r\n\r\nconst KeyboardControllerViewAnimated = Reanimated.createAnimatedComponent(\r\n Animated.createAnimatedComponent(\r\n KeyboardControllerView,\r\n ) as React.FC<KeyboardControllerProps>,\r\n);\r\n\r\ntype Styles = {\r\n container: ViewStyle;\r\n hidden: ViewStyle;\r\n};\r\n\r\nconst styles = StyleSheet.create<Styles>({\r\n container: {\r\n flex: 1,\r\n },\r\n hidden: {\r\n display: \"none\",\r\n position: \"absolute\",\r\n },\r\n});\r\n\r\ntype KeyboardProviderProps = {\r\n children: React.ReactNode;\r\n /**\r\n * Set the value to `true`, if you use translucent status bar on Android.\r\n * If you already control status bar translucency via `react-native-screens`\r\n * or `StatusBar` component from `react-native`, you can ignore it.\r\n * Defaults to `false`.\r\n *\r\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/14\r\n * @platform android\r\n */\r\n statusBarTranslucent?: boolean;\r\n /**\r\n * Set the value to `true`, if you use translucent navigation bar on Android.\r\n * Defaults to `false`.\r\n *\r\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/119\r\n * @platform android\r\n */\r\n navigationBarTranslucent?: boolean;\r\n /**\r\n * A boolean prop indicating whether the module is enabled. It indicate only initial state,\r\n * i. e. if you try to change this prop after component mount it will not have any effect.\r\n * To change the property in runtime use `useKeyboardController` hook and `setEnabled` method.\r\n * Defaults to `true`.\r\n */\r\n enabled?: boolean;\r\n};\r\n\r\n// capture `Platform.OS` in separate variable to avoid deep workletization of entire RN package\r\n// 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\r\nconst OS = Platform.OS;\r\n\r\nexport const KeyboardProvider = ({\r\n children,\r\n statusBarTranslucent,\r\n navigationBarTranslucent,\r\n enabled: initiallyEnabled = true,\r\n}: KeyboardProviderProps) => {\r\n // state\r\n const [enabled, setEnabled] = useState(initiallyEnabled);\r\n // animated values\r\n const progress = useAnimatedValue(0);\r\n const height = useAnimatedValue(0);\r\n // shared values\r\n const progressSV = useSharedValue(0);\r\n const heightSV = useSharedValue(0);\r\n const layout = useSharedValue<FocusedInputLayoutChangedEvent | null>(null);\r\n const [setKeyboardHandlers, broadcastKeyboardEvents] =\r\n useSharedHandlers<KeyboardHandler>();\r\n const [setInputHandlers, broadcastInputEvents] =\r\n useSharedHandlers<FocusedInputHandler>();\r\n // memo\r\n const context = useMemo<KeyboardAnimationContext>(\r\n () => ({\r\n enabled,\r\n animated: { progress: progress, height: Animated.multiply(height, -1) },\r\n reanimated: { progress: progressSV, height: heightSV },\r\n layout,\r\n setKeyboardHandlers,\r\n setInputHandlers,\r\n setEnabled,\r\n }),\r\n [enabled],\r\n );\r\n const style = useMemo(\r\n () => [\r\n styles.hidden,\r\n { transform: [{ translateX: height }, { translateY: progress }] },\r\n ],\r\n [],\r\n );\r\n const onKeyboardMove = useMemo(\r\n () =>\r\n Animated.event(\r\n [\r\n {\r\n nativeEvent: {\r\n progress,\r\n height,\r\n },\r\n },\r\n ],\r\n { useNativeDriver: Platform.OS as string == 'harmony' ? false : true },\r\n ),\r\n [],\r\n );\r\n // handlers\r\n const updateSharedValues = (event: NativeEvent, platforms: string[]) => {\r\n \"worklet\";\r\n\r\n if (platforms.includes(OS)) {\r\n // eslint-disable-next-line react-compiler/react-compiler\r\n if (Platform.OS as string == 'harmony') {\r\n const dur = 460\r\n progressSV.value = withTiming(event.progress, { duration: dur, easing: Easing.out(Easing.exp) });\r\n heightSV.value = withTiming(-event.height, { duration: dur, easing: Easing.out(Easing.exp) });\r\n } else {\r\n progressSV.value = event.progress;\r\n heightSV.value = -event.height;\r\n\r\n }\r\n }\r\n };\r\n const keyboardHandler = useAnimatedKeyboardHandler(\r\n {\r\n onKeyboardMoveStart: (event: NativeEvent) => {\r\n \"worklet\";\r\n\r\n broadcastKeyboardEvents(\"onStart\", event);\r\n updateSharedValues(event, [\"ios\"]);\r\n },\r\n onKeyboardMove: (event: NativeEvent) => {\r\n \"worklet\";\r\n\r\n broadcastKeyboardEvents(\"onMove\", event);\r\n updateSharedValues(event, [\"android\"]);\r\n },\r\n onKeyboardMoveEnd: (event: NativeEvent) => {\r\n \"worklet\";\r\n broadcastKeyboardEvents(\"onEnd\", event);\r\n updateSharedValues(event, ['harmony']);\r\n },\r\n onKeyboardMoveInteractive: (event: NativeEvent) => {\r\n \"worklet\";\r\n\r\n updateSharedValues(event, [\"android\", \"ios\"]);\r\n broadcastKeyboardEvents(\"onInteractive\", event);\r\n },\r\n },\r\n [],\r\n );\r\n const inputLayoutHandler = useFocusedInputLayoutHandler(\r\n {\r\n onFocusedInputLayoutChanged: (e) => {\r\n \"worklet\";\r\n\r\n if (e.target !== -1) {\r\n layout.value = e;\r\n } else {\r\n layout.value = null;\r\n }\r\n },\r\n },\r\n [],\r\n );\r\n const inputTextHandler = useFocusedInputTextHandler(\r\n {\r\n onFocusedInputTextChanged: (e) => {\r\n \"worklet\";\r\n\r\n broadcastInputEvents(\"onChangeText\", e);\r\n },\r\n },\r\n [],\r\n );\r\n const inputSelectionHandler = useFocusedInputSelectionHandler(\r\n {\r\n onFocusedInputSelectionChanged: (e) => {\r\n \"worklet\";\r\n broadcastInputEvents(\"onSelectionChange\", e);\r\n },\r\n },\r\n [],\r\n );\r\n // effects\r\n useEffect(() => {\r\n if (enabled) {\r\n applyMonkeyPatch();\r\n } else {\r\n revertMonkeyPatch();\r\n }\r\n }, [enabled]);\r\n\r\n return (\r\n <KeyboardContext.Provider value={context}>\r\n <KeyboardControllerViewAnimated\r\n enabled={enabled}\r\n onKeyboardMoveReanimated={keyboardHandler}\r\n onKeyboardMoveStart={OS === \"ios\" ? onKeyboardMove : undefined}\r\n onKeyboardMove={OS === \"android\" ? onKeyboardMove : undefined}\r\n onKeyboardMoveInteractive={onKeyboardMove}\r\n onKeyboardMoveEnd={OS as string === \"harmony\" ? onKeyboardMove : undefined}\r\n onFocusedInputLayoutChangedReanimated={inputLayoutHandler}\r\n onFocusedInputTextChangedReanimated={inputTextHandler}\r\n onFocusedInputSelectionChangedReanimated={inputSelectionHandler}\r\n navigationBarTranslucent={navigationBarTranslucent}\r\n statusBarTranslucent={statusBarTranslucent}\r\n style={styles.container}\r\n >\r\n <Reanimated.View style={styles.container}>{children}</Reanimated.View>\r\n {/* {children} */}\r\n </KeyboardControllerViewAnimated>\r\n <Animated.View\r\n // we are using this small hack, because if the component (where\r\n // animated value has been used) is unmounted, then animation will\r\n // stop receiving events (seems like it's react-native optimization).\r\n // So we need to keep a reference to the animated value, to keep it's\r\n // always mounted (keep a reference to an animated value).\r\n //\r\n // To test why it's needed, try to open screen which consumes Animated.Value\r\n // then close it and open it again (for example 'Animated transition').\r\n style={style}\r\n />\r\n </KeyboardContext.Provider>\r\n );\r\n};\r\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAH,uBAAA,CAAAC,OAAA;AAEA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AAKsB,SAAAD,wBAAAS,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAX,uBAAA,YAAAA,CAAAS,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC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B,cAAe;IAC1CkB,iBAAiB,EAAEjD,EAAE,KAAe,SAAS,GAAG+B,cAAc,GAAGqC,SAAU;IAC3EC,qCAAqC,EAAElB,kBAAmB;IAC1DmB,mCAAmC,EAAEf,gBAAiB;IACtDgB,wCAAwC,EAAEb,qBAAsB;IAChErD,wBAAwB,EAAEA,wBAAyB;IACnDD,oBAAoB,EAAEA,oBAAqB;IAC3CuB,KAAK,EAAEnC,MAAM,CAACG;EAAU,gBAExBrC,MAAA,CAAAoB,OAAA,CAAAsF,aAAA,CAACtG,sBAAA,CAAAgB,OAAU,CAAC8F,IAAI;IAAC7C,KAAK,EAAEnC,MAAM,CAACG;EAAU,GAAEQ,QAA0B,CAEvC,CAAC,eACjC7C,MAAA,CAAAoB,OAAA,CAAAsF,aAAA,CAACvG,YAAA,CAAA6B,QAAQ,CAACkF,IAAI;IACZ;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA7C,KAAK,EAAEA;EAAM,CACd,CACuB,CAAC;AAE/B,CAAC;AAAC8C,OAAA,CAAAvE,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
|
@@ -18,6 +18,8 @@ let AndroidSoftInputModes = exports.AndroidSoftInputModes = /*#__PURE__*/functio
|
|
|
18
18
|
AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_STATE_ALWAYS_VISIBLE"] = 5] = "SOFT_INPUT_STATE_ALWAYS_VISIBLE";
|
|
19
19
|
AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_STATE_HIDDEN"] = 2] = "SOFT_INPUT_STATE_HIDDEN";
|
|
20
20
|
AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_STATE_UNCHANGED"] = 1] = "SOFT_INPUT_STATE_UNCHANGED";
|
|
21
|
+
// temporarily disable this rule to avoid breaking changes.
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values
|
|
21
23
|
AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_STATE_UNSPECIFIED"] = 0] = "SOFT_INPUT_STATE_UNSPECIFIED";
|
|
22
24
|
AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_STATE_VISIBLE"] = 4] = "SOFT_INPUT_STATE_VISIBLE";
|
|
23
25
|
return AndroidSoftInputModes;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["AndroidSoftInputModes","exports"],"sources":["constants.ts"],"sourcesContent":["// copied from `android.view.WindowManager.LayoutParams`\r\nexport enum AndroidSoftInputModes {\r\n SOFT_INPUT_ADJUST_NOTHING = 48,\r\n SOFT_INPUT_ADJUST_PAN = 32,\r\n SOFT_INPUT_ADJUST_RESIZE = 16,\r\n SOFT_INPUT_ADJUST_UNSPECIFIED = 0,\r\n SOFT_INPUT_IS_FORWARD_NAVIGATION = 256,\r\n SOFT_INPUT_MASK_ADJUST = 240,\r\n SOFT_INPUT_MASK_STATE = 15,\r\n SOFT_INPUT_MODE_CHANGED = 512,\r\n SOFT_INPUT_STATE_ALWAYS_HIDDEN = 3,\r\n SOFT_INPUT_STATE_ALWAYS_VISIBLE = 5,\r\n SOFT_INPUT_STATE_HIDDEN = 2,\r\n SOFT_INPUT_STATE_UNCHANGED = 1,\r\n // temporarily disable this rule to avoid breaking changes.\r\n // eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values\r\n SOFT_INPUT_STATE_UNSPECIFIED = 0,\r\n SOFT_INPUT_STATE_VISIBLE = 4,\r\n}\r\n"],"mappings":";;;;;;AAAA;AAAA,IACYA,qBAAqB,GAAAC,OAAA,CAAAD,qBAAA,0BAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;
|
|
1
|
+
{"version":3,"names":["AndroidSoftInputModes","exports"],"sources":["constants.ts"],"sourcesContent":["// copied from `android.view.WindowManager.LayoutParams`\r\nexport enum AndroidSoftInputModes {\r\n SOFT_INPUT_ADJUST_NOTHING = 48,\r\n SOFT_INPUT_ADJUST_PAN = 32,\r\n SOFT_INPUT_ADJUST_RESIZE = 16,\r\n SOFT_INPUT_ADJUST_UNSPECIFIED = 0,\r\n SOFT_INPUT_IS_FORWARD_NAVIGATION = 256,\r\n SOFT_INPUT_MASK_ADJUST = 240,\r\n SOFT_INPUT_MASK_STATE = 15,\r\n SOFT_INPUT_MODE_CHANGED = 512,\r\n SOFT_INPUT_STATE_ALWAYS_HIDDEN = 3,\r\n SOFT_INPUT_STATE_ALWAYS_VISIBLE = 5,\r\n SOFT_INPUT_STATE_HIDDEN = 2,\r\n SOFT_INPUT_STATE_UNCHANGED = 1,\r\n // temporarily disable this rule to avoid breaking changes.\r\n // eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values\r\n SOFT_INPUT_STATE_UNSPECIFIED = 0,\r\n SOFT_INPUT_STATE_VISIBLE = 4,\r\n}\r\n"],"mappings":";;;;;;AAAA;AAAA,IACYA,qBAAqB,GAAAC,OAAA,CAAAD,qBAAA,0BAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAa/B;EACA;EAdUA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAAA,OAArBA,qBAAqB;AAAA","ignoreList":[]}
|
package/lib/module/animated.js
CHANGED
|
@@ -73,17 +73,20 @@ export const KeyboardProvider = ({
|
|
|
73
73
|
|
|
74
74
|
if (platforms.includes(OS)) {
|
|
75
75
|
// eslint-disable-next-line react-compiler/react-compiler
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
76
|
+
if (Platform.OS == 'harmony') {
|
|
77
|
+
const dur = 460;
|
|
78
|
+
progressSV.value = withTiming(event.progress, {
|
|
79
|
+
duration: dur,
|
|
80
|
+
easing: Easing.out(Easing.exp)
|
|
81
|
+
});
|
|
82
|
+
heightSV.value = withTiming(-event.height, {
|
|
83
|
+
duration: dur,
|
|
84
|
+
easing: Easing.out(Easing.exp)
|
|
85
|
+
});
|
|
86
|
+
} else {
|
|
87
|
+
progressSV.value = event.progress;
|
|
88
|
+
heightSV.value = -event.height;
|
|
89
|
+
}
|
|
87
90
|
}
|
|
88
91
|
};
|
|
89
92
|
const keyboardHandler = useAnimatedKeyboardHandler({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useEffect","useMemo","useState","Animated","Platform","StyleSheet","Reanimated","useSharedValue","Easing","withTiming","KeyboardControllerView","KeyboardContext","useAnimatedValue","useSharedHandlers","applyMonkeyPatch","revertMonkeyPatch","useAnimatedKeyboardHandler","useFocusedInputLayoutHandler","useFocusedInputSelectionHandler","useFocusedInputTextHandler","KeyboardControllerViewAnimated","createAnimatedComponent","styles","create","container","flex","hidden","display","position","OS","KeyboardProvider","children","statusBarTranslucent","navigationBarTranslucent","enabled","initiallyEnabled","setEnabled","progress","height","progressSV","heightSV","layout","setKeyboardHandlers","broadcastKeyboardEvents","setInputHandlers","broadcastInputEvents","context","animated","multiply","reanimated","style","transform","translateX","translateY","onKeyboardMove","event","nativeEvent","useNativeDriver","updateSharedValues","platforms","includes","dur","value","duration","easing","out","exp","keyboardHandler","onKeyboardMoveStart","onKeyboardMoveEnd","onKeyboardMoveInteractive","inputLayoutHandler","onFocusedInputLayoutChanged","e","target","inputTextHandler","onFocusedInputTextChanged","inputSelectionHandler","onFocusedInputSelectionChanged","createElement","Provider","onKeyboardMoveReanimated","undefined","onFocusedInputLayoutChangedReanimated","onFocusedInputTextChangedReanimated","onFocusedInputSelectionChangedReanimated","View"],"sources":["animated.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useState } from \"react\";\r\nimport { Animated, Platform, StyleSheet } from \"react-native\";\r\nimport Reanimated, { useSharedValue, Easing, withTiming } from \"react-native-reanimated\";\r\n\r\nimport { KeyboardControllerView } from \"./bindings\";\r\nimport { KeyboardContext } from \"./context\";\r\nimport { useAnimatedValue, useSharedHandlers } from \"./internal\";\r\nimport { applyMonkeyPatch, revertMonkeyPatch } from \"./monkey-patch\";\r\nimport {\r\n useAnimatedKeyboardHandler,\r\n useFocusedInputLayoutHandler,\r\n useFocusedInputSelectionHandler,\r\n useFocusedInputTextHandler,\r\n} from \"./reanimated\";\r\n\r\nimport type { KeyboardAnimationContext } from \"./context\";\r\nimport type {\r\n FocusedInputHandler,\r\n FocusedInputLayoutChangedEvent,\r\n KeyboardControllerProps,\r\n KeyboardHandler,\r\n NativeEvent,\r\n} from \"./types\";\r\nimport type { ViewStyle } from \"react-native\";\r\n\r\nconst KeyboardControllerViewAnimated = Reanimated.createAnimatedComponent(\r\n Animated.createAnimatedComponent(\r\n KeyboardControllerView,\r\n ) as React.FC<KeyboardControllerProps>,\r\n);\r\n\r\ntype Styles = {\r\n container: ViewStyle;\r\n hidden: ViewStyle;\r\n};\r\n\r\nconst styles = StyleSheet.create<Styles>({\r\n container: {\r\n flex: 1,\r\n },\r\n hidden: {\r\n display: \"none\",\r\n position: \"absolute\",\r\n },\r\n});\r\n\r\ntype KeyboardProviderProps = {\r\n children: React.ReactNode;\r\n /**\r\n * Set the value to `true`, if you use translucent status bar on Android.\r\n * If you already control status bar translucency via `react-native-screens`\r\n * or `StatusBar` component from `react-native`, you can ignore it.\r\n * Defaults to `false`.\r\n *\r\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/14\r\n * @platform android\r\n */\r\n statusBarTranslucent?: boolean;\r\n /**\r\n * Set the value to `true`, if you use translucent navigation bar on Android.\r\n * Defaults to `false`.\r\n *\r\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/119\r\n * @platform android\r\n */\r\n navigationBarTranslucent?: boolean;\r\n /**\r\n * A boolean prop indicating whether the module is enabled. It indicate only initial state,\r\n * i. e. if you try to change this prop after component mount it will not have any effect.\r\n * To change the property in runtime use `useKeyboardController` hook and `setEnabled` method.\r\n * Defaults to `true`.\r\n */\r\n enabled?: boolean;\r\n};\r\n\r\n// capture `Platform.OS` in separate variable to avoid deep workletization of entire RN package\r\n// 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\r\nconst OS = Platform.OS;\r\n\r\nexport const KeyboardProvider = ({\r\n children,\r\n statusBarTranslucent,\r\n navigationBarTranslucent,\r\n enabled: initiallyEnabled = true,\r\n}: KeyboardProviderProps) => {\r\n // state\r\n const [enabled, setEnabled] = useState(initiallyEnabled);\r\n // animated values\r\n const progress = useAnimatedValue(0);\r\n const height = useAnimatedValue(0);\r\n // shared values\r\n const progressSV = useSharedValue(0);\r\n const heightSV = useSharedValue(0);\r\n const layout = useSharedValue<FocusedInputLayoutChangedEvent | null>(null);\r\n const [setKeyboardHandlers, broadcastKeyboardEvents] =\r\n useSharedHandlers<KeyboardHandler>();\r\n const [setInputHandlers, broadcastInputEvents] =\r\n useSharedHandlers<FocusedInputHandler>();\r\n // memo\r\n const context = useMemo<KeyboardAnimationContext>(\r\n () => ({\r\n enabled,\r\n animated: { progress: progress, height: Animated.multiply(height,-1) },\r\n reanimated: { progress: progressSV, height: heightSV },\r\n layout,\r\n setKeyboardHandlers,\r\n setInputHandlers,\r\n setEnabled,\r\n }),\r\n [enabled],\r\n );\r\n const style = useMemo(\r\n () => [\r\n styles.hidden,\r\n { transform: [{ translateX: height }, { translateY: progress }] },\r\n ],\r\n [],\r\n );\r\n const onKeyboardMove = useMemo(\r\n () =>\r\n Animated.event(\r\n [\r\n {\r\n nativeEvent: {\r\n progress,\r\n height,\r\n },\r\n },\r\n ],\r\n { useNativeDriver:Platform.OS as string=='harmony'?false:true },\r\n ),\r\n [],\r\n );\r\n // handlers\r\n const updateSharedValues = (event: NativeEvent, platforms: string[]) => {\r\n \"worklet\";\r\n\r\n if (platforms.includes(OS)) {\r\n // eslint-disable-next-line react-compiler/react-compiler\r\n // progressSV.value = event.progress;\r\n // heightSV.value = -event.height;\r\n const dur = 460\r\n progressSV.value = withTiming(event.progress, { duration: dur, easing: Easing.out(Easing.exp) });\r\n heightSV.value = withTiming(-event.height,{ duration: dur, easing: Easing.out(Easing.exp)});\r\n }\r\n };\r\n const keyboardHandler = useAnimatedKeyboardHandler(\r\n {\r\n onKeyboardMoveStart: (event: NativeEvent) => {\r\n \"worklet\";\r\n\r\n broadcastKeyboardEvents(\"onStart\", event);\r\n updateSharedValues(event, [\"ios\"]);\r\n },\r\n onKeyboardMove: (event: NativeEvent) => {\r\n \"worklet\";\r\n\r\n broadcastKeyboardEvents(\"onMove\", event);\r\n updateSharedValues(event, [\"android\"]);\r\n },\r\n onKeyboardMoveEnd: (event: NativeEvent) => {\r\n \"worklet\";\r\n broadcastKeyboardEvents(\"onEnd\", event);\r\n updateSharedValues(event, ['harmony']);\r\n },\r\n onKeyboardMoveInteractive: (event: NativeEvent) => {\r\n \"worklet\";\r\n\r\n updateSharedValues(event, [\"android\", \"ios\"]);\r\n broadcastKeyboardEvents(\"onInteractive\", event);\r\n },\r\n },\r\n [],\r\n );\r\n const inputLayoutHandler = useFocusedInputLayoutHandler(\r\n {\r\n onFocusedInputLayoutChanged: (e) => {\r\n \"worklet\";\r\n\r\n if (e.target !== -1) {\r\n layout.value = e;\r\n } else {\r\n layout.value = null;\r\n }\r\n },\r\n },\r\n [],\r\n );\r\n const inputTextHandler = useFocusedInputTextHandler(\r\n {\r\n onFocusedInputTextChanged: (e) => {\r\n \"worklet\";\r\n\r\n broadcastInputEvents(\"onChangeText\", e);\r\n },\r\n },\r\n [],\r\n );\r\n const inputSelectionHandler = useFocusedInputSelectionHandler(\r\n {\r\n onFocusedInputSelectionChanged: (e) => {\r\n \"worklet\";\r\n broadcastInputEvents(\"onSelectionChange\", e);\r\n },\r\n },\r\n [],\r\n );\r\n // effects\r\n useEffect(() => {\r\n if (enabled) {\r\n applyMonkeyPatch();\r\n } else {\r\n revertMonkeyPatch();\r\n }\r\n }, [enabled]);\r\n\r\n return (\r\n <KeyboardContext.Provider value={context}>\r\n <KeyboardControllerViewAnimated\r\n enabled={enabled}\r\n onKeyboardMoveReanimated={keyboardHandler}\r\n onKeyboardMoveStart={OS === \"ios\" ? onKeyboardMove : undefined}\r\n onKeyboardMove={OS === \"android\" ? onKeyboardMove : undefined}\r\n onKeyboardMoveInteractive={onKeyboardMove}\r\n onKeyboardMoveEnd={ OS as string === \"harmony\"?onKeyboardMove:undefined}\r\n onFocusedInputLayoutChangedReanimated={inputLayoutHandler}\r\n onFocusedInputTextChangedReanimated={inputTextHandler}\r\n onFocusedInputSelectionChangedReanimated={inputSelectionHandler}\r\n navigationBarTranslucent={navigationBarTranslucent}\r\n statusBarTranslucent={statusBarTranslucent}\r\n style={styles.container}\r\n >\r\n <Reanimated.View style={styles.container}>{children}</Reanimated.View>\r\n {/* {children} */}\r\n </KeyboardControllerViewAnimated>\r\n <Animated.View\r\n // we are using this small hack, because if the component (where\r\n // animated value has been used) is unmounted, then animation will\r\n // stop receiving events (seems like it's react-native optimization).\r\n // So we need to keep a reference to the animated value, to keep it's\r\n // always mounted (keep a reference to an animated value).\r\n //\r\n // To test why it's needed, try to open screen which consumes Animated.Value\r\n // then close it and open it again (for example 'Animated transition').\r\n style={style}\r\n />\r\n </KeyboardContext.Provider>\r\n );\r\n};\r\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAC3D,SAASC,QAAQ,EAAEC,QAAQ,EAAEC,UAAU,QAAQ,cAAc;AAC7D,OAAOC,UAAU,IAAIC,cAAc,EAAEC,MAAM,EAAEC,UAAU,QAAQ,yBAAyB;AAExF,SAASC,sBAAsB,QAAQ,YAAY;AACnD,SAASC,eAAe,QAAQ,WAAW;AAC3C,SAASC,gBAAgB,EAAEC,iBAAiB,QAAQ,YAAY;AAChE,SAASC,gBAAgB,EAAEC,iBAAiB,QAAQ,gBAAgB;AACpE,SACEC,0BAA0B,EAC1BC,4BAA4B,EAC5BC,+BAA+B,EAC/BC,0BAA0B,QACrB,cAAc;AAYrB,MAAMC,8BAA8B,GAAGd,UAAU,CAACe,uBAAuB,CACvElB,QAAQ,CAACkB,uBAAuB,CAC9BX,sBACF,CACF,CAAC;AAOD,MAAMY,MAAM,GAAGjB,UAAU,CAACkB,MAAM,CAAS;EACvCC,SAAS,EAAE;IACTC,IAAI,EAAE;EACR,CAAC;EACDC,MAAM,EAAE;IACNC,OAAO,EAAE,MAAM;IACfC,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC;AA+BF;AACA;AACA,MAAMC,EAAE,GAAGzB,QAAQ,CAACyB,EAAE;AAEtB,OAAO,MAAMC,gBAAgB,GAAGA,CAAC;EAC/BC,QAAQ;EACRC,oBAAoB;EACpBC,wBAAwB;EACxBC,OAAO,EAAEC,gBAAgB,GAAG;AACP,CAAC,KAAK;EAC3B;EACA,MAAM,CAACD,OAAO,EAAEE,UAAU,CAAC,GAAGlC,QAAQ,CAACiC,gBAAgB,CAAC;EAC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zB,EAAE,KAAK,SAAS,GAAGyB,cAAc,GAAG4B,SAAU;IAC9DZ,yBAAyB,EAAEhB,cAAe;IAC1Ce,iBAAiB,EAAGxC,EAAE,KAAe,SAAS,GAACyB,cAAc,GAAC4B,SAAU;IACxEC,qCAAqC,EAAEZ,kBAAmB;IAC1Da,mCAAmC,EAAET,gBAAiB;IACtDU,wCAAwC,EAAER,qBAAsB;IAChE5C,wBAAwB,EAAEA,wBAAyB;IACnDD,oBAAoB,EAAEA,oBAAqB;IAC3CkB,KAAK,EAAE5B,MAAM,CAACE;EAAU,gBAExBzB,KAAA,CAAAgF,aAAA,CAACzE,UAAU,CAACgF,IAAI;IAACpC,KAAK,EAAE5B,MAAM,CAACE;EAAU,GAAEO,QAA0B,CAEvC,CAAC,eACjChC,KAAA,CAAAgF,aAAA,CAAC5E,QAAQ,CAACmF,IAAI;IACZ;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACApC,KAAK,EAAEA;EAAM,CACd,CACuB,CAAC;AAE/B,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["React","useEffect","useMemo","useState","Animated","Platform","StyleSheet","Reanimated","useSharedValue","Easing","withTiming","KeyboardControllerView","KeyboardContext","useAnimatedValue","useSharedHandlers","applyMonkeyPatch","revertMonkeyPatch","useAnimatedKeyboardHandler","useFocusedInputLayoutHandler","useFocusedInputSelectionHandler","useFocusedInputTextHandler","KeyboardControllerViewAnimated","createAnimatedComponent","styles","create","container","flex","hidden","display","position","OS","KeyboardProvider","children","statusBarTranslucent","navigationBarTranslucent","enabled","initiallyEnabled","setEnabled","progress","height","progressSV","heightSV","layout","setKeyboardHandlers","broadcastKeyboardEvents","setInputHandlers","broadcastInputEvents","context","animated","multiply","reanimated","style","transform","translateX","translateY","onKeyboardMove","event","nativeEvent","useNativeDriver","updateSharedValues","platforms","includes","dur","value","duration","easing","out","exp","keyboardHandler","onKeyboardMoveStart","onKeyboardMoveEnd","onKeyboardMoveInteractive","inputLayoutHandler","onFocusedInputLayoutChanged","e","target","inputTextHandler","onFocusedInputTextChanged","inputSelectionHandler","onFocusedInputSelectionChanged","createElement","Provider","onKeyboardMoveReanimated","undefined","onFocusedInputLayoutChangedReanimated","onFocusedInputTextChangedReanimated","onFocusedInputSelectionChangedReanimated","View"],"sources":["animated.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useState } from \"react\";\r\nimport { Animated, Platform, StyleSheet } from \"react-native\";\r\nimport Reanimated, { useSharedValue, Easing, withTiming } from \"react-native-reanimated\";\r\n\r\nimport { KeyboardControllerView } from \"./bindings\";\r\nimport { KeyboardContext } from \"./context\";\r\nimport { useAnimatedValue, useSharedHandlers } from \"./internal\";\r\nimport { applyMonkeyPatch, revertMonkeyPatch } from \"./monkey-patch\";\r\nimport {\r\n useAnimatedKeyboardHandler,\r\n useFocusedInputLayoutHandler,\r\n useFocusedInputSelectionHandler,\r\n useFocusedInputTextHandler,\r\n} from \"./reanimated\";\r\n\r\nimport type { KeyboardAnimationContext } from \"./context\";\r\nimport type {\r\n FocusedInputHandler,\r\n FocusedInputLayoutChangedEvent,\r\n KeyboardControllerProps,\r\n KeyboardHandler,\r\n NativeEvent,\r\n} from \"./types\";\r\nimport type { ViewStyle } from \"react-native\";\r\n\r\nconst KeyboardControllerViewAnimated = Reanimated.createAnimatedComponent(\r\n Animated.createAnimatedComponent(\r\n KeyboardControllerView,\r\n ) as React.FC<KeyboardControllerProps>,\r\n);\r\n\r\ntype Styles = {\r\n container: ViewStyle;\r\n hidden: ViewStyle;\r\n};\r\n\r\nconst styles = StyleSheet.create<Styles>({\r\n container: {\r\n flex: 1,\r\n },\r\n hidden: {\r\n display: \"none\",\r\n position: \"absolute\",\r\n },\r\n});\r\n\r\ntype KeyboardProviderProps = {\r\n children: React.ReactNode;\r\n /**\r\n * Set the value to `true`, if you use translucent status bar on Android.\r\n * If you already control status bar translucency via `react-native-screens`\r\n * or `StatusBar` component from `react-native`, you can ignore it.\r\n * Defaults to `false`.\r\n *\r\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/14\r\n * @platform android\r\n */\r\n statusBarTranslucent?: boolean;\r\n /**\r\n * Set the value to `true`, if you use translucent navigation bar on Android.\r\n * Defaults to `false`.\r\n *\r\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/119\r\n * @platform android\r\n */\r\n navigationBarTranslucent?: boolean;\r\n /**\r\n * A boolean prop indicating whether the module is enabled. It indicate only initial state,\r\n * i. e. if you try to change this prop after component mount it will not have any effect.\r\n * To change the property in runtime use `useKeyboardController` hook and `setEnabled` method.\r\n * Defaults to `true`.\r\n */\r\n enabled?: boolean;\r\n};\r\n\r\n// capture `Platform.OS` in separate variable to avoid deep workletization of entire RN package\r\n// 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\r\nconst OS = Platform.OS;\r\n\r\nexport const KeyboardProvider = ({\r\n children,\r\n statusBarTranslucent,\r\n navigationBarTranslucent,\r\n enabled: initiallyEnabled = true,\r\n}: KeyboardProviderProps) => {\r\n // state\r\n const [enabled, setEnabled] = useState(initiallyEnabled);\r\n // animated values\r\n const progress = useAnimatedValue(0);\r\n const height = useAnimatedValue(0);\r\n // shared values\r\n const progressSV = useSharedValue(0);\r\n const heightSV = useSharedValue(0);\r\n const layout = useSharedValue<FocusedInputLayoutChangedEvent | null>(null);\r\n const [setKeyboardHandlers, broadcastKeyboardEvents] =\r\n useSharedHandlers<KeyboardHandler>();\r\n const [setInputHandlers, broadcastInputEvents] =\r\n useSharedHandlers<FocusedInputHandler>();\r\n // memo\r\n const context = useMemo<KeyboardAnimationContext>(\r\n () => ({\r\n enabled,\r\n animated: { progress: progress, height: Animated.multiply(height, -1) },\r\n reanimated: { progress: progressSV, height: heightSV },\r\n layout,\r\n setKeyboardHandlers,\r\n setInputHandlers,\r\n setEnabled,\r\n }),\r\n [enabled],\r\n );\r\n const style = useMemo(\r\n () => [\r\n styles.hidden,\r\n { transform: [{ translateX: height }, { translateY: progress }] },\r\n ],\r\n [],\r\n );\r\n const onKeyboardMove = useMemo(\r\n () =>\r\n Animated.event(\r\n [\r\n {\r\n nativeEvent: {\r\n progress,\r\n height,\r\n },\r\n },\r\n ],\r\n { useNativeDriver: Platform.OS as string == 'harmony' ? false : true },\r\n ),\r\n [],\r\n );\r\n // handlers\r\n const updateSharedValues = (event: NativeEvent, platforms: string[]) => {\r\n \"worklet\";\r\n\r\n if (platforms.includes(OS)) {\r\n // eslint-disable-next-line react-compiler/react-compiler\r\n if (Platform.OS as string == 'harmony') {\r\n const dur = 460\r\n progressSV.value = withTiming(event.progress, { duration: dur, easing: Easing.out(Easing.exp) });\r\n heightSV.value = withTiming(-event.height, { duration: dur, easing: Easing.out(Easing.exp) });\r\n } else {\r\n progressSV.value = event.progress;\r\n heightSV.value = -event.height;\r\n\r\n }\r\n }\r\n };\r\n const keyboardHandler = useAnimatedKeyboardHandler(\r\n {\r\n onKeyboardMoveStart: (event: NativeEvent) => {\r\n \"worklet\";\r\n\r\n broadcastKeyboardEvents(\"onStart\", event);\r\n updateSharedValues(event, [\"ios\"]);\r\n },\r\n onKeyboardMove: (event: NativeEvent) => {\r\n \"worklet\";\r\n\r\n broadcastKeyboardEvents(\"onMove\", event);\r\n updateSharedValues(event, [\"android\"]);\r\n },\r\n onKeyboardMoveEnd: (event: NativeEvent) => {\r\n \"worklet\";\r\n broadcastKeyboardEvents(\"onEnd\", event);\r\n updateSharedValues(event, ['harmony']);\r\n },\r\n onKeyboardMoveInteractive: (event: NativeEvent) => {\r\n \"worklet\";\r\n\r\n updateSharedValues(event, [\"android\", \"ios\"]);\r\n broadcastKeyboardEvents(\"onInteractive\", event);\r\n },\r\n },\r\n [],\r\n );\r\n const inputLayoutHandler = useFocusedInputLayoutHandler(\r\n {\r\n onFocusedInputLayoutChanged: (e) => {\r\n \"worklet\";\r\n\r\n if (e.target !== -1) {\r\n layout.value = e;\r\n } else {\r\n layout.value = null;\r\n }\r\n },\r\n },\r\n [],\r\n );\r\n const inputTextHandler = useFocusedInputTextHandler(\r\n {\r\n onFocusedInputTextChanged: (e) => {\r\n \"worklet\";\r\n\r\n broadcastInputEvents(\"onChangeText\", e);\r\n },\r\n },\r\n [],\r\n );\r\n const inputSelectionHandler = useFocusedInputSelectionHandler(\r\n {\r\n onFocusedInputSelectionChanged: (e) => {\r\n \"worklet\";\r\n broadcastInputEvents(\"onSelectionChange\", e);\r\n },\r\n },\r\n [],\r\n );\r\n // effects\r\n useEffect(() => {\r\n if (enabled) {\r\n applyMonkeyPatch();\r\n } else {\r\n revertMonkeyPatch();\r\n }\r\n }, [enabled]);\r\n\r\n return (\r\n <KeyboardContext.Provider value={context}>\r\n <KeyboardControllerViewAnimated\r\n enabled={enabled}\r\n onKeyboardMoveReanimated={keyboardHandler}\r\n onKeyboardMoveStart={OS === \"ios\" ? onKeyboardMove : undefined}\r\n onKeyboardMove={OS === \"android\" ? onKeyboardMove : undefined}\r\n onKeyboardMoveInteractive={onKeyboardMove}\r\n onKeyboardMoveEnd={OS as string === \"harmony\" ? onKeyboardMove : undefined}\r\n onFocusedInputLayoutChangedReanimated={inputLayoutHandler}\r\n onFocusedInputTextChangedReanimated={inputTextHandler}\r\n onFocusedInputSelectionChangedReanimated={inputSelectionHandler}\r\n navigationBarTranslucent={navigationBarTranslucent}\r\n statusBarTranslucent={statusBarTranslucent}\r\n style={styles.container}\r\n >\r\n <Reanimated.View style={styles.container}>{children}</Reanimated.View>\r\n {/* {children} */}\r\n </KeyboardControllerViewAnimated>\r\n <Animated.View\r\n // we are using this small hack, because if the component (where\r\n // animated value has been used) is unmounted, then animation will\r\n // stop receiving events (seems like it's react-native optimization).\r\n // So we need to keep a reference to the animated value, to keep it's\r\n // always mounted (keep a reference to an animated value).\r\n //\r\n // To test why it's needed, try to open screen which consumes Animated.Value\r\n // then close it and open it again (for example 'Animated transition').\r\n style={style}\r\n />\r\n </KeyboardContext.Provider>\r\n );\r\n};\r\n"],"mappings":"AAAA,OAAOA,KA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yB,cAAc,GAAG4B,SAAU;IAC9DZ,yBAAyB,EAAEhB,cAAe;IAC1Ce,iBAAiB,EAAExC,EAAE,KAAe,SAAS,GAAGyB,cAAc,GAAG4B,SAAU;IAC3EC,qCAAqC,EAAEZ,kBAAmB;IAC1Da,mCAAmC,EAAET,gBAAiB;IACtDU,wCAAwC,EAAER,qBAAsB;IAChE5C,wBAAwB,EAAEA,wBAAyB;IACnDD,oBAAoB,EAAEA,oBAAqB;IAC3CkB,KAAK,EAAE5B,MAAM,CAACE;EAAU,gBAExBzB,KAAA,CAAAgF,aAAA,CAACzE,UAAU,CAACgF,IAAI;IAACpC,KAAK,EAAE5B,MAAM,CAACE;EAAU,GAAEO,QAA0B,CAEvC,CAAC,eACjChC,KAAA,CAAAgF,aAAA,CAAC5E,QAAQ,CAACmF,IAAI;IACZ;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACApC,KAAK,EAAEA;EAAM,CACd,CACuB,CAAC;AAE/B,CAAC","ignoreList":[]}
|
package/lib/module/constants.js
CHANGED
|
@@ -12,6 +12,8 @@ export let AndroidSoftInputModes = /*#__PURE__*/function (AndroidSoftInputModes)
|
|
|
12
12
|
AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_STATE_ALWAYS_VISIBLE"] = 5] = "SOFT_INPUT_STATE_ALWAYS_VISIBLE";
|
|
13
13
|
AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_STATE_HIDDEN"] = 2] = "SOFT_INPUT_STATE_HIDDEN";
|
|
14
14
|
AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_STATE_UNCHANGED"] = 1] = "SOFT_INPUT_STATE_UNCHANGED";
|
|
15
|
+
// temporarily disable this rule to avoid breaking changes.
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values
|
|
15
17
|
AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_STATE_UNSPECIFIED"] = 0] = "SOFT_INPUT_STATE_UNSPECIFIED";
|
|
16
18
|
AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_STATE_VISIBLE"] = 4] = "SOFT_INPUT_STATE_VISIBLE";
|
|
17
19
|
return AndroidSoftInputModes;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["AndroidSoftInputModes"],"sources":["constants.ts"],"sourcesContent":["// copied from `android.view.WindowManager.LayoutParams`\r\nexport enum AndroidSoftInputModes {\r\n SOFT_INPUT_ADJUST_NOTHING = 48,\r\n SOFT_INPUT_ADJUST_PAN = 32,\r\n SOFT_INPUT_ADJUST_RESIZE = 16,\r\n SOFT_INPUT_ADJUST_UNSPECIFIED = 0,\r\n SOFT_INPUT_IS_FORWARD_NAVIGATION = 256,\r\n SOFT_INPUT_MASK_ADJUST = 240,\r\n SOFT_INPUT_MASK_STATE = 15,\r\n SOFT_INPUT_MODE_CHANGED = 512,\r\n SOFT_INPUT_STATE_ALWAYS_HIDDEN = 3,\r\n SOFT_INPUT_STATE_ALWAYS_VISIBLE = 5,\r\n SOFT_INPUT_STATE_HIDDEN = 2,\r\n SOFT_INPUT_STATE_UNCHANGED = 1,\r\n // temporarily disable this rule to avoid breaking changes.\r\n // eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values\r\n SOFT_INPUT_STATE_UNSPECIFIED = 0,\r\n SOFT_INPUT_STATE_VISIBLE = 4,\r\n}\r\n"],"mappings":"AAAA;AACA,WAAYA,qBAAqB,0BAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;
|
|
1
|
+
{"version":3,"names":["AndroidSoftInputModes"],"sources":["constants.ts"],"sourcesContent":["// copied from `android.view.WindowManager.LayoutParams`\r\nexport enum AndroidSoftInputModes {\r\n SOFT_INPUT_ADJUST_NOTHING = 48,\r\n SOFT_INPUT_ADJUST_PAN = 32,\r\n SOFT_INPUT_ADJUST_RESIZE = 16,\r\n SOFT_INPUT_ADJUST_UNSPECIFIED = 0,\r\n SOFT_INPUT_IS_FORWARD_NAVIGATION = 256,\r\n SOFT_INPUT_MASK_ADJUST = 240,\r\n SOFT_INPUT_MASK_STATE = 15,\r\n SOFT_INPUT_MODE_CHANGED = 512,\r\n SOFT_INPUT_STATE_ALWAYS_HIDDEN = 3,\r\n SOFT_INPUT_STATE_ALWAYS_VISIBLE = 5,\r\n SOFT_INPUT_STATE_HIDDEN = 2,\r\n SOFT_INPUT_STATE_UNCHANGED = 1,\r\n // temporarily disable this rule to avoid breaking changes.\r\n // eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values\r\n SOFT_INPUT_STATE_UNSPECIFIED = 0,\r\n SOFT_INPUT_STATE_VISIBLE = 4,\r\n}\r\n"],"mappings":"AAAA;AACA,WAAYA,qBAAqB,0BAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAa/B;EACA;EAdUA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAAA,OAArBA,qBAAqB;AAAA","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-native-ohos/react-native-keyboard-controller",
|
|
3
|
-
"version": "1.12.8
|
|
3
|
+
"version": "1.12.8",
|
|
4
4
|
"description": "Keyboard manager which works in identical way on iOS and Android and harmony",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"react-native-keyboard-controller.podspec",
|
|
18
18
|
"jest",
|
|
19
19
|
"!lib/typescript/example",
|
|
20
|
+
"!harmony/keyboard_controller/build",
|
|
20
21
|
"!android/build",
|
|
21
22
|
"!android/.gradle",
|
|
22
23
|
"!android/gradle",
|
|
@@ -67,7 +68,7 @@
|
|
|
67
68
|
"bugs": {
|
|
68
69
|
"url": "https://github.com/react-native-oh-library/react-native-keyboard-controller/issues"
|
|
69
70
|
},
|
|
70
|
-
"homepage": "https://
|
|
71
|
+
"homepage": "https://github.com/react-native-oh-library/react-native-keyboard-controller/",
|
|
71
72
|
"publishConfig": {
|
|
72
73
|
"registry": "https://registry.npmjs.org/",
|
|
73
74
|
"access": "public"
|
package/src/animated.tsx
CHANGED
|
@@ -100,7 +100,7 @@ export const KeyboardProvider = ({
|
|
|
100
100
|
const context = useMemo<KeyboardAnimationContext>(
|
|
101
101
|
() => ({
|
|
102
102
|
enabled,
|
|
103
|
-
animated: { progress: progress, height: Animated.multiply(height
|
|
103
|
+
animated: { progress: progress, height: Animated.multiply(height, -1) },
|
|
104
104
|
reanimated: { progress: progressSV, height: heightSV },
|
|
105
105
|
layout,
|
|
106
106
|
setKeyboardHandlers,
|
|
@@ -127,7 +127,7 @@ export const KeyboardProvider = ({
|
|
|
127
127
|
},
|
|
128
128
|
},
|
|
129
129
|
],
|
|
130
|
-
{ useNativeDriver:Platform.OS as string=='harmony'?false:true },
|
|
130
|
+
{ useNativeDriver: Platform.OS as string == 'harmony' ? false : true },
|
|
131
131
|
),
|
|
132
132
|
[],
|
|
133
133
|
);
|
|
@@ -137,11 +137,15 @@ export const KeyboardProvider = ({
|
|
|
137
137
|
|
|
138
138
|
if (platforms.includes(OS)) {
|
|
139
139
|
// eslint-disable-next-line react-compiler/react-compiler
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
140
|
+
if (Platform.OS as string == 'harmony') {
|
|
141
|
+
const dur = 460
|
|
142
|
+
progressSV.value = withTiming(event.progress, { duration: dur, easing: Easing.out(Easing.exp) });
|
|
143
|
+
heightSV.value = withTiming(-event.height, { duration: dur, easing: Easing.out(Easing.exp) });
|
|
144
|
+
} else {
|
|
145
|
+
progressSV.value = event.progress;
|
|
146
|
+
heightSV.value = -event.height;
|
|
147
|
+
|
|
148
|
+
}
|
|
145
149
|
}
|
|
146
150
|
};
|
|
147
151
|
const keyboardHandler = useAnimatedKeyboardHandler(
|
|
@@ -222,7 +226,7 @@ export const KeyboardProvider = ({
|
|
|
222
226
|
onKeyboardMoveStart={OS === "ios" ? onKeyboardMove : undefined}
|
|
223
227
|
onKeyboardMove={OS === "android" ? onKeyboardMove : undefined}
|
|
224
228
|
onKeyboardMoveInteractive={onKeyboardMove}
|
|
225
|
-
onKeyboardMoveEnd={
|
|
229
|
+
onKeyboardMoveEnd={OS as string === "harmony" ? onKeyboardMove : undefined}
|
|
226
230
|
onFocusedInputLayoutChangedReanimated={inputLayoutHandler}
|
|
227
231
|
onFocusedInputTextChangedReanimated={inputTextHandler}
|
|
228
232
|
onFocusedInputSelectionChangedReanimated={inputSelectionHandler}
|