react-native-keyboard-controller 1.11.2 → 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.
Files changed (129) hide show
  1. package/android/src/main/java/com/reactnativekeyboardcontroller/listeners/KeyboardAnimationCallback.kt +52 -60
  2. package/ios/KeyboardController.xcodeproj/project.pbxproj +4 -0
  3. package/ios/observers/KeyboardMovementObserver.swift +1 -25
  4. package/ios/traversal/KeyboardView.swift +36 -0
  5. package/lib/commonjs/animated.js +14 -12
  6. package/lib/commonjs/animated.js.map +1 -1
  7. package/lib/commonjs/bindings.js +5 -10
  8. package/lib/commonjs/bindings.js.map +1 -1
  9. package/lib/commonjs/bindings.native.js +7 -15
  10. package/lib/commonjs/bindings.native.js.map +1 -1
  11. package/lib/commonjs/components/KeyboardAvoidingView/hooks.js.map +1 -1
  12. package/lib/commonjs/components/KeyboardAvoidingView/index.js +16 -23
  13. package/lib/commonjs/components/KeyboardAvoidingView/index.js.map +1 -1
  14. package/lib/commonjs/components/KeyboardAwareScrollView/index.js +17 -19
  15. package/lib/commonjs/components/KeyboardAwareScrollView/index.js.map +1 -1
  16. package/lib/commonjs/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js +7 -7
  17. package/lib/commonjs/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js.map +1 -1
  18. package/lib/commonjs/components/KeyboardAwareScrollView/utils.js +3 -4
  19. package/lib/commonjs/components/KeyboardAwareScrollView/utils.js.map +1 -1
  20. package/lib/commonjs/components/KeyboardStickyView/index.js +15 -21
  21. package/lib/commonjs/components/KeyboardStickyView/index.js.map +1 -1
  22. package/lib/commonjs/components/KeyboardToolbar/Arrow.js +8 -10
  23. package/lib/commonjs/components/KeyboardToolbar/Arrow.js.map +1 -1
  24. package/lib/commonjs/components/KeyboardToolbar/Button.js +23 -26
  25. package/lib/commonjs/components/KeyboardToolbar/Button.js.map +1 -1
  26. package/lib/commonjs/components/KeyboardToolbar/colors.js +1 -2
  27. package/lib/commonjs/components/KeyboardToolbar/colors.js.map +1 -1
  28. package/lib/commonjs/components/KeyboardToolbar/colors.native.js +1 -2
  29. package/lib/commonjs/components/KeyboardToolbar/colors.native.js.map +1 -1
  30. package/lib/commonjs/components/KeyboardToolbar/index.js +13 -14
  31. package/lib/commonjs/components/KeyboardToolbar/index.js.map +1 -1
  32. package/lib/commonjs/components/KeyboardToolbar/types.js.map +1 -1
  33. package/lib/commonjs/components/hooks/useColorScheme.js +1 -2
  34. package/lib/commonjs/components/hooks/useColorScheme.js.map +1 -1
  35. package/lib/commonjs/components/index.js +2 -8
  36. package/lib/commonjs/components/index.js.map +1 -1
  37. package/lib/commonjs/constants.js +3 -4
  38. package/lib/commonjs/constants.js.map +1 -1
  39. package/lib/commonjs/context.js +1 -2
  40. package/lib/commonjs/context.js.map +1 -1
  41. package/lib/commonjs/hooks.js.map +1 -1
  42. package/lib/commonjs/index.js +1 -8
  43. package/lib/commonjs/index.js.map +1 -1
  44. package/lib/commonjs/internal.js +1 -1
  45. package/lib/commonjs/internal.js.map +1 -1
  46. package/lib/commonjs/monkey-patch.android.js +38 -26
  47. package/lib/commonjs/monkey-patch.android.js.map +1 -1
  48. package/lib/commonjs/monkey-patch.js +2 -4
  49. package/lib/commonjs/monkey-patch.js.map +1 -1
  50. package/lib/commonjs/reanimated.js +3 -6
  51. package/lib/commonjs/reanimated.js.map +1 -1
  52. package/lib/commonjs/reanimated.native.js.map +1 -1
  53. package/lib/commonjs/specs/KeyboardControllerViewNativeComponent.js +1 -2
  54. package/lib/commonjs/specs/KeyboardControllerViewNativeComponent.js.map +1 -1
  55. package/lib/commonjs/specs/KeyboardGestureAreaNativeComponent.js +1 -2
  56. package/lib/commonjs/specs/KeyboardGestureAreaNativeComponent.js.map +1 -1
  57. package/lib/commonjs/specs/NativeKeyboardController.js +1 -2
  58. package/lib/commonjs/specs/NativeKeyboardController.js.map +1 -1
  59. package/lib/commonjs/specs/NativeStatusBarManagerCompat.js +1 -2
  60. package/lib/commonjs/specs/NativeStatusBarManagerCompat.js.map +1 -1
  61. package/lib/commonjs/types.js.map +1 -1
  62. package/lib/commonjs/utils.js.map +1 -1
  63. package/lib/module/animated.js +12 -10
  64. package/lib/module/animated.js.map +1 -1
  65. package/lib/module/bindings.js.map +1 -1
  66. package/lib/module/bindings.native.js +3 -6
  67. package/lib/module/bindings.native.js.map +1 -1
  68. package/lib/module/components/KeyboardAvoidingView/hooks.js.map +1 -1
  69. package/lib/module/components/KeyboardAvoidingView/index.js +14 -19
  70. package/lib/module/components/KeyboardAvoidingView/index.js.map +1 -1
  71. package/lib/module/components/KeyboardAwareScrollView/index.js +15 -16
  72. package/lib/module/components/KeyboardAwareScrollView/index.js.map +1 -1
  73. package/lib/module/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js +7 -7
  74. package/lib/module/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js.map +1 -1
  75. package/lib/module/components/KeyboardAwareScrollView/utils.js +3 -4
  76. package/lib/module/components/KeyboardAwareScrollView/utils.js.map +1 -1
  77. package/lib/module/components/KeyboardStickyView/index.js +13 -17
  78. package/lib/module/components/KeyboardStickyView/index.js.map +1 -1
  79. package/lib/module/components/KeyboardToolbar/Arrow.js +5 -6
  80. package/lib/module/components/KeyboardToolbar/Arrow.js.map +1 -1
  81. package/lib/module/components/KeyboardToolbar/Button.js +20 -22
  82. package/lib/module/components/KeyboardToolbar/Button.js.map +1 -1
  83. package/lib/module/components/KeyboardToolbar/colors.js.map +1 -1
  84. package/lib/module/components/KeyboardToolbar/colors.native.js.map +1 -1
  85. package/lib/module/components/KeyboardToolbar/index.js +10 -10
  86. package/lib/module/components/KeyboardToolbar/index.js.map +1 -1
  87. package/lib/module/components/KeyboardToolbar/types.js.map +1 -1
  88. package/lib/module/components/hooks/useColorScheme.js.map +1 -1
  89. package/lib/module/components/index.js +1 -1
  90. package/lib/module/components/index.js.map +1 -1
  91. package/lib/module/constants.js +3 -3
  92. package/lib/module/constants.js.map +1 -1
  93. package/lib/module/context.js.map +1 -1
  94. package/lib/module/hooks.js.map +1 -1
  95. package/lib/module/index.js +1 -1
  96. package/lib/module/index.js.map +1 -1
  97. package/lib/module/internal.js +1 -1
  98. package/lib/module/internal.js.map +1 -1
  99. package/lib/module/monkey-patch.android.js +36 -24
  100. package/lib/module/monkey-patch.android.js.map +1 -1
  101. package/lib/module/monkey-patch.js.map +1 -1
  102. package/lib/module/reanimated.js.map +1 -1
  103. package/lib/module/reanimated.native.js.map +1 -1
  104. package/lib/module/specs/KeyboardControllerViewNativeComponent.js.map +1 -1
  105. package/lib/module/specs/KeyboardGestureAreaNativeComponent.js.map +1 -1
  106. package/lib/module/specs/NativeKeyboardController.js.map +1 -1
  107. package/lib/module/specs/NativeStatusBarManagerCompat.js.map +1 -1
  108. package/lib/module/types.js.map +1 -1
  109. package/lib/module/utils.js.map +1 -1
  110. package/lib/typescript/animated.d.ts +1 -1
  111. package/lib/typescript/components/KeyboardToolbar/Button.d.ts +1 -1
  112. package/lib/typescript/components/KeyboardToolbar/index.d.ts +5 -0
  113. package/lib/typescript/components/index.d.ts +2 -1
  114. package/lib/typescript/index.d.ts +2 -1
  115. package/package.json +7 -7
  116. package/src/animated.tsx +7 -3
  117. package/src/components/KeyboardAvoidingView/index.tsx +7 -8
  118. package/src/components/KeyboardAwareScrollView/index.tsx +4 -4
  119. package/src/components/KeyboardStickyView/index.tsx +6 -6
  120. package/src/components/KeyboardToolbar/index.tsx +38 -20
  121. package/src/components/index.ts +1 -1
  122. package/src/index.ts +1 -1
  123. package/src/monkey-patch.android.ts +31 -26
  124. package/lib/commonjs/components/hooks/useKeyboardInterpolation.js +0 -89
  125. package/lib/commonjs/components/hooks/useKeyboardInterpolation.js.map +0 -1
  126. package/lib/module/components/hooks/useKeyboardInterpolation.js +0 -82
  127. package/lib/module/components/hooks/useKeyboardInterpolation.js.map +0 -1
  128. package/lib/typescript/components/hooks/useKeyboardInterpolation.d.ts +0 -20
  129. package/src/components/hooks/useKeyboardInterpolation.ts +0 -109
@@ -1,11 +1,9 @@
1
1
  package com.reactnativekeyboardcontroller.listeners
2
2
 
3
- import android.animation.ValueAnimator
4
3
  import android.os.Build
5
4
  import android.util.Log
6
5
  import android.view.View
7
6
  import android.view.ViewTreeObserver.OnGlobalFocusChangeListener
8
- import androidx.core.animation.doOnEnd
9
7
  import androidx.core.graphics.Insets
10
8
  import androidx.core.view.OnApplyWindowInsetsListener
11
9
  import androidx.core.view.ViewCompat
@@ -26,6 +24,7 @@ import com.reactnativekeyboardcontroller.interactive.InteractiveKeyboardProvider
26
24
  import kotlin.math.abs
27
25
 
28
26
  private val TAG = KeyboardAnimationCallback::class.qualifiedName
27
+ private val isResizeHandledInCallbackMethods = Build.VERSION.SDK_INT < Build.VERSION_CODES.R
29
28
 
30
29
  class KeyboardAnimationCallback(
31
30
  val view: ReactViewGroup,
@@ -38,11 +37,12 @@ class KeyboardAnimationCallback(
38
37
 
39
38
  // state variables
40
39
  private var persistentKeyboardHeight = 0.0
40
+ private var prevKeyboardHeight = 0.0
41
41
  private var isKeyboardVisible = false
42
42
  private var isTransitioning = false
43
43
  private var duration = 0
44
44
  private var viewTagFocused = -1
45
- private var animation: ValueAnimator? = null
45
+ private var animationsToSkip = hashSetOf<WindowInsetsAnimationCompat>()
46
46
 
47
47
  // listeners
48
48
  private val focusListener = OnGlobalFocusChangeListener { oldFocus, newFocus ->
@@ -130,7 +130,7 @@ class KeyboardAnimationCallback(
130
130
  // in this method
131
131
  val isKeyboardSizeEqual = this.persistentKeyboardHeight == keyboardHeight
132
132
 
133
- if (isKeyboardFullyVisible && !isKeyboardSizeEqual && Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
133
+ if (isKeyboardFullyVisible && !isKeyboardSizeEqual && !isResizeHandledInCallbackMethods) {
134
134
  Log.i(TAG, "onApplyWindowInsets: ${this.persistentKeyboardHeight} -> $keyboardHeight")
135
135
  layoutObserver?.syncUpLayout()
136
136
  this.onKeyboardResized(keyboardHeight)
@@ -139,6 +139,7 @@ class KeyboardAnimationCallback(
139
139
  return insets
140
140
  }
141
141
 
142
+ @Suppress("detekt:ReturnCount")
142
143
  override fun onStart(
143
144
  animation: WindowInsetsAnimationCompat,
144
145
  bounds: WindowInsetsAnimationCompat.BoundsCompat,
@@ -158,6 +159,18 @@ class KeyboardAnimationCallback(
158
159
  }
159
160
 
160
161
  layoutObserver?.syncUpLayout()
162
+
163
+ // keyboard gets resized - we do not want to have a default animated transition
164
+ // so we skip these animations
165
+ val isKeyboardResized = keyboardHeight != 0.0 && prevKeyboardHeight != keyboardHeight
166
+ val isKeyboardShown = isKeyboardVisible && prevKeyboardHeight != 0.0
167
+ if (isKeyboardResized && isKeyboardShown && isResizeHandledInCallbackMethods) {
168
+ onKeyboardResized(keyboardHeight)
169
+ animationsToSkip.add(animation)
170
+
171
+ return bounds
172
+ }
173
+
161
174
  context.emitEvent(
162
175
  "KeyboardController::" + if (!isKeyboardVisible) "keyboardWillHide" else "keyboardWillShow",
163
176
  getEventParams(keyboardHeight),
@@ -186,8 +199,8 @@ class KeyboardAnimationCallback(
186
199
  ): WindowInsetsCompat {
187
200
  // onProgress() is called when any of the running animations progress...
188
201
 
189
- // ignore non-keyboard animation
190
- runningAnimations.find { it.isKeyboardAnimation } ?: return insets
202
+ // ignore non-keyboard animation or animation that we intentionally want to skip
203
+ runningAnimations.find { it.isKeyboardAnimation && !animationsToSkip.contains(it) } ?: return insets
191
204
 
192
205
  // First we get the insets which are potentially deferred
193
206
  val typesInset = insets.getInsets(deferredInsetTypes)
@@ -254,6 +267,13 @@ class KeyboardAnimationCallback(
254
267
  InteractiveKeyboardProvider.shown = false
255
268
  }
256
269
  isKeyboardVisible = isKeyboardVisible || isKeyboardShown
270
+ prevKeyboardHeight = keyboardHeight
271
+
272
+ if (animation in animationsToSkip) {
273
+ duration = 0
274
+ animationsToSkip.remove(animation)
275
+ return
276
+ }
257
277
 
258
278
  context.emitEvent(
259
279
  "KeyboardController::" + if (!isKeyboardVisible) "keyboardDidHide" else "keyboardDidShow",
@@ -282,22 +302,10 @@ class KeyboardAnimationCallback(
282
302
  }
283
303
 
284
304
  /*
285
- * In the method below we recreate the logic that used when keyboard appear/disappear:
286
- * - we dispatch `keyboardWillShow` (onStart);
287
- * - we dispatch change height/progress as animated values (onProgress);
288
- * - we dispatch `keyboardDidShow` (onEnd).
305
+ * Method that dispatches necessary events when keyboard gets resized
289
306
  */
290
307
  private fun onKeyboardResized(keyboardHeight: Double) {
291
- if (this.animation?.isRunning == true) {
292
- Log.i(TAG, "onKeyboardResized -> cancelling animation that is in progress")
293
- // if animation is in progress, then we are:
294
- // - removing listeners (update, onEnd)
295
- // - updating `persistentKeyboardHeight` to latest animated value
296
- // - cancelling animation to free up CPU resources
297
- this.animation?.removeAllListeners()
298
- this.persistentKeyboardHeight = (this.animation?.animatedValue as Float).toDouble()
299
- this.animation?.cancel()
300
- }
308
+ duration = 0
301
309
 
302
310
  context.emitEvent("KeyboardController::keyboardWillShow", getEventParams(keyboardHeight))
303
311
  context.dispatchEvent(
@@ -308,48 +316,36 @@ class KeyboardAnimationCallback(
308
316
  "topKeyboardMoveStart",
309
317
  keyboardHeight,
310
318
  1.0,
311
- DEFAULT_ANIMATION_TIME,
319
+ 0,
312
320
  viewTagFocused,
313
321
  ),
314
322
  )
315
-
316
- val animation =
317
- ValueAnimator.ofFloat(this.persistentKeyboardHeight.toFloat(), keyboardHeight.toFloat())
318
- animation.addUpdateListener { animator ->
319
- val toValue = animator.animatedValue as Float
320
- context.dispatchEvent(
323
+ context.dispatchEvent(
324
+ view.id,
325
+ KeyboardTransitionEvent(
326
+ surfaceId,
321
327
  view.id,
322
- KeyboardTransitionEvent(
323
- surfaceId,
324
- view.id,
325
- "topKeyboardMove",
326
- toValue.toDouble(),
327
- toValue.toDouble() / keyboardHeight,
328
- DEFAULT_ANIMATION_TIME,
329
- viewTagFocused,
330
- ),
331
- )
332
- }
333
- animation.doOnEnd {
334
- context.emitEvent("KeyboardController::keyboardDidShow", getEventParams(keyboardHeight))
335
- context.dispatchEvent(
328
+ "topKeyboardMove",
329
+ keyboardHeight,
330
+ 1.0,
331
+ 0,
332
+ viewTagFocused,
333
+ ),
334
+ )
335
+ context.dispatchEvent(
336
+ view.id,
337
+ KeyboardTransitionEvent(
338
+ surfaceId,
336
339
  view.id,
337
- KeyboardTransitionEvent(
338
- surfaceId,
339
- view.id,
340
- "topKeyboardMoveEnd",
341
- keyboardHeight,
342
- 1.0,
343
- DEFAULT_ANIMATION_TIME,
344
- viewTagFocused,
345
- ),
346
- )
347
- this.animation = null
348
- }
349
- animation.setDuration(DEFAULT_ANIMATION_TIME.toLong()).startDelay = 0
350
- animation.start()
340
+ "topKeyboardMoveEnd",
341
+ keyboardHeight,
342
+ 1.0,
343
+ 0,
344
+ viewTagFocused,
345
+ ),
346
+ )
347
+ context.emitEvent("KeyboardController::keyboardDidShow", getEventParams(keyboardHeight))
351
348
 
352
- this.animation = animation
353
349
  this.persistentKeyboardHeight = keyboardHeight
354
350
  }
355
351
 
@@ -377,8 +373,4 @@ class KeyboardAnimationCallback(
377
373
 
378
374
  return params
379
375
  }
380
-
381
- companion object {
382
- private const val DEFAULT_ANIMATION_TIME = 250
383
- }
384
376
  }
@@ -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 = findKeyboardView()
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
+ }
@@ -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(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
16
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
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
- const KeyboardProvider = _ref => {
28
- let {
29
- children,
30
- statusBarTranslucent,
31
- navigationBarTranslucent,
32
- enabled: initiallyEnabled = true
33
- } = _ref;
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(_reactNative.Platform.OS)) {
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: _reactNative.Platform.OS === "ios" ? onKeyboardMove : undefined,
142
- onKeyboardMove: _reactNative.Platform.OS === "android" ? onKeyboardMove : undefined,
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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AiB,EAAC,CAAC;IACrB;EACF,CAAC,EAAE,CAAClD,OAAO,CAAC,CAAC;EAEb,oBACElD,MAAA,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,C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7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
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.KeyboardController = KeyboardController;
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.KeyboardEvents = KeyboardEvents;
28
- const FocusedInputEvents = {
26
+ const FocusedInputEvents = exports.FocusedInputEvents = {
29
27
  addListener: () => ({
30
28
  remove: NOOP
31
29
  })
32
30
  };
33
- exports.FocusedInputEvents = FocusedInputEvents;
34
- const KeyboardControllerView = _reactNative.View;
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","exports","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,GAAG;EAC1DC,cAAc,EAAEF,IAAI;EACpBG,YAAY,EAAEH,IAAI;EAClBI,OAAO,EAAEJ,IAAI;EACbK,UAAU,EAAEL,IAAI;EAChBM,WAAW,EAAEN,IAAI;EACjBO,eAAe,EAAEP;AACnB,CAAC;AAACQ,OAAA,CAAAP,kBAAA,GAAAA,kBAAA;AACK,MAAMQ,cAAoC,GAAG;EAClDH,WAAW,EAAEA,CAAA,MAAO;IAAEI,MAAM,EAAEV;EAAK,CAAC;AACtC,CAAC;AACD;AACA;AACA;AACA;AAHAQ,OAAA,CAAAC,cAAA,GAAAA,cAAA;AAIO,MAAME,kBAA4C,GAAG;EAC1DL,WAAW,EAAEA,CAAA,MAAO;IAAEI,MAAM,EAAEV;EAAK,CAAC;AACtC,CAAC;AAACQ,OAAA,CAAAG,kBAAA,GAAAA,kBAAA;AACK,MAAMC,sBAAsB,GACjCC,iBAAoD;AAACL,OAAA,CAAAI,sBAAA,GAAAA,sBAAA;AAChD,MAAME,mBAAmB,GAC9BD,iBAAqD;AAACL,OAAA,CAAAM,mBAAA,GAAAA,mBAAA"}
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.KeyboardEvents = KeyboardEvents;
29
- const FocusedInputEvents = {
27
+ const FocusedInputEvents = exports.FocusedInputEvents = {
30
28
  addListener: (name, cb) => eventEmitter.addListener(KEYBOARD_CONTROLLER_NAMESPACE + name, cb)
31
29
  };
32
- exports.FocusedInputEvents = FocusedInputEvents;
33
- const KeyboardControllerView = require("./specs/KeyboardControllerViewNativeComponent").default;
34
- exports.KeyboardControllerView = KeyboardControllerView;
35
- const KeyboardGestureArea = _reactNative.Platform.OS === "android" && _reactNative.Platform.Version >= 30 ? require("./specs/KeyboardGestureAreaNativeComponent").default : _ref => {
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","exports","KEYBOARD_CONTROLLER_NAMESPACE","eventEmitter","NativeEventEmitter","KeyboardEvents","addListener","name","cb","FocusedInputEvents","KeyboardControllerView","KeyboardGestureArea","OS","Version","_ref","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,GAC7BD,qBAAqB,GACjBA,qBAAqB,GACrB,IAAIE,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACT,aAAa,CAAC;EAChC;AACF,CACF,CACuB;AAACU,OAAA,CAAAJ,kBAAA,GAAAA,kBAAA;AAE9B,MAAMK,6BAA6B,GAAG,sBAAsB;AAC5D,MAAMC,YAAY,GAAG,IAAIC,+BAAkB,CAACP,kBAAkB,CAAC;AAExD,MAAMQ,cAAoC,GAAG;EAClDC,WAAW,EAAEA,CAACC,IAAI,EAAEC,EAAE,KACpBL,YAAY,CAACG,WAAW,CAACJ,6BAA6B,GAAGK,IAAI,EAAEC,EAAE;AACrE,CAAC;AACD;AACA;AACA;AACA;AAHAP,OAAA,CAAAI,cAAA,GAAAA,cAAA;AAIO,MAAMI,kBAA4C,GAAG;EAC1DH,WAAW,EAAEA,CAACC,IAAI,EAAEC,EAAE,KACpBL,YAAY,CAACG,WAAW,CAACJ,6BAA6B,GAAGK,IAAI,EAAEC,EAAE;AACrE,CAAC;AAACP,OAAA,CAAAQ,kBAAA,GAAAA,kBAAA;AACK,MAAMC,sBAAyD,GACpEpB,OAAO,CAAC,+CAA+C,CAAC,CAACK,OAAO;AAACM,OAAA,CAAAS,sBAAA,GAAAA,sBAAA;AAC5D,MAAMC,mBAAuD,GAClEnB,qBAAQ,CAACoB,EAAE,KAAK,SAAS,IAAIpB,qBAAQ,CAACqB,OAAO,IAAI,EAAE,GAC/CvB,OAAO,CAAC,4CAA4C,CAAC,CAACK,OAAO,GAC7DmB,IAAA;EAAA,IAAC;IAAEC;EAAmC,CAAC,GAAAD,IAAA;EAAA,OAAKC,QAAQ;AAAA;AAACd,OAAA,CAAAU,mBAAA,GAAAA,mBAAA"}
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, 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,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