react-native-keyboard-controller 1.11.3 → 1.11.4
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/ios/KeyboardController.xcodeproj/project.pbxproj +4 -0
- package/ios/observers/KeyboardMovementObserver.swift +1 -25
- package/ios/traversal/KeyboardView.swift +36 -0
- package/lib/commonjs/animated.js +14 -12
- package/lib/commonjs/animated.js.map +1 -1
- package/lib/commonjs/bindings.js +5 -10
- package/lib/commonjs/bindings.js.map +1 -1
- package/lib/commonjs/bindings.native.js +7 -15
- package/lib/commonjs/bindings.native.js.map +1 -1
- package/lib/commonjs/components/KeyboardAvoidingView/hooks.js.map +1 -1
- package/lib/commonjs/components/KeyboardAvoidingView/index.js +15 -17
- package/lib/commonjs/components/KeyboardAvoidingView/index.js.map +1 -1
- package/lib/commonjs/components/KeyboardAwareScrollView/index.js +13 -16
- package/lib/commonjs/components/KeyboardAwareScrollView/index.js.map +1 -1
- package/lib/commonjs/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js +7 -7
- package/lib/commonjs/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js.map +1 -1
- package/lib/commonjs/components/KeyboardAwareScrollView/utils.js +3 -4
- package/lib/commonjs/components/KeyboardAwareScrollView/utils.js.map +1 -1
- package/lib/commonjs/components/KeyboardStickyView/index.js +12 -14
- package/lib/commonjs/components/KeyboardStickyView/index.js.map +1 -1
- package/lib/commonjs/components/KeyboardToolbar/Arrow.js +8 -10
- package/lib/commonjs/components/KeyboardToolbar/Arrow.js.map +1 -1
- package/lib/commonjs/components/KeyboardToolbar/Button.js +23 -26
- package/lib/commonjs/components/KeyboardToolbar/Button.js.map +1 -1
- package/lib/commonjs/components/KeyboardToolbar/colors.js +1 -2
- package/lib/commonjs/components/KeyboardToolbar/colors.js.map +1 -1
- package/lib/commonjs/components/KeyboardToolbar/colors.native.js +1 -2
- package/lib/commonjs/components/KeyboardToolbar/colors.native.js.map +1 -1
- package/lib/commonjs/components/KeyboardToolbar/index.js +11 -13
- package/lib/commonjs/components/KeyboardToolbar/index.js.map +1 -1
- package/lib/commonjs/components/KeyboardToolbar/types.js.map +1 -1
- package/lib/commonjs/components/hooks/useColorScheme.js +1 -2
- package/lib/commonjs/components/hooks/useColorScheme.js.map +1 -1
- package/lib/commonjs/components/index.js +2 -2
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/constants.js +3 -4
- package/lib/commonjs/constants.js.map +1 -1
- package/lib/commonjs/context.js +1 -2
- package/lib/commonjs/context.js.map +1 -1
- package/lib/commonjs/hooks.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/internal.js +1 -1
- package/lib/commonjs/internal.js.map +1 -1
- package/lib/commonjs/monkey-patch.android.js +2 -2
- package/lib/commonjs/monkey-patch.android.js.map +1 -1
- package/lib/commonjs/monkey-patch.js +2 -4
- package/lib/commonjs/monkey-patch.js.map +1 -1
- package/lib/commonjs/reanimated.js +3 -6
- package/lib/commonjs/reanimated.js.map +1 -1
- package/lib/commonjs/reanimated.native.js.map +1 -1
- package/lib/commonjs/specs/KeyboardControllerViewNativeComponent.js +1 -2
- package/lib/commonjs/specs/KeyboardControllerViewNativeComponent.js.map +1 -1
- package/lib/commonjs/specs/KeyboardGestureAreaNativeComponent.js +1 -2
- package/lib/commonjs/specs/KeyboardGestureAreaNativeComponent.js.map +1 -1
- package/lib/commonjs/specs/NativeKeyboardController.js +1 -2
- package/lib/commonjs/specs/NativeKeyboardController.js.map +1 -1
- package/lib/commonjs/specs/NativeStatusBarManagerCompat.js +1 -2
- package/lib/commonjs/specs/NativeStatusBarManagerCompat.js.map +1 -1
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/utils.js.map +1 -1
- package/lib/module/animated.js +12 -10
- package/lib/module/animated.js.map +1 -1
- package/lib/module/bindings.js.map +1 -1
- package/lib/module/bindings.native.js +3 -6
- package/lib/module/bindings.native.js.map +1 -1
- package/lib/module/components/KeyboardAvoidingView/hooks.js.map +1 -1
- package/lib/module/components/KeyboardAvoidingView/index.js +12 -13
- package/lib/module/components/KeyboardAvoidingView/index.js.map +1 -1
- package/lib/module/components/KeyboardAwareScrollView/index.js +10 -12
- package/lib/module/components/KeyboardAwareScrollView/index.js.map +1 -1
- package/lib/module/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js +7 -7
- package/lib/module/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js.map +1 -1
- package/lib/module/components/KeyboardAwareScrollView/utils.js +3 -4
- package/lib/module/components/KeyboardAwareScrollView/utils.js.map +1 -1
- package/lib/module/components/KeyboardStickyView/index.js +9 -10
- package/lib/module/components/KeyboardStickyView/index.js.map +1 -1
- package/lib/module/components/KeyboardToolbar/Arrow.js +5 -6
- package/lib/module/components/KeyboardToolbar/Arrow.js.map +1 -1
- package/lib/module/components/KeyboardToolbar/Button.js +20 -22
- package/lib/module/components/KeyboardToolbar/Button.js.map +1 -1
- package/lib/module/components/KeyboardToolbar/colors.js.map +1 -1
- package/lib/module/components/KeyboardToolbar/colors.native.js.map +1 -1
- package/lib/module/components/KeyboardToolbar/index.js +8 -9
- package/lib/module/components/KeyboardToolbar/index.js.map +1 -1
- package/lib/module/components/KeyboardToolbar/types.js.map +1 -1
- package/lib/module/components/hooks/useColorScheme.js.map +1 -1
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/constants.js +3 -3
- package/lib/module/constants.js.map +1 -1
- package/lib/module/context.js.map +1 -1
- package/lib/module/hooks.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/internal.js +1 -1
- package/lib/module/internal.js.map +1 -1
- package/lib/module/monkey-patch.android.js.map +1 -1
- package/lib/module/monkey-patch.js.map +1 -1
- package/lib/module/reanimated.js.map +1 -1
- package/lib/module/reanimated.native.js.map +1 -1
- package/lib/module/specs/KeyboardControllerViewNativeComponent.js.map +1 -1
- package/lib/module/specs/KeyboardGestureAreaNativeComponent.js.map +1 -1
- package/lib/module/specs/NativeKeyboardController.js.map +1 -1
- package/lib/module/specs/NativeStatusBarManagerCompat.js.map +1 -1
- package/lib/module/types.js.map +1 -1
- package/lib/module/utils.js.map +1 -1
- package/lib/typescript/animated.d.ts +1 -1
- package/lib/typescript/components/KeyboardToolbar/Button.d.ts +1 -1
- package/package.json +7 -7
- package/src/animated.tsx +7 -3
- package/src/components/KeyboardAvoidingView/index.tsx +1 -1
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
084AEEC62ACF49A8001A3069 /* FocusedInputLayoutChangedEvent.m in Sources */ = {isa = PBXBuildFile; fileRef = 084AEEC52ACF49A8001A3069 /* FocusedInputLayoutChangedEvent.m */; };
|
|
16
16
|
084AEEC82ACF4AB2001A3069 /* FocusedInputObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 084AEEC72ACF4AB2001A3069 /* FocusedInputObserver.swift */; };
|
|
17
17
|
089BA5DC2B3E0C9D000A9A90 /* ViewHierarchyNavigator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 089BA5DB2B3E0C9D000A9A90 /* ViewHierarchyNavigator.swift */; };
|
|
18
|
+
08C47AFC2BA9AF7100DB93BB /* KeyboardView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08C47AFB2BA9AF7100DB93BB /* KeyboardView.swift */; };
|
|
18
19
|
F333F8D428996B8D0015B05F /* KeyboardControllerView.mm in Sources */ = {isa = PBXBuildFile; fileRef = F333F8D228996B8D0015B05F /* KeyboardControllerView.mm */; };
|
|
19
20
|
F359D34F28133C26000B6AFE /* KeyboardControllerModule.mm in Sources */ = {isa = PBXBuildFile; fileRef = F359D34E28133C26000B6AFE /* KeyboardControllerModule.mm */; };
|
|
20
21
|
F3626A0728B3FE760021B2D9 /* KeyboardMovementObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3626A0628B3FE760021B2D9 /* KeyboardMovementObserver.swift */; };
|
|
@@ -45,6 +46,7 @@
|
|
|
45
46
|
084AEEC52ACF49A8001A3069 /* FocusedInputLayoutChangedEvent.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FocusedInputLayoutChangedEvent.m; sourceTree = "<group>"; };
|
|
46
47
|
084AEEC72ACF4AB2001A3069 /* FocusedInputObserver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FocusedInputObserver.swift; sourceTree = "<group>"; };
|
|
47
48
|
089BA5DB2B3E0C9D000A9A90 /* ViewHierarchyNavigator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewHierarchyNavigator.swift; sourceTree = "<group>"; };
|
|
49
|
+
08C47AFB2BA9AF7100DB93BB /* KeyboardView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyboardView.swift; sourceTree = "<group>"; };
|
|
48
50
|
134814201AA4EA6300B7C361 /* libKeyboardController.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libKeyboardController.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
|
49
51
|
B3E7B5891CC2AC0600A0062D /* KeyboardControllerViewManager.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = KeyboardControllerViewManager.mm; sourceTree = "<group>"; };
|
|
50
52
|
F333F8D128996B1C0015B05F /* KeyboardControllerView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KeyboardControllerView.h; sourceTree = "<group>"; };
|
|
@@ -109,6 +111,7 @@
|
|
|
109
111
|
089BA5DB2B3E0C9D000A9A90 /* ViewHierarchyNavigator.swift */,
|
|
110
112
|
0800511B2B65548600928E51 /* FocusedInputHolder.swift */,
|
|
111
113
|
0800511D2B65558800928E51 /* TextInput.swift */,
|
|
114
|
+
08C47AFB2BA9AF7100DB93BB /* KeyboardView.swift */,
|
|
112
115
|
);
|
|
113
116
|
path = traversal;
|
|
114
117
|
sourceTree = "<group>";
|
|
@@ -202,6 +205,7 @@
|
|
|
202
205
|
F4FF95D7245B92E800C19C63 /* KeyboardControllerViewManager.swift in Sources */,
|
|
203
206
|
F333F8D428996B8D0015B05F /* KeyboardControllerView.mm in Sources */,
|
|
204
207
|
0800511E2B65558800928E51 /* TextInput.swift in Sources */,
|
|
208
|
+
08C47AFC2BA9AF7100DB93BB /* KeyboardView.swift in Sources */,
|
|
205
209
|
F3F50669289E653B003091D6 /* KeyboardMoveEvent.m in Sources */,
|
|
206
210
|
083FB9852B15171600C0EFF0 /* TextChangeObserver.swift in Sources */,
|
|
207
211
|
089BA5DC2B3E0C9D000A9A90 /* ViewHierarchyNavigator.swift in Sources */,
|
|
@@ -20,7 +20,7 @@ public class KeyboardMovementObserver: NSObject {
|
|
|
20
20
|
let windowsCount = UIApplication.shared.windows.count
|
|
21
21
|
|
|
22
22
|
if _keyboardView == nil || windowsCount != _windowsCount {
|
|
23
|
-
_keyboardView =
|
|
23
|
+
_keyboardView = KeyboardView.find()
|
|
24
24
|
_windowsCount = windowsCount
|
|
25
25
|
}
|
|
26
26
|
|
|
@@ -252,30 +252,6 @@ public class KeyboardMovementObserver: NSObject {
|
|
|
252
252
|
displayLink = nil
|
|
253
253
|
}
|
|
254
254
|
|
|
255
|
-
// https://stackoverflow.com/questions/32598490/show-uiview-with-buttons-over-keyboard-like-in-skype-viber-messengers-swift-i
|
|
256
|
-
func findKeyboardView() -> UIView? {
|
|
257
|
-
var result: UIView?
|
|
258
|
-
|
|
259
|
-
let windows = UIApplication.shared.windows
|
|
260
|
-
for window in windows {
|
|
261
|
-
if window.description.hasPrefix("<UITextEffectsWindow") {
|
|
262
|
-
for subview in window.subviews {
|
|
263
|
-
if subview.description.hasPrefix("<UIInputSetContainerView") {
|
|
264
|
-
for hostView in subview.subviews {
|
|
265
|
-
if hostView.description.hasPrefix("<UIInputSetHostView") {
|
|
266
|
-
result = hostView
|
|
267
|
-
break
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
break
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
break
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
return result
|
|
277
|
-
}
|
|
278
|
-
|
|
279
255
|
@objc func updateKeyboardFrame() {
|
|
280
256
|
if keyboardView == nil {
|
|
281
257
|
return
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
//
|
|
2
|
+
// KeyboardView.swift
|
|
3
|
+
// KeyboardController
|
|
4
|
+
//
|
|
5
|
+
// Created by Kiryl Ziusko on 19/03/2024.
|
|
6
|
+
// Copyright © 2024 Facebook. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
import Foundation
|
|
10
|
+
import UIKit
|
|
11
|
+
|
|
12
|
+
enum KeyboardView {
|
|
13
|
+
// https://stackoverflow.com/questions/32598490/show-uiview-with-buttons-over-keyboard-like-in-skype-viber-messengers-swift-i
|
|
14
|
+
static func find() -> UIView? {
|
|
15
|
+
var result: UIView?
|
|
16
|
+
|
|
17
|
+
let windows = UIApplication.shared.windows
|
|
18
|
+
for window in windows {
|
|
19
|
+
if window.description.hasPrefix("<UITextEffectsWindow") {
|
|
20
|
+
for subview in window.subviews {
|
|
21
|
+
if subview.description.hasPrefix("<UIInputSetContainerView") {
|
|
22
|
+
for hostView in subview.subviews {
|
|
23
|
+
if hostView.description.hasPrefix("<UIInputSetHostView") {
|
|
24
|
+
result = hostView
|
|
25
|
+
break
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
break
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
break
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return result
|
|
35
|
+
}
|
|
36
|
+
}
|
package/lib/commonjs/animated.js
CHANGED
|
@@ -12,8 +12,8 @@ var _context = require("./context");
|
|
|
12
12
|
var _internal = require("./internal");
|
|
13
13
|
var _monkeyPatch = require("./monkey-patch");
|
|
14
14
|
var _reanimated = require("./reanimated");
|
|
15
|
-
function _getRequireWildcardCache(
|
|
16
|
-
function _interopRequireWildcard(
|
|
15
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
16
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
17
17
|
const KeyboardControllerViewAnimated = _reactNativeReanimated.default.createAnimatedComponent(_reactNative.Animated.createAnimatedComponent(_bindings.KeyboardControllerView));
|
|
18
18
|
const styles = _reactNative.StyleSheet.create({
|
|
19
19
|
container: {
|
|
@@ -24,13 +24,15 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
24
24
|
position: "absolute"
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
// capture `Platform.OS` in separate variable to avoid deep workletization of entire RN package
|
|
28
|
+
// 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
|
|
29
|
+
const OS = _reactNative.Platform.OS;
|
|
30
|
+
const KeyboardProvider = ({
|
|
31
|
+
children,
|
|
32
|
+
statusBarTranslucent,
|
|
33
|
+
navigationBarTranslucent,
|
|
34
|
+
enabled: initiallyEnabled = true
|
|
35
|
+
}) => {
|
|
34
36
|
// state
|
|
35
37
|
const [enabled, setEnabled] = (0, _react.useState)(initiallyEnabled);
|
|
36
38
|
// animated values
|
|
@@ -77,7 +79,7 @@ const KeyboardProvider = _ref => {
|
|
|
77
79
|
const updateSharedValues = (event, platforms) => {
|
|
78
80
|
"worklet";
|
|
79
81
|
|
|
80
|
-
if (platforms.includes(
|
|
82
|
+
if (platforms.includes(OS)) {
|
|
81
83
|
progressSV.value = event.progress;
|
|
82
84
|
heightSV.value = -event.height;
|
|
83
85
|
}
|
|
@@ -138,8 +140,8 @@ const KeyboardProvider = _ref => {
|
|
|
138
140
|
}, /*#__PURE__*/_react.default.createElement(KeyboardControllerViewAnimated, {
|
|
139
141
|
enabled: enabled,
|
|
140
142
|
onKeyboardMoveReanimated: keyboardHandler,
|
|
141
|
-
onKeyboardMoveStart:
|
|
142
|
-
onKeyboardMove:
|
|
143
|
+
onKeyboardMoveStart: OS === "ios" ? onKeyboardMove : undefined,
|
|
144
|
+
onKeyboardMove: OS === "android" ? onKeyboardMove : undefined,
|
|
143
145
|
onKeyboardMoveInteractive: onKeyboardMove,
|
|
144
146
|
onFocusedInputLayoutChangedReanimated: inputLayoutHandler,
|
|
145
147
|
onFocusedInputTextChangedReanimated: inputTextHandler,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeReanimated","_bindings","_context","_internal","_monkeyPatch","_reanimated","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","KeyboardControllerViewAnimated","Reanimated","createAnimatedComponent","Animated","KeyboardControllerView","styles","StyleSheet","create","container","flex","hidden","display","position","KeyboardProvider","_ref","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","Platform","OS","value","keyboardHandler","useAnimatedKeyboardHandler","onKeyboardMoveStart","onKeyboardMoveEnd","onKeyboardMoveInteractive","inputLayoutHandler","useFocusedInputLayoutHandler","onFocusedInputLayoutChanged","e","target","inputTextHandler","useFocusedInputTextHandler","onFocusedInputTextChanged","useEffect","applyMonkeyPatch","revertMonkeyPatch","createElement","KeyboardContext","Provider","onKeyboardMoveReanimated","undefined","onFocusedInputLayoutChangedReanimated","onFocusedInputTextChangedReanimated","View","exports"],"sources":["animated.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useState } from \"react\";\nimport { Animated, Platform, StyleSheet } from \"react-native\";\nimport Reanimated, { useSharedValue } from \"react-native-reanimated\";\n\nimport { KeyboardControllerView } from \"./bindings\";\nimport { KeyboardContext } from \"./context\";\nimport { useAnimatedValue, useSharedHandlers } from \"./internal\";\nimport { applyMonkeyPatch, revertMonkeyPatch } from \"./monkey-patch\";\nimport {\n useAnimatedKeyboardHandler,\n useFocusedInputLayoutHandler,\n useFocusedInputTextHandler,\n} from \"./reanimated\";\n\nimport type { KeyboardAnimationContext } from \"./context\";\nimport type {\n FocusedInputHandler,\n FocusedInputLayoutChangedEvent,\n KeyboardControllerProps,\n KeyboardHandler,\n NativeEvent,\n} from \"./types\";\nimport type { ViewStyle } from \"react-native\";\n\nconst KeyboardControllerViewAnimated = Reanimated.createAnimatedComponent(\n Animated.createAnimatedComponent(\n KeyboardControllerView,\n ) as React.FC<KeyboardControllerProps>,\n);\n\ntype Styles = {\n container: ViewStyle;\n hidden: ViewStyle;\n};\n\nconst styles = StyleSheet.create<Styles>({\n container: {\n flex: 1,\n },\n hidden: {\n display: \"none\",\n position: \"absolute\",\n },\n});\n\ntype KeyboardProviderProps = {\n children: React.ReactNode;\n /**\n * Set the value to `true`, if you use translucent status bar on Android.\n * If you already control status bar translucency via `react-native-screens`\n * or `StatusBar` component from `react-native`, you can ignore it.\n * Defaults to `false`.\n *\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/14\n * @platform android\n */\n statusBarTranslucent?: boolean;\n /**\n * Set the value to `true`, if you use translucent navigation bar on Android.\n * Defaults to `false`.\n *\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/119\n * @platform android\n */\n navigationBarTranslucent?: boolean;\n /**\n * A boolean prop indicating whether the module is enabled. It indicate only initial state,\n * i. e. if you try to change this prop after component mount it will not have any effect.\n * To change the property in runtime use `useKeyboardController` hook and `setEnabled` method.\n * Defaults to `true`.\n */\n enabled?: boolean;\n};\n\nexport const KeyboardProvider = ({\n children,\n statusBarTranslucent,\n navigationBarTranslucent,\n enabled: initiallyEnabled = true,\n}: KeyboardProviderProps) => {\n // state\n const [enabled, setEnabled] = useState(initiallyEnabled);\n // animated values\n const progress = useAnimatedValue(0);\n const height = useAnimatedValue(0);\n // shared values\n const progressSV = useSharedValue(0);\n const heightSV = useSharedValue(0);\n const layout = useSharedValue<FocusedInputLayoutChangedEvent | null>(null);\n const [setKeyboardHandlers, broadcastKeyboardEvents] =\n useSharedHandlers<KeyboardHandler>();\n const [setInputHandlers, broadcastInputEvents] =\n useSharedHandlers<FocusedInputHandler>();\n // memo\n const context = useMemo<KeyboardAnimationContext>(\n () => ({\n enabled,\n animated: { progress: progress, height: Animated.multiply(height, -1) },\n reanimated: { progress: progressSV, height: heightSV },\n layout,\n setKeyboardHandlers,\n setInputHandlers,\n setEnabled,\n }),\n [enabled],\n );\n const style = useMemo(\n () => [\n styles.hidden,\n { transform: [{ translateX: height }, { translateY: progress }] },\n ],\n [],\n );\n const onKeyboardMove = useMemo(\n () =>\n Animated.event(\n [\n {\n nativeEvent: {\n progress,\n height,\n },\n },\n ],\n { useNativeDriver: true },\n ),\n [],\n );\n // handlers\n const updateSharedValues = (event: NativeEvent, platforms: string[]) => {\n \"worklet\";\n\n if (platforms.includes(Platform.OS)) {\n progressSV.value = event.progress;\n heightSV.value = -event.height;\n }\n };\n const keyboardHandler = useAnimatedKeyboardHandler(\n {\n onKeyboardMoveStart: (event: NativeEvent) => {\n \"worklet\";\n\n broadcastKeyboardEvents(\"onStart\", event);\n updateSharedValues(event, [\"ios\"]);\n },\n onKeyboardMove: (event: NativeEvent) => {\n \"worklet\";\n\n broadcastKeyboardEvents(\"onMove\", event);\n updateSharedValues(event, [\"android\"]);\n },\n onKeyboardMoveEnd: (event: NativeEvent) => {\n \"worklet\";\n\n broadcastKeyboardEvents(\"onEnd\", event);\n },\n onKeyboardMoveInteractive: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"android\", \"ios\"]);\n broadcastKeyboardEvents(\"onInteractive\", event);\n },\n },\n [],\n );\n const inputLayoutHandler = useFocusedInputLayoutHandler(\n {\n onFocusedInputLayoutChanged: (e) => {\n \"worklet\";\n\n if (e.target !== -1) {\n layout.value = e;\n } else {\n layout.value = null;\n }\n },\n },\n [],\n );\n const inputTextHandler = useFocusedInputTextHandler(\n {\n onFocusedInputTextChanged: (e) => {\n \"worklet\";\n\n broadcastInputEvents(\"onChangeText\", e);\n },\n },\n [],\n );\n // effects\n useEffect(() => {\n if (enabled) {\n applyMonkeyPatch();\n } else {\n revertMonkeyPatch();\n }\n }, [enabled]);\n\n return (\n <KeyboardContext.Provider value={context}>\n <KeyboardControllerViewAnimated\n enabled={enabled}\n onKeyboardMoveReanimated={keyboardHandler}\n onKeyboardMoveStart={Platform.OS === \"ios\" ? onKeyboardMove : undefined}\n onKeyboardMove={Platform.OS === \"android\" ? onKeyboardMove : undefined}\n onKeyboardMoveInteractive={onKeyboardMove}\n onFocusedInputLayoutChangedReanimated={inputLayoutHandler}\n onFocusedInputTextChangedReanimated={inputTextHandler}\n navigationBarTranslucent={navigationBarTranslucent}\n statusBarTranslucent={statusBarTranslucent}\n style={styles.container}\n >\n {children}\n </KeyboardControllerViewAnimated>\n <Animated.View\n // we are using this small hack, because if the component (where\n // animated value has been used) is unmounted, then animation will\n // stop receiving events (seems like it's react-native optimization).\n // So we need to keep a reference to the animated value, to keep it's\n // always mounted (keep a reference to an animated value).\n //\n // To test why it's needed, try to open screen which consumes Animated.Value\n // then close it and open it again (for example 'Animated transition').\n style={style}\n />\n </KeyboardContext.Provider>\n );\n};\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;AAIsB,SAAAQ,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAV,wBAAAc,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,SAAAM,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAX,GAAA,QAAAW,GAAA,kBAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAd,GAAA,EAAAW,GAAA,SAAAI,IAAA,GAAAR,qBAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAV,GAAA,EAAAW,GAAA,cAAAI,IAAA,KAAAA,IAAA,CAAAV,GAAA,IAAAU,IAAA,CA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,CAAAiB,OAAA,CAAAoF,aAAA,CAAC/F,QAAA,CAAAgG,eAAe,CAACC,QAAQ;IAACnB,KAAK,EAAElB;EAAQ,gBACvClE,MAAA,CAAAiB,OAAA,CAAAoF,aAAA,CAACrE,8BAA8B;IAC7BkB,OAAO,EAAEA,OAAQ;IACjBsD,wBAAwB,EAAEnB,eAAgB;IAC1CE,mBAAmB,EAAEL,qBAAQ,CAACC,EAAE,KAAK,KAAK,GAAGR,cAAc,GAAG8B,SAAU;IACxE9B,cAAc,EAAEO,qBAAQ,CAACC,EAAE,KAAK,SAAS,GAAGR,cAAc,GAAG8B,SAAU;IACvEhB,yBAAyB,EAAEd,cAAe;IAC1C+B,qCAAqC,EAAEhB,kBAAmB;IAC1DiB,mCAAmC,EAAEZ,gBAAiB;IACtD9C,wBAAwB,EAAEA,wBAAyB;IACnDD,oBAAoB,EAAEA,oBAAqB;IAC3CuB,KAAK,EAAElC,MAAM,CAACG;EAAU,GAEvBO,QAC6B,CAAC,eACjC/C,MAAA,CAAAiB,OAAA,CAAAoF,aAAA,CAAClG,YAAA,CAAAgC,QAAQ,CAACyE,IAAI;IACZ;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACArC,KAAK,EAAEA;EAAM,CACd,CACuB,CAAC;AAE/B,CAAC;AAACsC,OAAA,CAAAhE,gBAAA,GAAAA,gBAAA"}
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeReanimated","_bindings","_context","_internal","_monkeyPatch","_reanimated","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","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","value","keyboardHandler","useAnimatedKeyboardHandler","onKeyboardMoveStart","onKeyboardMoveEnd","onKeyboardMoveInteractive","inputLayoutHandler","useFocusedInputLayoutHandler","onFocusedInputLayoutChanged","target","inputTextHandler","useFocusedInputTextHandler","onFocusedInputTextChanged","useEffect","applyMonkeyPatch","revertMonkeyPatch","createElement","KeyboardContext","Provider","onKeyboardMoveReanimated","undefined","onFocusedInputLayoutChangedReanimated","onFocusedInputTextChangedReanimated","View","exports"],"sources":["animated.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useState } from \"react\";\nimport { Animated, Platform, StyleSheet } from \"react-native\";\nimport Reanimated, { useSharedValue } from \"react-native-reanimated\";\n\nimport { KeyboardControllerView } from \"./bindings\";\nimport { KeyboardContext } from \"./context\";\nimport { useAnimatedValue, useSharedHandlers } from \"./internal\";\nimport { applyMonkeyPatch, revertMonkeyPatch } from \"./monkey-patch\";\nimport {\n useAnimatedKeyboardHandler,\n useFocusedInputLayoutHandler,\n useFocusedInputTextHandler,\n} from \"./reanimated\";\n\nimport type { KeyboardAnimationContext } from \"./context\";\nimport type {\n FocusedInputHandler,\n FocusedInputLayoutChangedEvent,\n KeyboardControllerProps,\n KeyboardHandler,\n NativeEvent,\n} from \"./types\";\nimport type { ViewStyle } from \"react-native\";\n\nconst KeyboardControllerViewAnimated = Reanimated.createAnimatedComponent(\n Animated.createAnimatedComponent(\n KeyboardControllerView,\n ) as React.FC<KeyboardControllerProps>,\n);\n\ntype Styles = {\n container: ViewStyle;\n hidden: ViewStyle;\n};\n\nconst styles = StyleSheet.create<Styles>({\n container: {\n flex: 1,\n },\n hidden: {\n display: \"none\",\n position: \"absolute\",\n },\n});\n\ntype KeyboardProviderProps = {\n children: React.ReactNode;\n /**\n * Set the value to `true`, if you use translucent status bar on Android.\n * If you already control status bar translucency via `react-native-screens`\n * or `StatusBar` component from `react-native`, you can ignore it.\n * Defaults to `false`.\n *\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/14\n * @platform android\n */\n statusBarTranslucent?: boolean;\n /**\n * Set the value to `true`, if you use translucent navigation bar on Android.\n * Defaults to `false`.\n *\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/119\n * @platform android\n */\n navigationBarTranslucent?: boolean;\n /**\n * A boolean prop indicating whether the module is enabled. It indicate only initial state,\n * i. e. if you try to change this prop after component mount it will not have any effect.\n * To change the property in runtime use `useKeyboardController` hook and `setEnabled` method.\n * Defaults to `true`.\n */\n enabled?: boolean;\n};\n\n// capture `Platform.OS` in separate variable to avoid deep workletization of entire RN package\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\nconst OS = Platform.OS;\n\nexport const KeyboardProvider = ({\n children,\n statusBarTranslucent,\n navigationBarTranslucent,\n enabled: initiallyEnabled = true,\n}: KeyboardProviderProps) => {\n // state\n const [enabled, setEnabled] = useState(initiallyEnabled);\n // animated values\n const progress = useAnimatedValue(0);\n const height = useAnimatedValue(0);\n // shared values\n const progressSV = useSharedValue(0);\n const heightSV = useSharedValue(0);\n const layout = useSharedValue<FocusedInputLayoutChangedEvent | null>(null);\n const [setKeyboardHandlers, broadcastKeyboardEvents] =\n useSharedHandlers<KeyboardHandler>();\n const [setInputHandlers, broadcastInputEvents] =\n useSharedHandlers<FocusedInputHandler>();\n // memo\n const context = useMemo<KeyboardAnimationContext>(\n () => ({\n enabled,\n animated: { progress: progress, height: Animated.multiply(height, -1) },\n reanimated: { progress: progressSV, height: heightSV },\n layout,\n setKeyboardHandlers,\n setInputHandlers,\n setEnabled,\n }),\n [enabled],\n );\n const style = useMemo(\n () => [\n styles.hidden,\n { transform: [{ translateX: height }, { translateY: progress }] },\n ],\n [],\n );\n const onKeyboardMove = useMemo(\n () =>\n Animated.event(\n [\n {\n nativeEvent: {\n progress,\n height,\n },\n },\n ],\n { useNativeDriver: true },\n ),\n [],\n );\n // handlers\n const updateSharedValues = (event: NativeEvent, platforms: string[]) => {\n \"worklet\";\n\n if (platforms.includes(OS)) {\n progressSV.value = event.progress;\n heightSV.value = -event.height;\n }\n };\n const keyboardHandler = useAnimatedKeyboardHandler(\n {\n onKeyboardMoveStart: (event: NativeEvent) => {\n \"worklet\";\n\n broadcastKeyboardEvents(\"onStart\", event);\n updateSharedValues(event, [\"ios\"]);\n },\n onKeyboardMove: (event: NativeEvent) => {\n \"worklet\";\n\n broadcastKeyboardEvents(\"onMove\", event);\n updateSharedValues(event, [\"android\"]);\n },\n onKeyboardMoveEnd: (event: NativeEvent) => {\n \"worklet\";\n\n broadcastKeyboardEvents(\"onEnd\", event);\n },\n onKeyboardMoveInteractive: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"android\", \"ios\"]);\n broadcastKeyboardEvents(\"onInteractive\", event);\n },\n },\n [],\n );\n const inputLayoutHandler = useFocusedInputLayoutHandler(\n {\n onFocusedInputLayoutChanged: (e) => {\n \"worklet\";\n\n if (e.target !== -1) {\n layout.value = e;\n } else {\n layout.value = null;\n }\n },\n },\n [],\n );\n const inputTextHandler = useFocusedInputTextHandler(\n {\n onFocusedInputTextChanged: (e) => {\n \"worklet\";\n\n broadcastInputEvents(\"onChangeText\", e);\n },\n },\n [],\n );\n // effects\n useEffect(() => {\n if (enabled) {\n applyMonkeyPatch();\n } else {\n revertMonkeyPatch();\n }\n }, [enabled]);\n\n return (\n <KeyboardContext.Provider value={context}>\n <KeyboardControllerViewAnimated\n enabled={enabled}\n onKeyboardMoveReanimated={keyboardHandler}\n onKeyboardMoveStart={OS === \"ios\" ? onKeyboardMove : undefined}\n onKeyboardMove={OS === \"android\" ? onKeyboardMove : undefined}\n onKeyboardMoveInteractive={onKeyboardMove}\n onFocusedInputLayoutChangedReanimated={inputLayoutHandler}\n onFocusedInputTextChangedReanimated={inputTextHandler}\n navigationBarTranslucent={navigationBarTranslucent}\n statusBarTranslucent={statusBarTranslucent}\n style={styles.container}\n >\n {children}\n </KeyboardControllerViewAnimated>\n <Animated.View\n // we are using this small hack, because if the component (where\n // animated value has been used) is unmounted, then animation will\n // stop receiving events (seems like it's react-native optimization).\n // So we need to keep a reference to the animated value, to keep it's\n // always mounted (keep a reference to an animated value).\n //\n // To test why it's needed, try to open screen which consumes Animated.Value\n // then close it and open it again (for example 'Animated transition').\n style={style}\n />\n </KeyboardContext.Provider>\n );\n};\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;AAIsB,SAAAQ,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAV,wBAAAU,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cA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
6
|
exports.KeyboardGestureArea = exports.KeyboardEvents = exports.KeyboardControllerView = exports.KeyboardController = exports.FocusedInputEvents = void 0;
|
|
7
7
|
var _reactNative = require("react-native");
|
|
8
8
|
const NOOP = () => {};
|
|
9
|
-
const KeyboardController = {
|
|
9
|
+
const KeyboardController = exports.KeyboardController = {
|
|
10
10
|
setDefaultMode: NOOP,
|
|
11
11
|
setInputMode: NOOP,
|
|
12
12
|
dismiss: NOOP,
|
|
@@ -14,8 +14,7 @@ const KeyboardController = {
|
|
|
14
14
|
addListener: NOOP,
|
|
15
15
|
removeListeners: NOOP
|
|
16
16
|
};
|
|
17
|
-
exports.
|
|
18
|
-
const KeyboardEvents = {
|
|
17
|
+
const KeyboardEvents = exports.KeyboardEvents = {
|
|
19
18
|
addListener: () => ({
|
|
20
19
|
remove: NOOP
|
|
21
20
|
})
|
|
@@ -24,15 +23,11 @@ const KeyboardEvents = {
|
|
|
24
23
|
* This API is not documented, it's for internal usage only (for now), and is a subject to potential breaking changes in future.
|
|
25
24
|
* Use it with cautious.
|
|
26
25
|
*/
|
|
27
|
-
exports.
|
|
28
|
-
const FocusedInputEvents = {
|
|
26
|
+
const FocusedInputEvents = exports.FocusedInputEvents = {
|
|
29
27
|
addListener: () => ({
|
|
30
28
|
remove: NOOP
|
|
31
29
|
})
|
|
32
30
|
};
|
|
33
|
-
exports.
|
|
34
|
-
const
|
|
35
|
-
exports.KeyboardControllerView = KeyboardControllerView;
|
|
36
|
-
const KeyboardGestureArea = _reactNative.View;
|
|
37
|
-
exports.KeyboardGestureArea = KeyboardGestureArea;
|
|
31
|
+
const KeyboardControllerView = exports.KeyboardControllerView = _reactNative.View;
|
|
32
|
+
const KeyboardGestureArea = exports.KeyboardGestureArea = _reactNative.View;
|
|
38
33
|
//# sourceMappingURL=bindings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","NOOP","KeyboardController","setDefaultMode","setInputMode","dismiss","setFocusTo","addListener","removeListeners","
|
|
1
|
+
{"version":3,"names":["_reactNative","require","NOOP","KeyboardController","exports","setDefaultMode","setInputMode","dismiss","setFocusTo","addListener","removeListeners","KeyboardEvents","remove","FocusedInputEvents","KeyboardControllerView","View","KeyboardGestureArea"],"sources":["bindings.ts"],"sourcesContent":["import { View } from \"react-native\";\n\nimport type {\n FocusedInputEventsModule,\n KeyboardControllerModule,\n KeyboardControllerProps,\n KeyboardEventsModule,\n KeyboardGestureAreaProps,\n} from \"./types\";\nimport type { EmitterSubscription } from \"react-native\";\n\nconst NOOP = () => {};\nexport const KeyboardController: KeyboardControllerModule = {\n setDefaultMode: NOOP,\n setInputMode: NOOP,\n dismiss: NOOP,\n setFocusTo: NOOP,\n addListener: NOOP,\n removeListeners: NOOP,\n};\nexport const KeyboardEvents: KeyboardEventsModule = {\n addListener: () => ({ remove: NOOP } as EmitterSubscription),\n};\n/**\n * This API is not documented, it's for internal usage only (for now), and is a subject to potential breaking changes in future.\n * Use it with cautious.\n */\nexport const FocusedInputEvents: FocusedInputEventsModule = {\n addListener: () => ({ remove: NOOP } as EmitterSubscription),\n};\nexport const KeyboardControllerView =\n View as unknown as React.FC<KeyboardControllerProps>;\nexport const KeyboardGestureArea =\n View as unknown as React.FC<KeyboardGestureAreaProps>;\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAWA,MAAMC,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AACd,MAAMC,kBAA4C,GAAAC,OAAA,CAAAD,kBAAA,GAAG;EAC1DE,cAAc,EAAEH,IAAI;EACpBI,YAAY,EAAEJ,IAAI;EAClBK,OAAO,EAAEL,IAAI;EACbM,UAAU,EAAEN,IAAI;EAChBO,WAAW,EAAEP,IAAI;EACjBQ,eAAe,EAAER;AACnB,CAAC;AACM,MAAMS,cAAoC,GAAAP,OAAA,CAAAO,cAAA,GAAG;EAClDF,WAAW,EAAEA,CAAA,MAAO;IAAEG,MAAM,EAAEV;EAAK,CAAC;AACtC,CAAC;AACD;AACA;AACA;AACA;AACO,MAAMW,kBAA4C,GAAAT,OAAA,CAAAS,kBAAA,GAAG;EAC1DJ,WAAW,EAAEA,CAAA,MAAO;IAAEG,MAAM,EAAEV;EAAK,CAAC;AACtC,CAAC;AACM,MAAMY,sBAAsB,GAAAV,OAAA,CAAAU,sBAAA,GACjCC,iBAAoD;AAC/C,MAAMC,mBAAmB,GAAAZ,OAAA,CAAAY,mBAAA,GAC9BD,iBAAqD","ignoreList":[]}
|
|
@@ -10,33 +10,25 @@ const LINKING_ERROR = `The package 'react-native-keyboard-controller' doesn't se
|
|
|
10
10
|
default: ""
|
|
11
11
|
}) + "- You rebuilt the app after installing the package\n" + "- You are not using Expo Go\n";
|
|
12
12
|
const RCTKeyboardController = require("./specs/NativeKeyboardController").default;
|
|
13
|
-
const KeyboardController = RCTKeyboardController ? RCTKeyboardController : new Proxy({}, {
|
|
13
|
+
const KeyboardController = exports.KeyboardController = RCTKeyboardController ? RCTKeyboardController : new Proxy({}, {
|
|
14
14
|
get() {
|
|
15
15
|
throw new Error(LINKING_ERROR);
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
-
exports.KeyboardController = KeyboardController;
|
|
19
18
|
const KEYBOARD_CONTROLLER_NAMESPACE = "KeyboardController::";
|
|
20
19
|
const eventEmitter = new _reactNative.NativeEventEmitter(KeyboardController);
|
|
21
|
-
const KeyboardEvents = {
|
|
20
|
+
const KeyboardEvents = exports.KeyboardEvents = {
|
|
22
21
|
addListener: (name, cb) => eventEmitter.addListener(KEYBOARD_CONTROLLER_NAMESPACE + name, cb)
|
|
23
22
|
};
|
|
24
23
|
/**
|
|
25
24
|
* This API is not documented, it's for internal usage only (for now), and is a subject to potential breaking changes in future.
|
|
26
25
|
* Use it with cautious.
|
|
27
26
|
*/
|
|
28
|
-
exports.
|
|
29
|
-
const FocusedInputEvents = {
|
|
27
|
+
const FocusedInputEvents = exports.FocusedInputEvents = {
|
|
30
28
|
addListener: (name, cb) => eventEmitter.addListener(KEYBOARD_CONTROLLER_NAMESPACE + name, cb)
|
|
31
29
|
};
|
|
32
|
-
exports.
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
let {
|
|
37
|
-
children
|
|
38
|
-
} = _ref;
|
|
39
|
-
return children;
|
|
40
|
-
};
|
|
41
|
-
exports.KeyboardGestureArea = KeyboardGestureArea;
|
|
30
|
+
const KeyboardControllerView = exports.KeyboardControllerView = require("./specs/KeyboardControllerViewNativeComponent").default;
|
|
31
|
+
const KeyboardGestureArea = exports.KeyboardGestureArea = _reactNative.Platform.OS === "android" && _reactNative.Platform.Version >= 30 ? require("./specs/KeyboardGestureAreaNativeComponent").default : ({
|
|
32
|
+
children
|
|
33
|
+
}) => children;
|
|
42
34
|
//# sourceMappingURL=bindings.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","LINKING_ERROR","Platform","select","ios","default","RCTKeyboardController","KeyboardController","Proxy","get","Error","
|
|
1
|
+
{"version":3,"names":["_reactNative","require","LINKING_ERROR","Platform","select","ios","default","RCTKeyboardController","KeyboardController","exports","Proxy","get","Error","KEYBOARD_CONTROLLER_NAMESPACE","eventEmitter","NativeEventEmitter","KeyboardEvents","addListener","name","cb","FocusedInputEvents","KeyboardControllerView","KeyboardGestureArea","OS","Version","children"],"sources":["bindings.native.ts"],"sourcesContent":["import { NativeEventEmitter, Platform } from \"react-native\";\n\nimport type {\n FocusedInputEventsModule,\n KeyboardControllerModule,\n KeyboardControllerProps,\n KeyboardEventsModule,\n KeyboardGestureAreaProps,\n} from \"./types\";\n\nconst LINKING_ERROR =\n `The package 'react-native-keyboard-controller' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: \"\" }) +\n \"- You rebuilt the app after installing the package\\n\" +\n \"- You are not using Expo Go\\n\";\n\nconst RCTKeyboardController =\n require(\"./specs/NativeKeyboardController\").default;\nexport const KeyboardController = (\n RCTKeyboardController\n ? RCTKeyboardController\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n },\n )\n) as KeyboardControllerModule;\n\nconst KEYBOARD_CONTROLLER_NAMESPACE = \"KeyboardController::\";\nconst eventEmitter = new NativeEventEmitter(KeyboardController);\n\nexport const KeyboardEvents: KeyboardEventsModule = {\n addListener: (name, cb) =>\n eventEmitter.addListener(KEYBOARD_CONTROLLER_NAMESPACE + name, cb),\n};\n/**\n * This API is not documented, it's for internal usage only (for now), and is a subject to potential breaking changes in future.\n * Use it with cautious.\n */\nexport const FocusedInputEvents: FocusedInputEventsModule = {\n addListener: (name, cb) =>\n eventEmitter.addListener(KEYBOARD_CONTROLLER_NAMESPACE + name, cb),\n};\nexport const KeyboardControllerView: React.FC<KeyboardControllerProps> =\n require(\"./specs/KeyboardControllerViewNativeComponent\").default;\nexport const KeyboardGestureArea: React.FC<KeyboardGestureAreaProps> =\n Platform.OS === \"android\" && Platform.Version >= 30\n ? require(\"./specs/KeyboardGestureAreaNativeComponent\").default\n : ({ children }: KeyboardGestureAreaProps) => children;\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAUA,MAAMC,aAAa,GAChB,2FAA0F,GAC3FC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,qBAAqB,GACzBN,OAAO,CAAC,kCAAkC,CAAC,CAACK,OAAO;AAC9C,MAAME,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAC7BD,qBAAqB,GACjBA,qBAAqB,GACrB,IAAIG,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACV,aAAa,CAAC;EAChC;AACF,CACF,CACuB;AAE7B,MAAMW,6BAA6B,GAAG,sBAAsB;AAC5D,MAAMC,YAAY,GAAG,IAAIC,+BAAkB,CAACP,kBAAkB,CAAC;AAExD,MAAMQ,cAAoC,GAAAP,OAAA,CAAAO,cAAA,GAAG;EAClDC,WAAW,EAAEA,CAACC,IAAI,EAAEC,EAAE,KACpBL,YAAY,CAACG,WAAW,CAACJ,6BAA6B,GAAGK,IAAI,EAAEC,EAAE;AACrE,CAAC;AACD;AACA;AACA;AACA;AACO,MAAMC,kBAA4C,GAAAX,OAAA,CAAAW,kBAAA,GAAG;EAC1DH,WAAW,EAAEA,CAACC,IAAI,EAAEC,EAAE,KACpBL,YAAY,CAACG,WAAW,CAACJ,6BAA6B,GAAGK,IAAI,EAAEC,EAAE;AACrE,CAAC;AACM,MAAME,sBAAyD,GAAAZ,OAAA,CAAAY,sBAAA,GACpEpB,OAAO,CAAC,+CAA+C,CAAC,CAACK,OAAO;AAC3D,MAAMgB,mBAAuD,GAAAb,OAAA,CAAAa,mBAAA,GAClEnB,qBAAQ,CAACoB,EAAE,KAAK,SAAS,IAAIpB,qBAAQ,CAACqB,OAAO,IAAI,EAAE,GAC/CvB,OAAO,CAAC,4CAA4C,CAAC,CAACK,OAAO,GAC7D,CAAC;EAAEmB;AAAmC,CAAC,KAAKA,QAAQ","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNativeReanimated","require","_reactNativeKeyboardController","useKeyboardAnimation","heightWhenOpened","useSharedValue","height","progress","isClosed","useKeyboardHandler","onStart","e","value","onMove","onEnd","duration","exports"],"sources":["hooks.ts"],"sourcesContent":["import { useSharedValue } from \"react-native-reanimated\";\n\nimport { useKeyboardHandler } from \"react-native-keyboard-controller\";\n\nexport const useKeyboardAnimation = () => {\n const heightWhenOpened = useSharedValue(0);\n const height = useSharedValue(0);\n const progress = useSharedValue(0);\n const isClosed = useSharedValue(true);\n\n useKeyboardHandler(\n {\n onStart: (e) => {\n \"worklet\";\n\n if (e.height > 0) {\n isClosed.value = false;\n heightWhenOpened.value = e.height;\n }\n },\n onMove: (e) => {\n \"worklet\";\n\n progress.value = e.progress;\n height.value = e.height;\n },\n onEnd: (e) => {\n \"worklet\";\n\n isClosed.value = e.height === 0;\n\n // `height` update happens in `onMove` handler\n // in `onEnd` we need to update only if `onMove`\n // wasn't called (i. e. duration === 0)\n //\n // we can not call this code without condition below\n // because in some corner cases (iOS with `secureTextEntry`)\n // `onEnd` can be emitted before `onMove` and in this case\n // it may lead to choppy/glitchy/jumpy UI\n // see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/327\n if (e.duration === 0) {\n progress.value = e.progress;\n height.value = e.height;\n }\n },\n },\n [],\n );\n\n return { height, progress, heightWhenOpened, isClosed };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,sBAAA,GAAAC,OAAA;AAEA,IAAAC,8BAAA,GAAAD,OAAA;AAEO,MAAME,oBAAoB,GAAGA,CAAA,KAAM;EACxC,MAAMC,gBAAgB,GAAG,IAAAC,qCAAc,EAAC,CAAC,CAAC;EAC1C,MAAMC,MAAM,GAAG,IAAAD,qCAAc,EAAC,CAAC,CAAC;EAChC,MAAME,QAAQ,GAAG,IAAAF,qCAAc,EAAC,CAAC,CAAC;EAClC,MAAMG,QAAQ,GAAG,IAAAH,qCAAc,EAAC,IAAI,CAAC;EAErC,IAAAI,iDAAkB,EAChB;IACEC,OAAO,EAAGC,CAAC,IAAK;MACd,SAAS;;MAET,IAAIA,CAAC,CAACL,MAAM,GAAG,CAAC,EAAE;QAChBE,QAAQ,CAACI,KAAK,GAAG,KAAK;QACtBR,gBAAgB,CAACQ,KAAK,GAAGD,CAAC,CAACL,MAAM;MACnC;IACF,CAAC;IACDO,MAAM,EAAGF,CAAC,IAAK;MACb,SAAS;;MAETJ,QAAQ,CAACK,KAAK,GAAGD,CAAC,CAACJ,QAAQ;MAC3BD,MAAM,CAACM,KAAK,GAAGD,CAAC,CAACL,MAAM;IACzB,CAAC;IACDQ,KAAK,EAAGH,CAAC,IAAK;MACZ,SAAS;;MAETH,QAAQ,CAACI,KAAK,GAAGD,CAAC,CAACL,MAAM,KAAK,CAAC;;MAE/B;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA,IAAIK,CAAC,CAACI,QAAQ,KAAK,CAAC,EAAE;QACpBR,QAAQ,CAACK,KAAK,GAAGD,CAAC,CAACJ,QAAQ;QAC3BD,MAAM,CAACM,KAAK,GAAGD,CAAC,CAACL,MAAM;MACzB;IACF;EACF,CAAC,EACD,EACF,CAAC;EAED,OAAO;IAAEA,MAAM;IAAEC,QAAQ;IAAEH,gBAAgB;IAAEI;EAAS,CAAC;AACzD,CAAC;AAACQ,OAAA,CAAAb,oBAAA,GAAAA,oBAAA"}
|
|
1
|
+
{"version":3,"names":["_reactNativeReanimated","require","_reactNativeKeyboardController","useKeyboardAnimation","heightWhenOpened","useSharedValue","height","progress","isClosed","useKeyboardHandler","onStart","e","value","onMove","onEnd","duration","exports"],"sources":["hooks.ts"],"sourcesContent":["import { useSharedValue } from \"react-native-reanimated\";\n\nimport { useKeyboardHandler } from \"react-native-keyboard-controller\";\n\nexport const useKeyboardAnimation = () => {\n const heightWhenOpened = useSharedValue(0);\n const height = useSharedValue(0);\n const progress = useSharedValue(0);\n const isClosed = useSharedValue(true);\n\n useKeyboardHandler(\n {\n onStart: (e) => {\n \"worklet\";\n\n if (e.height > 0) {\n isClosed.value = false;\n heightWhenOpened.value = e.height;\n }\n },\n onMove: (e) => {\n \"worklet\";\n\n progress.value = e.progress;\n height.value = e.height;\n },\n onEnd: (e) => {\n \"worklet\";\n\n isClosed.value = e.height === 0;\n\n // `height` update happens in `onMove` handler\n // in `onEnd` we need to update only if `onMove`\n // wasn't called (i. e. duration === 0)\n //\n // we can not call this code without condition below\n // because in some corner cases (iOS with `secureTextEntry`)\n // `onEnd` can be emitted before `onMove` and in this case\n // it may lead to choppy/glitchy/jumpy UI\n // see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/327\n if (e.duration === 0) {\n progress.value = e.progress;\n height.value = e.height;\n }\n },\n },\n [],\n );\n\n return { height, progress, heightWh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A,oBAAA","ignoreList":[]}
|
|
@@ -8,8 +8,8 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
9
|
var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated"));
|
|
10
10
|
var _hooks = require("./hooks");
|
|
11
|
-
function _getRequireWildcardCache(
|
|
12
|
-
function _interopRequireWildcard(
|
|
11
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
12
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
13
13
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
14
14
|
const defaultLayout = {
|
|
15
15
|
x: 0,
|
|
@@ -22,17 +22,16 @@ const defaultLayout = {
|
|
|
22
22
|
* View that moves out of the way when the keyboard appears by automatically
|
|
23
23
|
* adjusting its height, position, or bottom padding.
|
|
24
24
|
*/
|
|
25
|
-
const KeyboardAvoidingView = /*#__PURE__*/(0, _react.forwardRef)((
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
} = _ref;
|
|
25
|
+
const KeyboardAvoidingView = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
26
|
+
behavior,
|
|
27
|
+
children,
|
|
28
|
+
contentContainerStyle,
|
|
29
|
+
enabled = true,
|
|
30
|
+
keyboardVerticalOffset = 0,
|
|
31
|
+
style,
|
|
32
|
+
onLayout: onLayoutProps,
|
|
33
|
+
...props
|
|
34
|
+
}, ref) => {
|
|
36
35
|
const initialFrame = (0, _reactNativeReanimated.useSharedValue)(null);
|
|
37
36
|
const frame = (0, _reactNativeReanimated.useDerivedValue)(() => initialFrame.value || defaultLayout);
|
|
38
37
|
const keyboard = (0, _hooks.useKeyboardAnimation)();
|
|
@@ -48,13 +47,13 @@ const KeyboardAvoidingView = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) =>
|
|
|
48
47
|
const onLayoutWorklet = (0, _react.useCallback)(layout => {
|
|
49
48
|
"worklet";
|
|
50
49
|
|
|
51
|
-
if (keyboard.isClosed.value) {
|
|
50
|
+
if (keyboard.isClosed.value || initialFrame.value === null) {
|
|
52
51
|
initialFrame.value = layout;
|
|
53
52
|
}
|
|
54
53
|
}, []);
|
|
55
54
|
const onLayout = (0, _react.useCallback)(e => {
|
|
56
55
|
(0, _reactNativeReanimated.runOnUI)(onLayoutWorklet)(e.nativeEvent.layout);
|
|
57
|
-
onLayoutProps === null || onLayoutProps === void 0
|
|
56
|
+
onLayoutProps === null || onLayoutProps === void 0 || onLayoutProps(e);
|
|
58
57
|
}, [onLayoutProps]);
|
|
59
58
|
const animatedStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => {
|
|
60
59
|
const bottom = (0, _reactNativeReanimated.interpolate)(keyboard.progress.value, [0, 1], [0, relativeKeyboardHeight()]);
|
|
@@ -98,6 +97,5 @@ const KeyboardAvoidingView = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) =>
|
|
|
98
97
|
style: combinedStyles
|
|
99
98
|
}, props), children);
|
|
100
99
|
});
|
|
101
|
-
var _default = KeyboardAvoidingView;
|
|
102
|
-
exports.default = _default;
|
|
100
|
+
var _default = exports.default = KeyboardAvoidingView;
|
|
103
101
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeReanimated","_hooks","_getRequireWildcardCache","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeReanimated","_hooks","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","_extends","assign","bind","target","arguments","length","source","key","apply","defaultLayout","x","y","width","height","KeyboardAvoidingView","forwardRef","behavior","children","contentContainerStyle","enabled","keyboardVerticalOffset","style","onLayout","onLayoutProps","props","ref","initialFrame","useSharedValue","frame","useDerivedValue","value","keyboard","useKeyboardAnimation","screenHeight","useWindowDimensions","relativeKeyboardHeight","useCallback","keyboardY","heightWhenOpened","Math","max","onLayoutWorklet","layout","isClosed","runOnUI","nativeEvent","animatedStyle","useAnimatedStyle","bottom","interpolate","progress","bottomHeight","flex","paddingBottom","isPositionBehavior","containerStyle","combinedStyles","useMemo","createElement","View","_default","exports"],"sources":["index.tsx"],"sourcesContent":["import React, { forwardRef, useCallback, useMemo } from \"react\";\nimport { View, useWindowDimensions } from \"react-native\";\nimport Reanimated, {\n interpolate,\n runOnUI,\n useAnimatedStyle,\n useDerivedValue,\n useSharedValue,\n} from \"react-native-reanimated\";\n\nimport { useKeyboardAnimation } from \"./hooks\";\n\nimport type { LayoutRectangle, ViewProps } from \"react-native\";\n\ntype Props = {\n /**\n * Specify how to react to the presence of the keyboard.\n */\n behavior?: \"height\" | \"position\" | \"padding\";\n\n /**\n * Style of the content container when `behavior` is 'position'.\n */\n contentContainerStyle?: ViewProps[\"style\"];\n\n /**\n * Controls whether this `KeyboardAvoidingView` instance should take effect.\n * This is useful when more than one is on the screen. Defaults to true.\n */\n enabled?: boolean;\n\n /**\n * Distance between the top of the user screen and the React Native view. This\n * may be non-zero in some cases. Defaults to 0.\n */\n keyboardVerticalOffset?: number;\n} & ViewProps;\n\nconst defaultLayout: LayoutRectangle = {\n x: 0,\n y: 0,\n width: 0,\n height: 0,\n};\n\n/**\n * View that moves out of the way when the keyboard appears by automatically\n * adjusting its height, position, or bottom padding.\n */\nconst KeyboardAvoidingView = forwardRef<View, React.PropsWithChildren<Props>>(\n (\n {\n behavior,\n children,\n contentContainerStyle,\n enabled = true,\n keyboardVerticalOffset = 0,\n style,\n onLayout: onLayoutProps,\n ...props\n },\n ref,\n ) => {\n const initialFrame = useSharedValue<LayoutRectangle | null>(null);\n const frame = useDerivedValue(() => initialFrame.value || defaultLayout);\n\n const keyboard = useKeyboardAnimation();\n const { height: screenHeight } = useWindowDimensions();\n\n const relativeKeyboardHeight = useCallback(() => {\n \"worklet\";\n\n const keyboardY =\n screenHeight - keyboard.heightWhenOpened.value - keyboardVerticalOffset;\n\n return Math.max(frame.value.y + frame.value.height - keyboardY, 0);\n }, [screenHeight, keyboardVerticalOffset]);\n\n const onLayoutWorklet = useCallback((layout: LayoutRectangle) => {\n \"worklet\";\n\n if (keyboard.isClosed.value || initialFrame.value === null) {\n initialFrame.value = layout;\n }\n }, []);\n const onLayout = useCallback<NonNullable<ViewProps[\"onLayout\"]>>(\n (e) => {\n runOnUI(onLayoutWorklet)(e.nativeEvent.layout);\n onLayoutProps?.(e);\n },\n [onLayoutProps],\n );\n\n const animatedStyle = useAnimatedStyle(() => {\n const bottom = interpolate(\n keyboard.progress.value,\n [0, 1],\n [0, relativeKeyboardHeight()],\n );\n const bottomHeight = enabled ? bottom : 0;\n\n switch (behavior) {\n case \"height\":\n if (!keyboard.isClosed.value) {\n return {\n height: frame.value.height - bottomHeight,\n flex: 0,\n };\n }\n\n return {};\n\n case \"position\":\n return { bottom: bottomHeight };\n\n case \"padding\":\n return { paddingBottom: bottomHeight };\n\n default:\n return {};\n }\n }, [behavior, enabled, relativeKeyboardHeight]);\n const isPositionBehavior = behavior === \"position\";\n const containerStyle = isPositionBehavior ? contentContainerStyle : style;\n const combinedStyles = useMemo(\n () => [containerStyle, animatedStyle],\n [containerStyle, animatedStyle],\n );\n\n if (isPositionBehavior) {\n return (\n <View ref={ref} style={style} onLayout={onLayout} {...props}>\n <Reanimated.View style={combinedStyles}>{children}</Reanimated.View>\n </View>\n );\n }\n\n return (\n <Reanimated.View\n ref={ref}\n onLayout={onLayout}\n style={combinedStyles}\n {...props}\n >\n {children}\n </Reanimated.View>\n );\n },\n);\n\nexport default KeyboardAvoidingView;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAH,uBAAA,CAAAC,OAAA;AAQA,IAAAG,MAAA,GAAAH,OAAA;AAA+C,SAAAI,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAN,wBAAAM,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAjB,C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vC,QAA0B,CAC/D,CAAC;EAEX;EAEA,oBACE5C,MAAA,CAAAY,OAAA,CAAAyE,aAAA,CAACjF,sBAAA,CAAAQ,OAAU,CAAC0E,IAAI,EAAA3D,QAAA;IACdyB,GAAG,EAAEA,GAAI;IACTH,QAAQ,EAAEA,QAAS;IACnBD,KAAK,EAAEmC;EAAe,GAClBhC,KAAK,GAERP,QACc,CAAC;AAEtB,CACF,CAAC;AAAC,IAAA2C,QAAA,GAAAC,OAAA,CAAA5E,OAAA,GAEa6B,oBAAoB","ignoreList":[]}
|
|
@@ -10,8 +10,8 @@ var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reani
|
|
|
10
10
|
var _reactNativeKeyboardController = require("react-native-keyboard-controller");
|
|
11
11
|
var _useSmoothKeyboardHandler = require("./useSmoothKeyboardHandler");
|
|
12
12
|
var _utils = require("./utils");
|
|
13
|
-
function _getRequireWildcardCache(
|
|
14
|
-
function _interopRequireWildcard(
|
|
13
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
14
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
15
15
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
16
16
|
/*
|
|
17
17
|
* Everything begins from `onStart` handler. This handler is called every time,
|
|
@@ -51,15 +51,14 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
51
51
|
* +============================+ +============================+ +=====================================+
|
|
52
52
|
*
|
|
53
53
|
*/
|
|
54
|
-
const KeyboardAwareScrollView = /*#__PURE__*/(0, _react.forwardRef)((
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
} = _ref;
|
|
54
|
+
const KeyboardAwareScrollView = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
55
|
+
children,
|
|
56
|
+
onLayout,
|
|
57
|
+
bottomOffset = 0,
|
|
58
|
+
disableScrollOnKeyboardHide = false,
|
|
59
|
+
enabled = true,
|
|
60
|
+
...rest
|
|
61
|
+
}, ref) => {
|
|
63
62
|
const scrollViewAnimatedRef = (0, _reactNativeReanimated.useAnimatedRef)();
|
|
64
63
|
const scrollViewTarget = (0, _reactNativeReanimated.useSharedValue)(null);
|
|
65
64
|
const scrollPosition = (0, _reactNativeReanimated.useSharedValue)(0);
|
|
@@ -92,17 +91,16 @@ const KeyboardAwareScrollView = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref)
|
|
|
92
91
|
}, []);
|
|
93
92
|
const onScrollViewLayout = (0, _react.useCallback)(e => {
|
|
94
93
|
scrollViewTarget.value = (0, _reactNative.findNodeHandle)(scrollViewAnimatedRef.current);
|
|
95
|
-
onLayout === null || onLayout === void 0
|
|
94
|
+
onLayout === null || onLayout === void 0 || onLayout(e);
|
|
96
95
|
}, [onLayout]);
|
|
97
96
|
|
|
98
97
|
/**
|
|
99
98
|
* Function that will scroll a ScrollView as keyboard gets moving
|
|
100
99
|
*/
|
|
101
|
-
const maybeScroll = (0, _react.useCallback)(
|
|
100
|
+
const maybeScroll = (0, _react.useCallback)((e, animated = false) => {
|
|
102
101
|
"worklet";
|
|
103
102
|
|
|
104
103
|
var _layout$value, _layout$value2, _layout$value3;
|
|
105
|
-
let animated = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
106
104
|
if (!enabled) {
|
|
107
105
|
return 0;
|
|
108
106
|
}
|
|
@@ -234,6 +232,5 @@ const KeyboardAwareScrollView = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref)
|
|
|
234
232
|
style: view
|
|
235
233
|
}));
|
|
236
234
|
});
|
|
237
|
-
var _default = KeyboardAwareScrollView;
|
|
238
|
-
exports.default = _default;
|
|
235
|
+
var _default = exports.default = KeyboardAwareScrollView;
|
|
239
236
|
//# sourceMappingURL=index.js.map
|