react-native-keyboard-controller 1.21.13 → 1.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/android/src/fabric/java/com/reactnativekeyboardcontroller/KeyboardControllerModule.kt +4 -0
  2. package/android/src/main/java/com/reactnativekeyboardcontroller/interactive/KeyboardAnimationController.kt +6 -0
  3. package/android/src/main/java/com/reactnativekeyboardcontroller/modules/KeyboardControllerModuleImpl.kt +5 -0
  4. package/android/src/main/java/com/reactnativekeyboardcontroller/views/ClippingScrollViewDecoratorView.kt +12 -7
  5. package/android/src/paper/java/com/reactnativekeyboardcontroller/KeyboardControllerModule.kt +5 -0
  6. package/ios/KeyboardBackdropController.swift +64 -0
  7. package/ios/KeyboardControllerModule.mm +11 -0
  8. package/ios/KeyboardControllerModuleImpl.swift +5 -0
  9. package/ios/extensions/UIWindow.swift +5 -1
  10. package/jest/index.js +1 -0
  11. package/lib/commonjs/bindings.js +1 -0
  12. package/lib/commonjs/bindings.js.map +1 -1
  13. package/lib/commonjs/components/KeyboardChatScrollView/index.js +6 -0
  14. package/lib/commonjs/components/KeyboardChatScrollView/index.js.map +1 -1
  15. package/lib/commonjs/components/KeyboardChatScrollView/useFrozenPadding/index.js +62 -0
  16. package/lib/commonjs/components/KeyboardChatScrollView/useFrozenPadding/index.js.map +1 -0
  17. package/lib/commonjs/components/KeyboardEffects/index.js +92 -0
  18. package/lib/commonjs/components/KeyboardEffects/index.js.map +1 -0
  19. package/lib/commonjs/components/KeyboardToolbar/constants.js +2 -3
  20. package/lib/commonjs/components/KeyboardToolbar/constants.js.map +1 -1
  21. package/lib/commonjs/components/KeyboardToolbar/index.js +8 -7
  22. package/lib/commonjs/components/KeyboardToolbar/index.js.map +1 -1
  23. package/lib/commonjs/components/index.js +7 -0
  24. package/lib/commonjs/components/index.js.map +1 -1
  25. package/lib/commonjs/constants.js +2 -1
  26. package/lib/commonjs/constants.js.map +1 -1
  27. package/lib/commonjs/index.js +7 -0
  28. package/lib/commonjs/index.js.map +1 -1
  29. package/lib/commonjs/module.js +1 -0
  30. package/lib/commonjs/module.js.map +1 -1
  31. package/lib/commonjs/specs/NativeKeyboardController.js.map +1 -1
  32. package/lib/commonjs/types/module.js.map +1 -1
  33. package/lib/module/bindings.js +1 -0
  34. package/lib/module/bindings.js.map +1 -1
  35. package/lib/module/components/KeyboardChatScrollView/index.js +6 -0
  36. package/lib/module/components/KeyboardChatScrollView/index.js.map +1 -1
  37. package/lib/module/components/KeyboardChatScrollView/useFrozenPadding/index.js +57 -0
  38. package/lib/module/components/KeyboardChatScrollView/useFrozenPadding/index.js.map +1 -0
  39. package/lib/module/components/KeyboardEffects/index.js +84 -0
  40. package/lib/module/components/KeyboardEffects/index.js.map +1 -0
  41. package/lib/module/components/KeyboardToolbar/constants.js +1 -2
  42. package/lib/module/components/KeyboardToolbar/constants.js.map +1 -1
  43. package/lib/module/components/KeyboardToolbar/index.js +2 -1
  44. package/lib/module/components/KeyboardToolbar/index.js.map +1 -1
  45. package/lib/module/components/index.js +1 -0
  46. package/lib/module/components/index.js.map +1 -1
  47. package/lib/module/constants.js +1 -0
  48. package/lib/module/constants.js.map +1 -1
  49. package/lib/module/index.js +1 -1
  50. package/lib/module/index.js.map +1 -1
  51. package/lib/module/module.js +1 -0
  52. package/lib/module/module.js.map +1 -1
  53. package/lib/module/specs/NativeKeyboardController.js.map +1 -1
  54. package/lib/module/types/module.js.map +1 -1
  55. package/lib/typescript/components/KeyboardChatScrollView/useFrozenPadding/index.d.ts +30 -0
  56. package/lib/typescript/components/KeyboardEffects/index.d.ts +44 -0
  57. package/lib/typescript/components/KeyboardToolbar/constants.d.ts +0 -1
  58. package/lib/typescript/components/index.d.ts +2 -0
  59. package/lib/typescript/constants.d.ts +1 -0
  60. package/lib/typescript/index.d.ts +2 -2
  61. package/lib/typescript/specs/NativeKeyboardController.d.ts +1 -0
  62. package/lib/typescript/types/module.d.ts +7 -0
  63. package/package.json +1 -1
  64. package/src/bindings.ts +1 -0
  65. package/src/components/KeyboardChatScrollView/index.tsx +7 -0
  66. package/src/components/KeyboardChatScrollView/useFrozenPadding/index.ts +83 -0
  67. package/src/components/KeyboardEffects/index.tsx +121 -0
  68. package/src/components/KeyboardToolbar/constants.ts +1 -2
  69. package/src/components/KeyboardToolbar/index.tsx +1 -1
  70. package/src/components/index.ts +2 -0
  71. package/src/constants.ts +1 -0
  72. package/src/index.ts +2 -0
  73. package/src/module.ts +1 -0
  74. package/src/specs/NativeKeyboardController.ts +1 -0
  75. package/src/types/module.ts +7 -0
@@ -25,6 +25,10 @@ class KeyboardControllerModule(
25
25
  module.preload()
26
26
  }
27
27
 
28
+ override fun setTranslucent(translucent: Boolean) {
29
+ module.setTranslucent(translucent)
30
+ }
31
+
28
32
  override fun dismiss(
29
33
  keepFocus: Boolean,
30
34
  animated: Boolean,
@@ -337,6 +337,12 @@ internal class KeyboardAnimationController {
337
337
  currentSpringAnimation = null
338
338
 
339
339
  pendingRequestOnReady = null
340
+
341
+ // `animateToFinish` clears this flag before finishing the controller, but gestures that
342
+ // end via `cancel()`/`onFinished`/`onCancelled` never pass through it. A stranded `true`
343
+ // makes `KeyboardAnimationCallback` treat the keyboard as moving forever, which disables
344
+ // its desynchronized-state recovery for the rest of the process lifetime.
345
+ InteractiveKeyboardProvider.isInteractive = false
340
346
  }
341
347
 
342
348
  /**
@@ -40,6 +40,11 @@ class KeyboardControllerModuleImpl(
40
40
  // no-op on Android
41
41
  }
42
42
 
43
+ @Suppress("detekt:UnusedParameter")
44
+ fun setTranslucent(translucent: Boolean) {
45
+ // no-op on Android
46
+ }
47
+
43
48
  fun dismiss(
44
49
  keepFocus: Boolean,
45
50
  animated: Boolean,
@@ -5,6 +5,7 @@ import android.view.MotionEvent
5
5
  import android.view.View
6
6
  import android.view.ViewGroup
7
7
  import android.widget.ScrollView
8
+ import androidx.core.widget.NestedScrollView
8
9
  import com.facebook.react.uimanager.ThemedReactContext
9
10
  import com.facebook.react.views.view.ReactViewGroup
10
11
  import com.reactnativekeyboardcontroller.extensions.px
@@ -100,7 +101,7 @@ class ClippingScrollViewDecoratorView(
100
101
  }
101
102
 
102
103
  private fun shouldUsePaddingScrollWorkaround(
103
- scrollView: ScrollView,
104
+ scrollView: ViewGroup,
104
105
  event: MotionEvent,
105
106
  ): Boolean {
106
107
  val contentView = scrollView.getChildAt(0) ?: return false
@@ -115,7 +116,7 @@ class ClippingScrollViewDecoratorView(
115
116
  }
116
117
 
117
118
  private fun dispatchWithExpandedContentRange(
118
- scrollView: ScrollView,
119
+ scrollView: ViewGroup,
119
120
  event: MotionEvent,
120
121
  ): Boolean {
121
122
  val contentView = scrollView.getChildAt(0)
@@ -136,7 +137,7 @@ class ClippingScrollViewDecoratorView(
136
137
  }
137
138
 
138
139
  private fun isTouchInScrollContent(
139
- scrollView: ScrollView,
140
+ scrollView: ViewGroup,
140
141
  event: MotionEvent,
141
142
  ): Boolean {
142
143
  val contentView = scrollView.getChildAt(0) ?: return false
@@ -158,11 +159,15 @@ class ClippingScrollViewDecoratorView(
158
159
  )
159
160
  }
160
161
 
161
- private fun findScrollView(view: View?): ScrollView? {
162
- var result: ScrollView? = null
162
+ private fun findScrollView(view: View?): ViewGroup? {
163
+ var result: ViewGroup? = null
163
164
 
164
- if (view is ScrollView) {
165
- result = view
165
+ // Match NestedScrollView too: with React Native's `useNestedScrollViewAndroid`
166
+ // feature flag (RN 0.85+), ScrollView renders as a NestedScrollView subclass
167
+ // (a FrameLayout, not an android.widget.ScrollView). Both extend the scroll
168
+ // range via bottom padding + clipToPadding=false the same way.
169
+ if (view is ScrollView || view is NestedScrollView) {
170
+ result = view as ViewGroup
166
171
  } else if (view is ViewGroup) {
167
172
  var i = 0
168
173
  while (i < view.childCount && result == null) {
@@ -30,6 +30,11 @@ class KeyboardControllerModule(
30
30
  module.preload()
31
31
  }
32
32
 
33
+ @ReactMethod
34
+ fun setTranslucent(translucent: Boolean) {
35
+ module.setTranslucent(translucent)
36
+ }
37
+
33
38
  @ReactMethod
34
39
  fun dismiss(
35
40
  keepFocus: Boolean,
@@ -0,0 +1,64 @@
1
+ //
2
+ // KeyboardBackdropController.swift
3
+ // Pods
4
+ //
5
+ // Created by Kiryl Ziusko on 29/06/2026.
6
+ //
7
+
8
+ import Foundation
9
+ import UIKit
10
+
11
+ final class KeyboardBackdropController: NSObject {
12
+ static let shared = KeyboardBackdropController()
13
+
14
+ private var isTranslucent = false
15
+
16
+ override init() {
17
+ super.init()
18
+
19
+ NotificationCenter.default.addObserver(
20
+ self,
21
+ selector: #selector(keyboardWillShow(_:)),
22
+ name: UIResponder.keyboardWillShowNotification,
23
+ object: nil
24
+ )
25
+ }
26
+
27
+ func setTranslucent(_ translucent: Bool) {
28
+ isTranslucent = translucent
29
+ applyTranslucency()
30
+ }
31
+
32
+ @objc private func keyboardWillShow(_: Notification) {
33
+ guard isTranslucent else {
34
+ return
35
+ }
36
+
37
+ applyTranslucency()
38
+ }
39
+
40
+ private func applyTranslucency() {
41
+ guard let keyboardWindow = UIWindow.keyboardWindow else {
42
+ return
43
+ }
44
+
45
+ applyTranslucency(in: keyboardWindow)
46
+ }
47
+
48
+ private func applyTranslucency(in view: UIView) {
49
+ if isKeyboardBackdropView(view) {
50
+ view.alpha = isTranslucent ? 0 : 1
51
+ return
52
+ }
53
+
54
+ for subview in view.subviews {
55
+ applyTranslucency(in: subview)
56
+ }
57
+ }
58
+
59
+ private func isKeyboardBackdropView(_ view: UIView) -> Bool {
60
+ let type = NSStringFromClass(type(of: view))
61
+
62
+ return type.hasSuffix("UIKBBackdropView")
63
+ }
64
+ }
@@ -90,6 +90,17 @@ RCT_EXPORT_METHOD(preload)
90
90
  [UIResponder preloadKeyboardIfNeeded];
91
91
  }
92
92
 
93
+ #ifdef RCT_NEW_ARCH_ENABLED
94
+ - (void)setTranslucent:(BOOL)translucent
95
+ #else
96
+ RCT_EXPORT_METHOD(setTranslucent : (BOOL)translucent)
97
+ #endif
98
+ {
99
+ dispatch_async(dispatch_get_main_queue(), ^{
100
+ [KeyboardControllerModuleImpl setTranslucent:translucent];
101
+ });
102
+ }
103
+
93
104
  #ifdef RCT_NEW_ARCH_ENABLED
94
105
  - (void)dismiss:(BOOL)keepFocus animated:(BOOL)animated
95
106
  #else
@@ -12,6 +12,11 @@ import UIKit
12
12
  public class KeyboardControllerModuleImpl: NSObject {
13
13
  private static let keyboardRevealGestureName = "keyboardRevealGesture"
14
14
 
15
+ @objc
16
+ public static func setTranslucent(_ translucent: Bool) {
17
+ KeyboardBackdropController.shared.setTranslucent(translucent)
18
+ }
19
+
15
20
  @objc
16
21
  public static func dismiss(_ keepFocus: Bool, animated: Bool) {
17
22
  let work = {
@@ -14,7 +14,7 @@ public extension UIWindow {
14
14
  static let sharedKeyboardWindowObserver = KeyboardWindowObserver()
15
15
 
16
16
  class KeyboardWindowObserver: NSObject {
17
- private weak var keyboardWindow: UIWindow?
17
+ weak var keyboardWindow: UIWindow?
18
18
 
19
19
  override init() {
20
20
  super.init()
@@ -45,6 +45,10 @@ public extension UIWindow {
45
45
  }
46
46
  }
47
47
 
48
+ static var keyboardWindow: UIWindow? {
49
+ return sharedKeyboardWindowObserver.keyboardWindow
50
+ }
51
+
48
52
  static var topWindow: UIWindow? {
49
53
  return sharedKeyboardWindowObserver.getTopWindow()
50
54
  }
package/jest/index.js CHANGED
@@ -131,6 +131,7 @@ const mock = {
131
131
  Group: "KeyboardToolbar.Group",
132
132
  }),
133
133
  KeyboardChatScrollView: ScrollView,
134
+ KeyboardEffects: View,
134
135
  // themes
135
136
  DefaultKeyboardToolbarTheme,
136
137
  };
@@ -10,6 +10,7 @@ const KeyboardControllerNative = exports.KeyboardControllerNative = {
10
10
  setDefaultMode: NOOP,
11
11
  setInputMode: NOOP,
12
12
  preload: NOOP,
13
+ setTranslucent: NOOP,
13
14
  dismiss: NOOP,
14
15
  setFocusTo: NOOP,
15
16
  viewPositionInWindow: () => Promise.resolve({
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","NOOP","KeyboardControllerNative","exports","setDefaultMode","setInputMode","preload","dismiss","setFocusTo","viewPositionInWindow","Promise","resolve","x","y","width","height","addListener","removeListeners","getConstants","keyboardBorderRadius","KeyboardEvents","remove","FocusedInputEvents","WindowDimensionsEvents","KeyboardControllerView","View","KeyboardControllerViewCommands","synchronizeFocusedInputLayout","_ref","KeyboardGestureArea","RCTOverKeyboardView","KeyboardBackgroundView","RCTKeyboardExtender","ClippingScrollView","RCTKeyboardToolbarGroupView"],"sources":["bindings.ts"],"sourcesContent":["import { View } from \"react-native\";\n\nimport type {\n ClippingScrollViewProps,\n FocusedInputEventsModule,\n KeyboardBackgroundViewProps,\n KeyboardControllerNativeModule,\n KeyboardControllerProps,\n KeyboardEventsModule,\n KeyboardExtenderProps,\n KeyboardGestureAreaProps,\n KeyboardToolbarGroupViewProps,\n OverKeyboardViewProps,\n WindowDimensionsEventsModule,\n} from \"./types\";\nimport type { EmitterSubscription } from \"react-native\";\n\nconst NOOP = () => {};\n\nexport const KeyboardControllerNative: KeyboardControllerNativeModule = {\n setDefaultMode: NOOP,\n setInputMode: NOOP,\n preload: NOOP,\n dismiss: NOOP,\n setFocusTo: NOOP,\n viewPositionInWindow: () =>\n Promise.resolve({ x: 0, y: 0, width: 0, height: 0 }),\n addListener: NOOP,\n removeListeners: NOOP,\n getConstants: () => ({\n keyboardBorderRadius: 0,\n }),\n};\n/**\n * An event emitter that provides a way to subscribe to next keyboard events:\n * - `keyboardWillShow`;\n * - `keyboardDidShow`;\n * - `keyboardWillHide`;\n * - `keyboardDidHide`.\n *\n * Use `addListener` function to add your event listener for a specific keyboard event.\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 WindowDimensionsEvents: WindowDimensionsEventsModule = {\n addListener: () => ({ remove: NOOP } as EmitterSubscription),\n};\n/**\n * A view that sends events whenever keyboard or focused events are happening.\n *\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller-view|Documentation} page for more details.\n */\nexport const KeyboardControllerView =\n View as unknown as React.FC<KeyboardControllerProps>;\nexport const KeyboardControllerViewCommands = {\n synchronizeFocusedInputLayout: (\n _ref: React.Component<KeyboardControllerProps> | null,\n ) => {},\n};\n/**\n * A view that defines a region on the screen, where gestures will control the keyboard position.\n *\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-gesture-area|Documentation} page for more details.\n */\nexport const KeyboardGestureArea =\n View as unknown as React.FC<KeyboardGestureAreaProps>;\nexport const RCTOverKeyboardView =\n View as unknown as React.FC<OverKeyboardViewProps>;\n/**\n * A view that matches keyboard background.\n *\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-background-view|Documentation} page for more details.\n */\nexport const KeyboardBackgroundView =\n View as unknown as React.FC<KeyboardBackgroundViewProps>;\n/**\n * A container that will embed its children into the keyboard\n * and will always show them above the keyboard.\n *\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-extender|Documentation} page for more details.\n */\nexport const RCTKeyboardExtender =\n View as unknown as React.FC<KeyboardExtenderProps>;\n/**\n * A decorator that will clip the content of the `ScrollView`. It helps to simulate `contentInset` behavior on Android\n * Supports only `bottom` property (`paddingBottom` is not supported property of `ScrollView.style`).\n * Using this component we can modify bottom inset without having a fake view.\n *\n * On iOS we use swizzling to apply runtime patches to fix some broken internal methods.\n * Ideally this component shouldn't exist and all its fixes/polyfills must be added directly to react-native and\n * we will port features/fixes back to upstream, but at the moment we use this view to\n * deliver desired functionality regardless of react-native version used.\n */\nexport const ClippingScrollView =\n View as unknown as React.FC<ClippingScrollViewProps>;\n/**\n * A View that defines a group of `TextInput`s.\n * Used in toolbar navigation to assure that you can navigate only between inputs withing the same group.\n */\nexport const RCTKeyboardToolbarGroupView =\n View as unknown as React.FC<KeyboardToolbarGroupViewProps>;\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAiBA,MAAMC,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AAEd,MAAMC,wBAAwD,GAAAC,OAAA,CAAAD,wBAAA,GAAG;EACtEE,cAAc,EAAEH,IAAI;EACpBI,YAAY,EAAEJ,IAAI;EAClBK,OAAO,EAAEL,IAAI;EACbM,OAAO,EAAEN,IAAI;EACbO,UAAU,EAAEP,IAAI;EAChBQ,oBAAoB,EAAEA,CAAA,KACpBC,OAAO,CAACC,OAAO,CAAC;IAAEC,CAAC,EAAE,CAAC;IAAEC,CAAC,EAAE,CAAC;IAAEC,KAAK,EAAE,CAAC;IAAEC,MAAM,EAAE;EAAE,CAAC,CAAC;EACtDC,WAAW,EAAEf,IAAI;EACjBgB,eAAe,EAAEhB,IAAI;EACrBiB,YAAY,EAAEA,CAAA,MAAO;IACnBC,oBAAoB,EAAE;EACxB,CAAC;AACH,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,cAAoC,GAAAjB,OAAA,CAAAiB,cAAA,GAAG;EAClDJ,WAAW,EAAEA,CAAA,MAAO;IAAEK,MAAM,EAAEpB;EAAK,CAAC;AACtC,CAAC;AACD;AACA;AACA;AACA;AACO,MAAMqB,kBAA4C,GAAAnB,OAAA,CAAAmB,kBAAA,GAAG;EAC1DN,WAAW,EAAEA,CAAA,MAAO;IAAEK,MAAM,EAAEpB;EAAK,CAAC;AACtC,CAAC;AACM,MAAMsB,sBAAoD,GAAApB,OAAA,CAAAoB,sBAAA,GAAG;EAClEP,WAAW,EAAEA,CAAA,MAAO;IAAEK,MAAM,EAAEpB;EAAK,CAAC;AACtC,CAAC;AACD;AACA;AACA;AACA;AACA;AACO,MAAMuB,sBAAsB,GAAArB,OAAA,CAAAqB,sBAAA,GACjCC,iBAAoD;AAC/C,MAAMC,8BAA8B,GAAAvB,OAAA,CAAAuB,8BAAA,GAAG;EAC5CC,6BAA6B,EAC3BC,IAAqD,IAClD,CAAC;AACR,CAAC;AACD;AACA;AACA;AACA;AACA;AACO,MAAMC,mBAAmB,GAAA1B,OAAA,CAAA0B,mBAAA,GAC9BJ,iBAAqD;AAChD,MAAMK,mBAAmB,GAAA3B,OAAA,CAAA2B,mBAAA,GAC9BL,iBAAkD;AACpD;AACA;AACA;AACA;AACA;AACO,MAAMM,sBAAsB,GAAA5B,OAAA,CAAA4B,sBAAA,GACjCN,iBAAwD;AAC1D;AACA;AACA;AACA;AACA;AACA;AACO,MAAMO,mBAAmB,GAAA7B,OAAA,CAAA6B,mBAAA,GAC9BP,iBAAkD;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMQ,kBAAkB,GAAA9B,OAAA,CAAA8B,kBAAA,GAC7BR,iBAAoD;AACtD;AACA;AACA;AACA;AACO,MAAMS,2BAA2B,GAAA/B,OAAA,CAAA+B,2BAAA,GACtCT,iBAA0D","ignoreList":[]}
1
+ {"version":3,"names":["_reactNative","require","NOOP","KeyboardControllerNative","exports","setDefaultMode","setInputMode","preload","setTranslucent","dismiss","setFocusTo","viewPositionInWindow","Promise","resolve","x","y","width","height","addListener","removeListeners","getConstants","keyboardBorderRadius","KeyboardEvents","remove","FocusedInputEvents","WindowDimensionsEvents","KeyboardControllerView","View","KeyboardControllerViewCommands","synchronizeFocusedInputLayout","_ref","KeyboardGestureArea","RCTOverKeyboardView","KeyboardBackgroundView","RCTKeyboardExtender","ClippingScrollView","RCTKeyboardToolbarGroupView"],"sources":["bindings.ts"],"sourcesContent":["import { View } from \"react-native\";\n\nimport type {\n ClippingScrollViewProps,\n FocusedInputEventsModule,\n KeyboardBackgroundViewProps,\n KeyboardControllerNativeModule,\n KeyboardControllerProps,\n KeyboardEventsModule,\n KeyboardExtenderProps,\n KeyboardGestureAreaProps,\n KeyboardToolbarGroupViewProps,\n OverKeyboardViewProps,\n WindowDimensionsEventsModule,\n} from \"./types\";\nimport type { EmitterSubscription } from \"react-native\";\n\nconst NOOP = () => {};\n\nexport const KeyboardControllerNative: KeyboardControllerNativeModule = {\n setDefaultMode: NOOP,\n setInputMode: NOOP,\n preload: NOOP,\n setTranslucent: NOOP,\n dismiss: NOOP,\n setFocusTo: NOOP,\n viewPositionInWindow: () =>\n Promise.resolve({ x: 0, y: 0, width: 0, height: 0 }),\n addListener: NOOP,\n removeListeners: NOOP,\n getConstants: () => ({\n keyboardBorderRadius: 0,\n }),\n};\n/**\n * An event emitter that provides a way to subscribe to next keyboard events:\n * - `keyboardWillShow`;\n * - `keyboardDidShow`;\n * - `keyboardWillHide`;\n * - `keyboardDidHide`.\n *\n * Use `addListener` function to add your event listener for a specific keyboard event.\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 WindowDimensionsEvents: WindowDimensionsEventsModule = {\n addListener: () => ({ remove: NOOP } as EmitterSubscription),\n};\n/**\n * A view that sends events whenever keyboard or focused events are happening.\n *\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller-view|Documentation} page for more details.\n */\nexport const KeyboardControllerView =\n View as unknown as React.FC<KeyboardControllerProps>;\nexport const KeyboardControllerViewCommands = {\n synchronizeFocusedInputLayout: (\n _ref: React.Component<KeyboardControllerProps> | null,\n ) => {},\n};\n/**\n * A view that defines a region on the screen, where gestures will control the keyboard position.\n *\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-gesture-area|Documentation} page for more details.\n */\nexport const KeyboardGestureArea =\n View as unknown as React.FC<KeyboardGestureAreaProps>;\nexport const RCTOverKeyboardView =\n View as unknown as React.FC<OverKeyboardViewProps>;\n/**\n * A view that matches keyboard background.\n *\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-background-view|Documentation} page for more details.\n */\nexport const KeyboardBackgroundView =\n View as unknown as React.FC<KeyboardBackgroundViewProps>;\n/**\n * A container that will embed its children into the keyboard\n * and will always show them above the keyboard.\n *\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-extender|Documentation} page for more details.\n */\nexport const RCTKeyboardExtender =\n View as unknown as React.FC<KeyboardExtenderProps>;\n/**\n * A decorator that will clip the content of the `ScrollView`. It helps to simulate `contentInset` behavior on Android\n * Supports only `bottom` property (`paddingBottom` is not supported property of `ScrollView.style`).\n * Using this component we can modify bottom inset without having a fake view.\n *\n * On iOS we use swizzling to apply runtime patches to fix some broken internal methods.\n * Ideally this component shouldn't exist and all its fixes/polyfills must be added directly to react-native and\n * we will port features/fixes back to upstream, but at the moment we use this view to\n * deliver desired functionality regardless of react-native version used.\n */\nexport const ClippingScrollView =\n View as unknown as React.FC<ClippingScrollViewProps>;\n/**\n * A View that defines a group of `TextInput`s.\n * Used in toolbar navigation to assure that you can navigate only between inputs withing the same group.\n */\nexport const RCTKeyboardToolbarGroupView =\n View as unknown as React.FC<KeyboardToolbarGroupViewProps>;\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAiBA,MAAMC,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AAEd,MAAMC,wBAAwD,GAAAC,OAAA,CAAAD,wBAAA,GAAG;EACtEE,cAAc,EAAEH,IAAI;EACpBI,YAAY,EAAEJ,IAAI;EAClBK,OAAO,EAAEL,IAAI;EACbM,cAAc,EAAEN,IAAI;EACpBO,OAAO,EAAEP,IAAI;EACbQ,UAAU,EAAER,IAAI;EAChBS,oBAAoB,EAAEA,CAAA,KACpBC,OAAO,CAACC,OAAO,CAAC;IAAEC,CAAC,EAAE,CAAC;IAAEC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AkD;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMQ,kBAAkB,GAAA/B,OAAA,CAAA+B,kBAAA,GAC7BR,iBAAoD;AACtD;AACA;AACA;AACA;AACO,MAAMS,2BAA2B,GAAAhC,OAAA,CAAAgC,2BAAA,GACtCT,iBAA0D","ignoreList":[]}
@@ -12,6 +12,7 @@ var _ScrollViewWithBottomPadding = _interopRequireDefault(require("../ScrollView
12
12
  var _useChatKeyboard = require("./useChatKeyboard");
13
13
  var _useEndVisible = require("./useEndVisible");
14
14
  var _useExtraContentPadding = require("./useExtraContentPadding");
15
+ var _useFrozenPadding = require("./useFrozenPadding");
15
16
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
16
17
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
17
18
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
@@ -65,6 +66,11 @@ const KeyboardChatScrollView = /*#__PURE__*/(0, _react.forwardRef)(({
65
66
  keyboardLiftBehavior,
66
67
  freeze: freezeSV
67
68
  });
69
+ (0, _useFrozenPadding.useFrozenPadding)({
70
+ freeze: freezeSV,
71
+ offset,
72
+ padding
73
+ });
68
74
  (0, _useEndVisible.useEndVisible)({
69
75
  scroll,
70
76
  layout,
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeReanimated","_useCombinedRef","_interopRequireDefault","_ScrollViewWithBottomPadding","_useChatKeyboard","_useEndVisible","_useExtraContentPadding","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_extends","assign","bind","arguments","length","apply","ZERO_CONTENT_PADDING","makeMutable","ZERO_BLANK_SPACE","KeyboardChatScrollView","forwardRef","children","ScrollViewComponent","Reanimated","ScrollView","inverted","keyboardLiftBehavior","freeze","offset","extraContentPadding","blankSpace","applyWorkaroundForContentInsetHitTestBug","onLayout","onLayoutProp","onContentSizeChange","onContentSizeChangeProp","onEndVisible","rest","ref","scrollViewRef","useAnimatedRef","onRef","useCombinedRef","freezeSV","useDerivedValue","value","padding","currentHeight","contentOffsetY","scroll","layout","size","onLayoutInternal","onContentSizeChangeInternal","useChatKeyboard","useExtraContentPadding","keyboardPadding","useEndVisible","totalPadding","Math","min","height","max","indicatorPadding","useCallback","w","h","commitStyle","useAnimatedStyle","transform","translateY","commit","useMemo","styles","commitView","createElement","Fragment","bottomPadding","scrollIndicatorPadding","View","style","StyleSheet","create","display","position","_default","exports"],"sources":["index.tsx"],"sourcesContent":["import React, { forwardRef, useCallback, useMemo } from \"react\";\nimport { StyleSheet } from \"react-native\";\nimport {\n makeMutable,\n useAnimatedRef,\n useAnimatedStyle,\n useDerivedValue,\n} from \"react-native-reanimated\";\nimport Reanimated from \"react-native-reanimated\";\n\nimport useCombinedRef from \"../hooks/useCombinedRef\";\nimport ScrollViewWithBottomPadding from \"../ScrollViewWithBottomPadding\";\n\nimport { useChatKeyboard } from \"./useChatKeyboard\";\nimport { useEndVisible } from \"./useEndVisible\";\nimport { useExtraContentPadding } from \"./useExtraContentPadding\";\n\nimport type { KeyboardChatScrollViewProps } from \"./types\";\nimport type { LayoutChangeEvent } from \"react-native\";\n\nconst ZERO_CONTENT_PADDING = makeMutable(0);\nconst ZERO_BLANK_SPACE = makeMutable(0);\n\nconst KeyboardChatScrollView = forwardRef<\n Reanimated.ScrollView,\n React.PropsWithChildren<KeyboardChatScrollViewProps>\n>(\n (\n {\n children,\n ScrollViewComponent = Reanimated.ScrollView,\n inverted = false,\n keyboardLiftBehavior = \"always\",\n freeze = false,\n offset = 0,\n extraContentPadding = ZERO_CONTENT_PADDING,\n blankSpace = ZERO_BLANK_SPACE,\n applyWorkaroundForContentInsetHitTestBug = false,\n onLayout: onLayoutProp,\n onContentSizeChange: onContentSizeChangeProp,\n onEndVisible,\n ...rest\n },\n ref,\n ) => {\n const scrollViewRef = useAnimatedRef<Reanimated.ScrollView>();\n const onRef = useCombinedRef(ref, scrollViewRef);\n const freezeSV = useDerivedValue(() =>\n typeof freeze === \"boolean\" ? freeze : freeze.value,\n );\n const {\n padding,\n currentHeight,\n contentOffsetY,\n scroll,\n layout,\n size,\n onLayout: onLayoutInternal,\n onContentSizeChange: onContentSizeChangeInternal,\n } = useChatKeyboard(scrollViewRef, {\n inverted,\n keyboardLiftBehavior,\n freeze: freezeSV,\n offset,\n blankSpace,\n extraContentPadding,\n });\n\n useExtraContentPadding({\n scrollViewRef,\n extraContentPadding,\n keyboardPadding: padding,\n blankSpace,\n scroll,\n layout,\n size,\n contentOffsetY,\n inverted,\n keyboardLiftBehavior,\n freeze: freezeSV,\n });\n\n useEndVisible({\n scroll,\n layout,\n size,\n inverted,\n onEndVisible,\n });\n\n // intentionally clamp `blankSpace` at one ScrollView viewport. The Android\n // `ClippingScrollView` workaround temporarily substitutes padding/range\n // during touch handling, and oversized blank ranges can de-sync during fast\n // momentum gestures. One viewport is enough for the short-content case;\n // larger values only allow scrolling to a fully blank screen which is not\n // the use case for this library. If you found this comment and it causes\n // a bug for you, please open an issue.\n const totalPadding = useDerivedValue(() =>\n Math.min(\n layout.value.height,\n Math.max(blankSpace.value, padding.value + extraContentPadding.value),\n ),\n );\n\n // Scroll indicator inset = keyboard + extraContentPadding (excludes blankSpace).\n // Apps that render into the unsafe area can supply a negative\n // scrollIndicatorInsets adjustment at the application layer.\n const indicatorPadding = useDerivedValue(\n () => padding.value + extraContentPadding.value,\n );\n\n const onLayout = useCallback(\n (e: LayoutChangeEvent) => {\n onLayoutInternal(e);\n onLayoutProp?.(e);\n },\n [onLayoutInternal, onLayoutProp],\n );\n\n const onContentSizeChange = useCallback(\n (w: number, h: number) => {\n onContentSizeChangeInternal(w, h);\n onContentSizeChangeProp?.(w, h);\n },\n [onContentSizeChangeInternal, onContentSizeChangeProp],\n );\n\n // Invisible view whose animated style changes every frame during keyboard\n // animation. On Fabric, this forces Reanimated to schedule a commit,\n // which flushes the scrollTo call in the same frame (fixing de-synchronization).\n // see https://github.com/software-mansion/react-native-reanimated/issues/9000\n const commitStyle = useAnimatedStyle(\n () => ({\n transform: [{ translateY: -currentHeight.value }],\n }),\n [],\n );\n const commit = useMemo(\n () => [styles.commitView, commitStyle],\n [commitStyle],\n );\n\n return (\n <>\n <ScrollViewWithBottomPadding\n ref={onRef}\n {...rest}\n applyWorkaroundForContentInsetHitTestBug={\n applyWorkaroundForContentInsetHitTestBug\n }\n bottomPadding={totalPadding}\n contentOffsetY={contentOffsetY}\n inverted={inverted}\n scrollIndicatorPadding={indicatorPadding}\n ScrollViewComponent={ScrollViewComponent}\n onContentSizeChange={onContentSizeChange}\n onLayout={onLayout}\n >\n {children}\n </ScrollViewWithBottomPadding>\n <Reanimated.View style={commit} />\n </>\n );\n },\n);\n\nconst styles = StyleSheet.create({\n commitView: {\n display: \"none\",\n position: \"absolute\",\n },\n});\n\nexport default KeyboardChatScrollView;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAH,uBAAA,CAAAC,OAAA;AAQA,IAAAG,eAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,4BAAA,GAAAD,sBAAA,CAAAJ,OAAA;AA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IAAAC,QAAA,GAAAC,OAAA,CAAA7F,OAAA,GAEY0B,sBAAsB","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeReanimated","_useCombinedRef","_interopRequireDefault","_ScrollViewWithBottomPadding","_useChatKeyboard","_useEndVisible","_useExtraContentPadding","_useFrozenPadding","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_extends","assign","bind","arguments","length","apply","ZERO_CONTENT_PADDING","makeMutable","ZERO_BLANK_SPACE","KeyboardChatScrollView","forwardRef","children","ScrollViewComponent","Reanimated","ScrollView","inverted","keyboardLiftBehavior","freeze","offset","extraContentPadding","blankSpace","applyWorkaroundForContentInsetHitTestBug","onLayout","onLayoutProp","onContentSizeChange","onContentSizeChangeProp","onEndVisible","rest","ref","scrollViewRef","useAnimatedRef","onRef","useCombinedRef","freezeSV","useDerivedValue","value","padding","currentHeight","contentOffsetY","scroll","layout","size","onLayoutInternal","onContentSizeChangeInternal","useChatKeyboard","useExtraContentPadding","keyboardPadding","useFrozenPadding","useEndVisible","totalPadding","Math","min","height","max","indicatorPadding","useCallback","w","h","commitStyle","useAnimatedStyle","transform","translateY","commit","useMemo","styles","commitView","createElement","Fragment","bottomPadding","scrollIndicatorPadding","View","style","StyleSheet","create","display","position","_default","exports"],"sources":["index.tsx"],"sourcesContent":["import React, { forwardRef, useCallback, useMemo } from \"react\";\nimport { StyleSheet } from \"react-native\";\nimport {\n makeMutable,\n useAnimatedRef,\n useAnimatedStyle,\n useDerivedValue,\n} from \"react-native-reanimated\";\nimport Reanimated from \"react-native-reanimated\";\n\nimport useCombinedRef from \"../hooks/useCombinedRef\";\nimport ScrollViewWithBottomPadding from \"../ScrollViewWithBottomPadding\";\n\nimport { useChatKeyboard } from \"./useChatKeyboard\";\nimport { useEndVisible } from \"./useEndVisible\";\nimport { useExtraContentPadding } from \"./useExtraContentPadding\";\nimport { useFrozenPadding } from \"./useFrozenPadding\";\n\nimport type { KeyboardChatScrollViewProps } from \"./types\";\nimport type { LayoutChangeEvent } from \"react-native\";\n\nconst ZERO_CONTENT_PADDING = makeMutable(0);\nconst ZERO_BLANK_SPACE = makeMutable(0);\n\nconst KeyboardChatScrollView = forwardRef<\n Reanimated.ScrollView,\n React.PropsWithChildren<KeyboardChatScrollViewProps>\n>(\n (\n {\n children,\n ScrollViewComponent = Reanimated.ScrollView,\n inverted = false,\n keyboardLiftBehavior = \"always\",\n freeze = false,\n offset = 0,\n extraContentPadding = ZERO_CONTENT_PADDING,\n blankSpace = ZERO_BLANK_SPACE,\n applyWorkaroundForContentInsetHitTestBug = false,\n onLayout: onLayoutProp,\n onContentSizeChange: onContentSizeChangeProp,\n onEndVisible,\n ...rest\n },\n ref,\n ) => {\n const scrollViewRef = useAnimatedRef<Reanimated.ScrollView>();\n const onRef = useCombinedRef(ref, scrollViewRef);\n const freezeSV = useDerivedValue(() =>\n typeof freeze === \"boolean\" ? freeze : freeze.value,\n );\n const {\n padding,\n currentHeight,\n contentOffsetY,\n scroll,\n layout,\n size,\n onLayout: onLayoutInternal,\n onContentSizeChange: onContentSizeChangeInternal,\n } = useChatKeyboard(scrollViewRef, {\n inverted,\n keyboardLiftBehavior,\n freeze: freezeSV,\n offset,\n blankSpace,\n extraContentPadding,\n });\n\n useExtraContentPadding({\n scrollViewRef,\n extraContentPadding,\n keyboardPadding: padding,\n blankSpace,\n scroll,\n layout,\n size,\n contentOffsetY,\n inverted,\n keyboardLiftBehavior,\n freeze: freezeSV,\n });\n\n useFrozenPadding({\n freeze: freezeSV,\n offset,\n padding,\n });\n\n useEndVisible({\n scroll,\n layout,\n size,\n inverted,\n onEndVisible,\n });\n\n // intentionally clamp `blankSpace` at one ScrollView viewport. The Android\n // `ClippingScrollView` workaround temporarily substitutes padding/range\n // during touch handling, and oversized blank ranges can de-sync during fast\n // momentum gestures. One viewport is enough for the short-content case;\n // larger values only allow scrolling to a fully blank screen which is not\n // the use case for this library. If you found this comment and it causes\n // a bug for you, please open an issue.\n const totalPadding = useDerivedValue(() =>\n Math.min(\n layout.value.height,\n Math.max(blankSpace.value, padding.value + extraContentPadding.value),\n ),\n );\n\n // Scroll indicator inset = keyboard + extraContentPadding (excludes blankSpace).\n // Apps that render into the unsafe area can supply a negative\n // scrollIndicatorInsets adjustment at the application layer.\n const indicatorPadding = useDerivedValue(\n () => padding.value + extraContentPadding.value,\n );\n\n const onLayout = useCallback(\n (e: LayoutChangeEvent) => {\n onLayoutInternal(e);\n onLayoutProp?.(e);\n },\n [onLayoutInternal, onLayoutProp],\n );\n\n const onContentSizeChange = useCallback(\n (w: number, h: number) => {\n onContentSizeChangeInternal(w, h);\n onContentSizeChangeProp?.(w, h);\n },\n [onContentSizeChangeInternal, onContentSizeChangeProp],\n );\n\n // Invisible view whose animated style changes every frame during keyboard\n // animation. On Fabric, this forces Reanimated to schedule a commit,\n // which flushes the scrollTo call in the same frame (fixing de-synchronization).\n // see https://github.com/software-mansion/react-native-reanimated/issues/9000\n const commitStyle = useAnimatedStyle(\n () => ({\n transform: [{ translateY: -currentHeight.value }],\n }),\n [],\n );\n const commit = useMemo(\n () => [styles.commitView, commitStyle],\n [commitStyle],\n );\n\n return (\n <>\n <ScrollViewWithBottomPadding\n ref={onRef}\n {...rest}\n applyWorkaroundForContentInsetHitTestBug={\n applyWorkaroundForContentInsetHitTestBug\n }\n bottomPadding={totalPadding}\n contentOffsetY={contentOffsetY}\n inverted={inverted}\n scrollIndicatorPadding={indicatorPadding}\n ScrollViewComponent={ScrollViewComponent}\n onContentSizeChange={onContentSizeChange}\n onLayout={onLayout}\n >\n {children}\n </ScrollViewWithBottomPadding>\n <Reanimated.View style={commit} />\n </>\n );\n },\n);\n\nconst styles = StyleSheet.create({\n commitView: {\n display: \"none\",\n position: \"absolute\",\n },\n});\n\nexport default KeyboardChatScrollView;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAC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AC0B,CAAC,eAC9B1C,MAAA,CAAAc,OAAA,CAAAmF,aAAA,CAAC7F,sBAAA,CAAAU,OAAU,CAACuF,IAAI;IAACC,KAAK,EAAET;EAAO,CAAE,CACjC,CAAC;AAEP,CACF,CAAC;AAED,MAAME,MAAM,GAAGQ,uBAAU,CAACC,MAAM,CAAC;EAC/BR,UAAU,EAAE;IACVS,OAAO,EAAE,MAAM;IACfC,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA9F,OAAA,GAEY0B,sBAAsB","ignoreList":[]}
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useFrozenPadding = useFrozenPadding;
7
+ var _reactNativeReanimated = require("react-native-reanimated");
8
+ var _hooks = require("../../../hooks");
9
+ var _helpers = require("../useChatKeyboard/helpers");
10
+ /**
11
+ * Hook that reconciles keyboard padding after a frozen interval.
12
+ *
13
+ * `useChatKeyboard` handlers skip all writes while `freeze` is enabled, so if
14
+ * the keyboard opens or closes during the frozen interval `padding` keeps a
15
+ * stale value (e.g. the open-keyboard height after a frozen dismissal). This
16
+ * hook observes keyboard events independently of `freeze` and recomputes the
17
+ * padding from the latest observed keyboard height as soon as `freeze`
18
+ * transitions back to `false`.
19
+ *
20
+ * @param options - Keyboard padding shared values plus the scroll view `offset`.
21
+ * @param options.freeze - When `true`, keyboard-driven layout writes are skipped.
22
+ * @param options.offset - The distance between the bottom of the screen and the `ScrollView`.
23
+ * @param options.padding - Keyboard-driven padding managed by `useChatKeyboard`.
24
+ * @example
25
+ * ```ts
26
+ * useFrozenPadding({ freeze, offset, padding });
27
+ * ```
28
+ */
29
+ function useFrozenPadding({
30
+ freeze,
31
+ offset,
32
+ padding
33
+ }) {
34
+ const lastHeight = (0, _reactNativeReanimated.useSharedValue)(0);
35
+ const targetKeyboardHeight = (0, _reactNativeReanimated.useSharedValue)(0);
36
+ (0, _hooks.useKeyboardHandler)({
37
+ onStart: e => {
38
+ "worklet";
39
+
40
+ if (e.height > 0) {
41
+ // eslint-disable-next-line react-compiler/react-compiler
42
+ targetKeyboardHeight.value = e.height;
43
+ }
44
+ },
45
+ onMove: e => {
46
+ "worklet";
47
+
48
+ lastHeight.value = e.height;
49
+ },
50
+ onEnd: e => {
51
+ "worklet";
52
+
53
+ lastHeight.value = e.height;
54
+ }
55
+ }, []);
56
+ (0, _reactNativeReanimated.useAnimatedReaction)(() => freeze.value, (isFrozen, wasFrozen) => {
57
+ if (!isFrozen && wasFrozen === true) {
58
+ padding.value = (0, _helpers.getEffectiveHeight)(lastHeight.value, targetKeyboardHeight.value, offset);
59
+ }
60
+ }, [offset]);
61
+ }
62
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNativeReanimated","require","_hooks","_helpers","useFrozenPadding","freeze","offset","padding","lastHeight","useSharedValue","targetKeyboardHeight","useKeyboardHandler","onStart","e","height","value","onMove","onEnd","useAnimatedReaction","isFrozen","wasFrozen","getEffectiveHeight"],"sources":["index.ts"],"sourcesContent":["import { useAnimatedReaction, useSharedValue } from \"react-native-reanimated\";\n\nimport { useKeyboardHandler } from \"../../../hooks\";\nimport { getEffectiveHeight } from \"../useChatKeyboard/helpers\";\n\nimport type { SharedValue } from \"react-native-reanimated\";\n\ntype UseFrozenPaddingOptions = {\n /** When `true`, keyboard-driven layout writes are skipped. */\n freeze: SharedValue<boolean>;\n /** The distance between the bottom of the screen and the `ScrollView`. */\n offset: number;\n /** Keyboard-driven padding managed by `useChatKeyboard`. */\n padding: SharedValue<number>;\n};\n\n/**\n * Hook that reconciles keyboard padding after a frozen interval.\n *\n * `useChatKeyboard` handlers skip all writes while `freeze` is enabled, so if\n * the keyboard opens or closes during the frozen interval `padding` keeps a\n * stale value (e.g. the open-keyboard height after a frozen dismissal). This\n * hook observes keyboard events independently of `freeze` and recomputes the\n * padding from the latest observed keyboard height as soon as `freeze`\n * transitions back to `false`.\n *\n * @param options - Keyboard padding shared values plus the scroll view `offset`.\n * @param options.freeze - When `true`, keyboard-driven layout writes are skipped.\n * @param options.offset - The distance between the bottom of the screen and the `ScrollView`.\n * @param options.padding - Keyboard-driven padding managed by `useChatKeyboard`.\n * @example\n * ```ts\n * useFrozenPadding({ freeze, offset, padding });\n * ```\n */\nfunction useFrozenPadding({\n freeze,\n offset,\n padding,\n}: UseFrozenPaddingOptions): void {\n const lastHeight = useSharedValue(0);\n const targetKeyboardHeight = useSharedValue(0);\n\n useKeyboardHandler(\n {\n onStart: (e) => {\n \"worklet\";\n\n if (e.height > 0) {\n // eslint-disable-next-line react-compiler/react-compiler\n targetKeyboardHeight.value = e.height;\n }\n },\n onMove: (e) => {\n \"worklet\";\n\n lastHeight.value = e.height;\n },\n onEnd: (e) => {\n \"worklet\";\n\n lastHeight.value = e.height;\n },\n },\n [],\n );\n\n useAnimatedReaction(\n () => freeze.value,\n (isFrozen, wasFrozen) => {\n if (!isFrozen && wasFrozen === true) {\n padding.value = getEffectiveHeight(\n lastHeight.value,\n targetKeyboardHeight.value,\n offset,\n );\n }\n },\n [offset],\n );\n}\n\nexport { useFrozenPadding };\n"],"mappings":";;;;;;AAAA,IAAAA,sBAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAaA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASG,gBAAgBA,CAAC;EACxBC,MAAM;EACNC,MAAM;EACNC;AACuB,CAAC,EAAQ;EAChC,MAAMC,UAAU,GAAG,IAAAC,qCAAc,EAAC,CAAC,CAAC;EACpC,MAAMC,oBAAoB,GAAG,IAAAD,qCAAc,EAAC,CAAC,CAAC;EAE9C,IAAAE,yBAAkB,EAChB;IACEC,OAAO,EAAGC,CAAC,IAAK;MACd,SAAS;;MAET,IAAIA,CAAC,CAACC,MAAM,GAAG,CAAC,EAAE;QAChB;QACAJ,oBAAoB,CAACK,KAAK,GAAGF,CAAC,CAACC,MAAM;MACvC;IACF,CAAC;IACDE,MAAM,EAAGH,CAAC,IAAK;MACb,SAAS;;MAETL,UAAU,CAACO,KAAK,GAAGF,CAAC,CAACC,MAAM;IAC7B,CAAC;IACDG,KAAK,EAAGJ,CAAC,IAAK;MACZ,SAAS;;MAETL,UAAU,CAACO,KAAK,GAAGF,CAAC,CAACC,MAAM;IAC7B;EACF,CAAC,EACD,EACF,CAAC;EAED,IAAAI,0CAAmB,EACjB,MAAMb,MAAM,CAACU,KAAK,EAClB,CAACI,QAAQ,EAAEC,SAAS,KAAK;IACvB,IAAI,CAACD,QAAQ,IAAIC,SAAS,KAAK,IAAI,EAAE;MACnCb,OAAO,CAACQ,KAAK,GAAG,IAAAM,2BAAkB,EAChCb,UAAU,CAACO,KAAK,EAChBL,oBAAoB,CAACK,KAAK,EAC1BT,MACF,CAAC;IACH;EACF,CAAC,EACD,CAACA,MAAM,CACT,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _reactNative = require("react-native");
9
+ var _constants = require("../../constants");
10
+ var _module = require("../../module");
11
+ var _KeyboardStickyView = _interopRequireDefault(require("../KeyboardStickyView"));
12
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
14
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
15
+ const translucentStack = [];
16
+ let currentTranslucent = false;
17
+ const applyTranslucent = () => {
18
+ const next = translucentStack.length > 0 ? translucentStack[translucentStack.length - 1].translucent : false;
19
+ if (next !== currentTranslucent) {
20
+ currentTranslucent = next;
21
+ _module.KeyboardController.setTranslucent(next);
22
+ }
23
+ };
24
+ const pushTranslucentEntry = entry => {
25
+ translucentStack.push(entry);
26
+ applyTranslucent();
27
+ };
28
+ const removeTranslucentEntry = entry => {
29
+ const index = translucentStack.indexOf(entry);
30
+ if (index !== -1) {
31
+ translucentStack.splice(index, 1);
32
+ }
33
+ applyTranslucent();
34
+ };
35
+ /**
36
+ * A component that renders content behind the keyboard. Since the keyboard
37
+ * is translucent, the content (colors, gradients, animations) will blend
38
+ * through and create visual effects on the keyboard.
39
+ *
40
+ * On iOS 26+ the keyboard has rounded corners, and the effect view
41
+ * automatically matches that shape.
42
+ *
43
+ * @returns A view component positioned behind the keyboard.
44
+ * @example
45
+ * ```tsx
46
+ * <KeyboardEffects>
47
+ * <View style={{ flex: 1, backgroundColor: "purple" }} />
48
+ * </KeyboardEffects>
49
+ * ```
50
+ */
51
+ const KeyboardEffects = /*#__PURE__*/(0, _react.forwardRef)(({
52
+ translucent,
53
+ children,
54
+ ...props
55
+ }, ref) => {
56
+ const stackEntry = (0, _react.useRef)({
57
+ translucent: Boolean(translucent)
58
+ }).current;
59
+ const containerStyle = (0, _react.useMemo)(() => [styles.container, _constants.KEYBOARD_HAS_ROUNDED_CORNERS && !translucent && styles.rounded], [translucent]);
60
+ (0, _react.useEffect)(() => {
61
+ pushTranslucentEntry(stackEntry);
62
+ return () => {
63
+ removeTranslucentEntry(stackEntry);
64
+ };
65
+ }, [stackEntry]);
66
+ (0, _react.useEffect)(() => {
67
+ stackEntry.translucent = Boolean(translucent);
68
+ applyTranslucent();
69
+ }, [stackEntry, translucent]);
70
+ return /*#__PURE__*/_react.default.createElement(_KeyboardStickyView.default, _extends({
71
+ ref: ref
72
+ }, props), /*#__PURE__*/_react.default.createElement(_reactNative.View, {
73
+ style: containerStyle
74
+ }, children));
75
+ });
76
+ const styles = _reactNative.StyleSheet.create({
77
+ container: {
78
+ position: "absolute",
79
+ bottom: 0,
80
+ top: 0,
81
+ left: 0,
82
+ right: 0,
83
+ height: 999
84
+ },
85
+ rounded: {
86
+ borderTopLeftRadius: _constants.KEYBOARD_BORDER_RADIUS,
87
+ borderTopRightRadius: _constants.KEYBOARD_BORDER_RADIUS,
88
+ overflow: "hidden"
89
+ }
90
+ });
91
+ var _default = exports.default = KeyboardEffects;
92
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_constants","_module","_KeyboardStickyView","_interopRequireDefault","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_extends","assign","bind","arguments","length","apply","translucentStack","currentTranslucent","applyTranslucent","next","translucent","KeyboardController","setTranslucent","pushTranslucentEntry","entry","push","removeTranslucentEntry","index","indexOf","splice","KeyboardEffects","forwardRef","children","props","ref","stackEntry","useRef","Boolean","current","containerStyle","useMemo","styles","container","KEYBOARD_HAS_ROUNDED_CORNERS","rounded","useEffect","createElement","View","style","StyleSheet","create","position","bottom","top","left","right","height","borderTopLeftRadius","KEYBOARD_BORDER_RADIUS","borderTopRightRadius","overflow","_default","exports"],"sources":["index.tsx"],"sourcesContent":["import React, { forwardRef, useEffect, useMemo, useRef } from \"react\";\nimport { StyleSheet, View } from \"react-native\";\n\nimport {\n KEYBOARD_BORDER_RADIUS,\n KEYBOARD_HAS_ROUNDED_CORNERS,\n} from \"../../constants\";\nimport { KeyboardController } from \"../../module\";\nimport KeyboardStickyView from \"../KeyboardStickyView\";\n\nimport type { KeyboardStickyViewProps } from \"../KeyboardStickyView\";\n\ntype TranslucentStackEntry = { translucent: boolean };\n\nconst translucentStack: TranslucentStackEntry[] = [];\nlet currentTranslucent = false;\n\nconst applyTranslucent = () => {\n const next =\n translucentStack.length > 0\n ? translucentStack[translucentStack.length - 1].translucent\n : false;\n\n if (next !== currentTranslucent) {\n currentTranslucent = next;\n KeyboardController.setTranslucent(next);\n }\n};\n\nconst pushTranslucentEntry = (entry: TranslucentStackEntry) => {\n translucentStack.push(entry);\n applyTranslucent();\n};\n\nconst removeTranslucentEntry = (entry: TranslucentStackEntry) => {\n const index = translucentStack.indexOf(entry);\n\n if (index !== -1) {\n translucentStack.splice(index, 1);\n }\n\n applyTranslucent();\n};\n\nexport type KeyboardEffectsProps = {\n /**\n * Whether the keyboard backdrop should be translucent.\n *\n * @default false\n */\n translucent?: boolean;\n} & KeyboardStickyViewProps;\n\n/**\n * A component that renders content behind the keyboard. Since the keyboard\n * is translucent, the content (colors, gradients, animations) will blend\n * through and create visual effects on the keyboard.\n *\n * On iOS 26+ the keyboard has rounded corners, and the effect view\n * automatically matches that shape.\n *\n * @returns A view component positioned behind the keyboard.\n * @example\n * ```tsx\n * <KeyboardEffects>\n * <View style={{ flex: 1, backgroundColor: \"purple\" }} />\n * </KeyboardEffects>\n * ```\n */\nconst KeyboardEffects = forwardRef<\n View,\n React.PropsWithChildren<KeyboardEffectsProps>\n>(({ translucent, children, ...props }, ref) => {\n const stackEntry = useRef<TranslucentStackEntry>({\n translucent: Boolean(translucent),\n }).current;\n const containerStyle = useMemo(\n () => [\n styles.container,\n KEYBOARD_HAS_ROUNDED_CORNERS && !translucent && styles.rounded,\n ],\n [translucent],\n );\n\n useEffect(() => {\n pushTranslucentEntry(stackEntry);\n\n return () => {\n removeTranslucentEntry(stackEntry);\n };\n }, [stackEntry]);\n\n useEffect(() => {\n stackEntry.translucent = Boolean(translucent);\n applyTranslucent();\n }, [stackEntry, translucent]);\n\n return (\n <KeyboardStickyView ref={ref} {...props}>\n <View style={containerStyle}>{children}</View>\n </KeyboardStickyView>\n );\n});\n\nconst styles = StyleSheet.create({\n container: {\n position: \"absolute\",\n bottom: 0,\n top: 0,\n left: 0,\n right: 0,\n height: 999,\n },\n rounded: {\n borderTopLeftRadius: KEYBOARD_BORDER_RADIUS,\n borderTopRightRadius: KEYBOARD_BORDER_RADIUS,\n overflow: \"hidden\",\n },\n});\n\nexport default KeyboardEffects;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,UAAA,GAAAF,OAAA;AAIA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,mBAAA,GAAAC,sBAAA,CAAAL,OAAA;AAAuD,SAAAK,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAP,wBAAAO,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAX,uBAAA,YAAAA,CAAAO,CAAA,EAAAG,CAAA,SAAAA,CAAA,IAAAH,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,MAAAO,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAR,OAAA,EAAAF,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAS,CAAA,MAAAF,CAAA,GAAAJ,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAE,CAAA,CAAAI,GAAA,CAAAX,CAAA,UAAAO,CAAA,CAAAK,GAAA,CAAAZ,CAAA,GAAAO,CAAA,CAAAM,GAAA,CAAAb,CAAA,EAAAS,CAAA,gBAAAN,CAAA,I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CAACzD,mBAAA,CAAAI,OAAkB,EAAAiB,QAAA;IAACwB,GAAG,EAAEA;EAAI,GAAKD,KAAK,gBACrClD,MAAA,CAAAU,OAAA,CAAAqD,aAAA,CAAC5D,YAAA,CAAA6D,IAAI;IAACC,KAAK,EAAET;EAAe,GAAEP,QAAe,CAC3B,CAAC;AAEzB,CAAC,CAAC;AAEF,MAAMS,MAAM,GAAGQ,uBAAU,CAACC,MAAM,CAAC;EAC/BR,SAAS,EAAE;IACTS,QAAQ,EAAE,UAAU;IACpBC,MAAM,EAAE,CAAC;IACTC,GAAG,EAAE,CAAC;IACNC,IAAI,EAAE,CAAC;IACPC,KAAK,EAAE,CAAC;IACRC,MAAM,EAAE;EACV,CAAC;EACDZ,OAAO,EAAE;IACPa,mBAAmB,EAAEC,iCAAsB;IAC3CC,oBAAoB,EAAED,iCAAsB;IAC5CE,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAArE,OAAA,GAEYqC,eAAe","ignoreList":[]}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS = exports.TEST_ID_KEYBOARD_TOOLBAR_NEXT = exports.TEST_ID_KEYBOARD_TOOLBAR_DONE = exports.TEST_ID_KEYBOARD_TOOLBAR_CONTENT = exports.TEST_ID_KEYBOARD_TOOLBAR = exports.OPENED_OFFSET = exports.KEYBOARD_TOOLBAR_HEIGHT = exports.KEYBOARD_HAS_ROUNDED_CORNERS = exports.DEFAULT_OPACITY = void 0;
6
+ exports.TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS = exports.TEST_ID_KEYBOARD_TOOLBAR_NEXT = exports.TEST_ID_KEYBOARD_TOOLBAR_DONE = exports.TEST_ID_KEYBOARD_TOOLBAR_CONTENT = exports.TEST_ID_KEYBOARD_TOOLBAR = exports.OPENED_OFFSET = exports.KEYBOARD_TOOLBAR_HEIGHT = exports.DEFAULT_OPACITY = void 0;
7
7
  var _constants = require("../../constants");
8
8
  const TEST_ID_KEYBOARD_TOOLBAR = exports.TEST_ID_KEYBOARD_TOOLBAR = "keyboard.toolbar";
9
9
  const TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS = exports.TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS = `${TEST_ID_KEYBOARD_TOOLBAR}.previous`;
@@ -12,6 +12,5 @@ const TEST_ID_KEYBOARD_TOOLBAR_CONTENT = exports.TEST_ID_KEYBOARD_TOOLBAR_CONTEN
12
12
  const TEST_ID_KEYBOARD_TOOLBAR_DONE = exports.TEST_ID_KEYBOARD_TOOLBAR_DONE = `${TEST_ID_KEYBOARD_TOOLBAR}.done`;
13
13
  const KEYBOARD_TOOLBAR_HEIGHT = exports.KEYBOARD_TOOLBAR_HEIGHT = 42;
14
14
  const DEFAULT_OPACITY = exports.DEFAULT_OPACITY = "FF";
15
- const KEYBOARD_HAS_ROUNDED_CORNERS = exports.KEYBOARD_HAS_ROUNDED_CORNERS = _constants.KEYBOARD_BORDER_RADIUS > 0;
16
- const OPENED_OFFSET = exports.OPENED_OFFSET = KEYBOARD_HAS_ROUNDED_CORNERS ? -11 : 0;
15
+ const OPENED_OFFSET = exports.OPENED_OFFSET = _constants.KEYBOARD_HAS_ROUNDED_CORNERS ? -11 : 0;
17
16
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_constants","require","TEST_ID_KEYBOARD_TOOLBAR","exports","TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS","TEST_ID_KEYBOARD_TOOLBAR_NEXT","TEST_ID_KEYBOARD_TOOLBAR_CONTENT","TEST_ID_KEYBOARD_TOOLBAR_DONE","KEYBOARD_TOOLBAR_HEIGHT","DEFAULT_OPACITY","KEYBOARD_HAS_ROUNDED_CORNERS","KEYBOARD_BORDER_RADIUS","OPENED_OFFSET"],"sources":["constants.ts"],"sourcesContent":["import { KEYBOARD_BORDER_RADIUS } from \"../../constants\";\n\nimport type { HEX } from \"./types\";\n\nexport const TEST_ID_KEYBOARD_TOOLBAR = \"keyboard.toolbar\";\nexport const TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS = `${TEST_ID_KEYBOARD_TOOLBAR}.previous`;\nexport const TEST_ID_KEYBOARD_TOOLBAR_NEXT = `${TEST_ID_KEYBOARD_TOOLBAR}.next`;\nexport const TEST_ID_KEYBOARD_TOOLBAR_CONTENT = `${TEST_ID_KEYBOARD_TOOLBAR}.content`;\nexport const TEST_ID_KEYBOARD_TOOLBAR_DONE = `${TEST_ID_KEYBOARD_TOOLBAR}.done`;\n\nexport const KEYBOARD_TOOLBAR_HEIGHT = 42;\nexport const DEFAULT_OPACITY: HEX = \"FF\";\nexport const KEYBOARD_HAS_ROUNDED_CORNERS = KEYBOARD_BORDER_RADIUS > 0;\nexport const OPENED_OFFSET = KEYBOARD_HAS_ROUNDED_CORNERS ? -11 : 0;\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAIO,MAAMC,wBAAwB,GAAAC,OAAA,CAAAD,wBAAA,GAAG,kBAAkB;AACnD,MAAME,iCAAiC,GAAAD,OAAA,CAAAC,iCAAA,GAAG,GAAGF,wBAAwB,WAAW;AAChF,MAAMG,6BAA6B,GAAAF,OAAA,CAAAE,6BAAA,GAAG,GAAGH,wBAAwB,OAAO;AACxE,MAAMI,gCAAgC,GAAAH,OAAA,CAAAG,gCAAA,GAAG,GAAGJ,wBAAwB,UAAU;AAC9E,MAAMK,6BAA6B,GAAAJ,OAAA,CAAAI,6BAAA,GAAG,GAAGL,wBAAwB,OAAO;AAExE,MAAMM,uBAAuB,GAAAL,OAAA,CAAAK,uBAAA,GAAG,EAAE;AAClC,MAAMC,eAAoB,GAAAN,OAAA,CAAAM,eAAA,GAAG,IAAI;AACjC,MAAMC,4BAA4B,GAAAP,OAAA,CAAAO,4BAAA,GAAGC,iCAAsB,GAAG,CAAC;AAC/D,MAAMC,aAAa,GAAAT,OAAA,CAAAS,aAAA,GAAGF,4BAA4B,GAAG,CAAC,EAAE,GAAG,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_constants","require","TEST_ID_KEYBOARD_TOOLBAR","exports","TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS","TEST_ID_KEYBOARD_TOOLBAR_NEXT","TEST_ID_KEYBOARD_TOOLBAR_CONTENT","TEST_ID_KEYBOARD_TOOLBAR_DONE","KEYBOARD_TOOLBAR_HEIGHT","DEFAULT_OPACITY","OPENED_OFFSET","KEYBOARD_HAS_ROUNDED_CORNERS"],"sources":["constants.ts"],"sourcesContent":["import { KEYBOARD_HAS_ROUNDED_CORNERS } from \"../../constants\";\n\nimport type { HEX } from \"./types\";\n\nexport const TEST_ID_KEYBOARD_TOOLBAR = \"keyboard.toolbar\";\nexport const TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS = `${TEST_ID_KEYBOARD_TOOLBAR}.previous`;\nexport const TEST_ID_KEYBOARD_TOOLBAR_NEXT = `${TEST_ID_KEYBOARD_TOOLBAR}.next`;\nexport const TEST_ID_KEYBOARD_TOOLBAR_CONTENT = `${TEST_ID_KEYBOARD_TOOLBAR}.content`;\nexport const TEST_ID_KEYBOARD_TOOLBAR_DONE = `${TEST_ID_KEYBOARD_TOOLBAR}.done`;\n\nexport const KEYBOARD_TOOLBAR_HEIGHT = 42;\nexport const DEFAULT_OPACITY: HEX = \"FF\";\nexport const OPENED_OFFSET = KEYBOARD_HAS_ROUNDED_CORNERS ? -11 : 0;\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAIO,MAAMC,wBAAwB,GAAAC,OAAA,CAAAD,wBAAA,GAAG,kBAAkB;AACnD,MAAME,iCAAiC,GAAAD,OAAA,CAAAC,iCAAA,GAAG,GAAGF,wBAAwB,WAAW;AAChF,MAAMG,6BAA6B,GAAAF,OAAA,CAAAE,6BAAA,GAAG,GAAGH,wBAAwB,OAAO;AACxE,MAAMI,gCAAgC,GAAAH,OAAA,CAAAG,gCAAA,GAAG,GAAGJ,wBAAwB,UAAU;AAC9E,MAAMK,6BAA6B,GAAAJ,OAAA,CAAAI,6BAAA,GAAG,GAAGL,wBAAwB,OAAO;AAExE,MAAMM,uBAAuB,GAAAL,OAAA,CAAAK,uBAAA,GAAG,EAAE;AAClC,MAAMC,eAAoB,GAAAN,OAAA,CAAAM,eAAA,GAAG,IAAI;AACjC,MAAMC,aAAa,GAAAP,OAAA,CAAAO,aAAA,GAAGC,uCAA4B,GAAG,CAAC,EAAE,GAAG,CAAC","ignoreList":[]}