react-native-keyboard-controller 1.18.5 → 1.19.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 (108) hide show
  1. package/android/src/fabric/java/com/reactnativekeyboardcontroller/KeyboardControllerModule.kt +5 -2
  2. package/android/src/main/java/com/reactnativekeyboardcontroller/extensions/EditText.kt +8 -1
  3. package/android/src/main/java/com/reactnativekeyboardcontroller/extensions/View.kt +52 -8
  4. package/android/src/main/java/com/reactnativekeyboardcontroller/modules/KeyboardControllerModuleImpl.kt +25 -5
  5. package/android/src/main/java/com/reactnativekeyboardcontroller/modules/statusbar/StatusBarManagerCompatModuleImpl.kt +31 -29
  6. package/android/src/main/java/com/reactnativekeyboardcontroller/views/EdgeToEdgeReactViewGroup.kt +5 -8
  7. package/android/src/main/java/com/reactnativekeyboardcontroller/views/KeyboardGestureAreaReactViewGroup.kt +6 -7
  8. package/android/src/paper/java/com/reactnativekeyboardcontroller/KeyboardControllerModule.kt +5 -2
  9. package/android/src/paper/java/com/reactnativekeyboardcontroller/StatusBarManagerCompatModule.kt +0 -3
  10. package/ios/KeyboardControllerModule.mm +3 -3
  11. package/ios/KeyboardControllerModuleImpl.swift +26 -16
  12. package/ios/views/KeyboardControllerView.mm +6 -1
  13. package/ios/views/KeyboardControllerViewManager.swift +2 -1
  14. package/ios/views/KeyboardExtenderManager.mm +1 -2
  15. package/jest/index.js +17 -0
  16. package/lib/commonjs/animated.js +1 -2
  17. package/lib/commonjs/animated.js.map +1 -1
  18. package/lib/commonjs/components/KeyboardAvoidingView/index.js +1 -2
  19. package/lib/commonjs/components/KeyboardAvoidingView/index.js.map +1 -1
  20. package/lib/commonjs/components/KeyboardAwareScrollView/index.js +1 -2
  21. package/lib/commonjs/components/KeyboardAwareScrollView/index.js.map +1 -1
  22. package/lib/commonjs/components/KeyboardStickyView/index.js +1 -2
  23. package/lib/commonjs/components/KeyboardStickyView/index.js.map +1 -1
  24. package/lib/commonjs/components/KeyboardToolbar/Arrow.js +1 -2
  25. package/lib/commonjs/components/KeyboardToolbar/Arrow.js.map +1 -1
  26. package/lib/commonjs/components/KeyboardToolbar/Button.js +1 -2
  27. package/lib/commonjs/components/KeyboardToolbar/Button.js.map +1 -1
  28. package/lib/commonjs/components/KeyboardToolbar/compound/components/Background.js +13 -0
  29. package/lib/commonjs/components/KeyboardToolbar/compound/components/Background.js.map +1 -0
  30. package/lib/commonjs/components/KeyboardToolbar/compound/components/Content.js +25 -0
  31. package/lib/commonjs/components/KeyboardToolbar/compound/components/Content.js.map +1 -0
  32. package/lib/commonjs/components/KeyboardToolbar/compound/components/Done.js +61 -0
  33. package/lib/commonjs/components/KeyboardToolbar/compound/components/Done.js.map +1 -0
  34. package/lib/commonjs/components/KeyboardToolbar/compound/components/Next.js +52 -0
  35. package/lib/commonjs/components/KeyboardToolbar/compound/components/Next.js.map +1 -0
  36. package/lib/commonjs/components/KeyboardToolbar/compound/components/Prev.js +52 -0
  37. package/lib/commonjs/components/KeyboardToolbar/compound/components/Prev.js.map +1 -0
  38. package/lib/commonjs/components/KeyboardToolbar/compound/components/index.js +42 -0
  39. package/lib/commonjs/components/KeyboardToolbar/compound/components/index.js.map +1 -0
  40. package/lib/commonjs/components/KeyboardToolbar/compound/components/types.js +6 -0
  41. package/lib/commonjs/components/KeyboardToolbar/compound/components/types.js.map +1 -0
  42. package/lib/commonjs/components/KeyboardToolbar/compound/context.js +17 -0
  43. package/lib/commonjs/components/KeyboardToolbar/compound/context.js.map +1 -0
  44. package/lib/commonjs/components/KeyboardToolbar/index.js +76 -78
  45. package/lib/commonjs/components/KeyboardToolbar/index.js.map +1 -1
  46. package/lib/commonjs/components/KeyboardToolbar/types.js.map +1 -1
  47. package/lib/commonjs/components/index.js +1 -2
  48. package/lib/commonjs/components/index.js.map +1 -1
  49. package/lib/commonjs/hooks/useWindowDimensions/index.js +3 -3
  50. package/lib/commonjs/hooks/useWindowDimensions/index.js.map +1 -1
  51. package/lib/commonjs/module.js +2 -1
  52. package/lib/commonjs/module.js.map +1 -1
  53. package/lib/commonjs/specs/NativeKeyboardController.js.map +1 -1
  54. package/lib/commonjs/types/module.js.map +1 -1
  55. package/lib/commonjs/views/OverKeyboardView/index.js +1 -2
  56. package/lib/commonjs/views/OverKeyboardView/index.js.map +1 -1
  57. package/lib/module/components/KeyboardToolbar/compound/components/Background.js +6 -0
  58. package/lib/module/components/KeyboardToolbar/compound/components/Background.js.map +1 -0
  59. package/lib/module/components/KeyboardToolbar/compound/components/Content.js +18 -0
  60. package/lib/module/components/KeyboardToolbar/compound/components/Content.js.map +1 -0
  61. package/lib/module/components/KeyboardToolbar/compound/components/Done.js +54 -0
  62. package/lib/module/components/KeyboardToolbar/compound/components/Done.js.map +1 -0
  63. package/lib/module/components/KeyboardToolbar/compound/components/Next.js +44 -0
  64. package/lib/module/components/KeyboardToolbar/compound/components/Next.js.map +1 -0
  65. package/lib/module/components/KeyboardToolbar/compound/components/Prev.js +45 -0
  66. package/lib/module/components/KeyboardToolbar/compound/components/Prev.js.map +1 -0
  67. package/lib/module/components/KeyboardToolbar/compound/components/index.js +6 -0
  68. package/lib/module/components/KeyboardToolbar/compound/components/index.js.map +1 -0
  69. package/lib/module/components/KeyboardToolbar/compound/components/types.js +2 -0
  70. package/lib/module/components/KeyboardToolbar/compound/components/types.js.map +1 -0
  71. package/lib/module/components/KeyboardToolbar/compound/context.js +10 -0
  72. package/lib/module/components/KeyboardToolbar/compound/context.js.map +1 -0
  73. package/lib/module/components/KeyboardToolbar/index.js +78 -79
  74. package/lib/module/components/KeyboardToolbar/index.js.map +1 -1
  75. package/lib/module/components/KeyboardToolbar/types.js.map +1 -1
  76. package/lib/module/hooks/useWindowDimensions/index.js +3 -3
  77. package/lib/module/hooks/useWindowDimensions/index.js.map +1 -1
  78. package/lib/module/module.js +2 -1
  79. package/lib/module/module.js.map +1 -1
  80. package/lib/module/specs/NativeKeyboardController.js.map +1 -1
  81. package/lib/module/types/module.js.map +1 -1
  82. package/lib/typescript/components/KeyboardToolbar/compound/components/Background.d.ts +6 -0
  83. package/lib/typescript/components/KeyboardToolbar/compound/components/Content.d.ts +7 -0
  84. package/lib/typescript/components/KeyboardToolbar/compound/components/Done.d.ts +7 -0
  85. package/lib/typescript/components/KeyboardToolbar/compound/components/Next.d.ts +4 -0
  86. package/lib/typescript/components/KeyboardToolbar/compound/components/Prev.d.ts +4 -0
  87. package/lib/typescript/components/KeyboardToolbar/compound/components/index.d.ts +5 -0
  88. package/lib/typescript/components/KeyboardToolbar/compound/components/types.d.ts +14 -0
  89. package/lib/typescript/components/KeyboardToolbar/compound/context.d.ts +9 -0
  90. package/lib/typescript/components/KeyboardToolbar/index.d.ts +13 -54
  91. package/lib/typescript/components/KeyboardToolbar/types.d.ts +92 -5
  92. package/lib/typescript/specs/NativeKeyboardController.d.ts +1 -1
  93. package/lib/typescript/types/module.d.ts +5 -1
  94. package/package.json +5 -5
  95. package/src/components/KeyboardToolbar/compound/components/Background.tsx +9 -0
  96. package/src/components/KeyboardToolbar/compound/components/Content.tsx +25 -0
  97. package/src/components/KeyboardToolbar/compound/components/Done.tsx +70 -0
  98. package/src/components/KeyboardToolbar/compound/components/Next.tsx +55 -0
  99. package/src/components/KeyboardToolbar/compound/components/Prev.tsx +56 -0
  100. package/src/components/KeyboardToolbar/compound/components/index.ts +5 -0
  101. package/src/components/KeyboardToolbar/compound/components/types.ts +15 -0
  102. package/src/components/KeyboardToolbar/compound/context.ts +25 -0
  103. package/src/components/KeyboardToolbar/index.tsx +105 -165
  104. package/src/components/KeyboardToolbar/types.ts +101 -5
  105. package/src/hooks/useWindowDimensions/index.ts +3 -3
  106. package/src/module.ts +3 -2
  107. package/src/specs/NativeKeyboardController.ts +1 -1
  108. package/src/types/module.ts +5 -1
@@ -22,8 +22,11 @@ class KeyboardControllerModule(
22
22
  module.preload()
23
23
  }
24
24
 
25
- override fun dismiss(keepFocus: Boolean) {
26
- module.dismiss(keepFocus)
25
+ override fun dismiss(
26
+ keepFocus: Boolean,
27
+ animated: Boolean,
28
+ ) {
29
+ module.dismiss(keepFocus, animated)
27
30
  }
28
31
 
29
32
  override fun setFocusTo(direction: String) {
@@ -78,7 +78,14 @@ fun EditText.addOnTextChangedListener(action: (String) -> Unit): TextWatcher {
78
78
  } catch (e: ClassCastException) {
79
79
  Logger.w(javaClass.simpleName, "Can not attach listener because casting failed: ${e.message}")
80
80
  } catch (e: NoSuchFieldException) {
81
- Logger.w(javaClass.simpleName, "Can not attach listener because field `mListeners` not found: ${e.message}")
81
+ Logger.w(
82
+ javaClass.simpleName,
83
+ "Can not attach listener because field `mListeners` not found: ${e.message}. Attaching to the end...",
84
+ )
85
+
86
+ // in RN 0.80+ field was renamed to `listeners`, but https://github.com/facebook/react-native/pull/49109
87
+ // was already merged so we can simply add our listener to the end
88
+ this.addTextChangedListener(listener)
82
89
  } catch (e: IllegalArgumentException) {
83
90
  Logger.w(
84
91
  javaClass.simpleName,
@@ -1,9 +1,12 @@
1
1
  package com.reactnativekeyboardcontroller.extensions
2
2
 
3
+ import android.annotation.SuppressLint
3
4
  import android.graphics.Rect
4
5
  import android.os.Build
5
6
  import android.view.View
6
- import androidx.annotation.RequiresApi
7
+ import androidx.core.graphics.Insets
8
+ import androidx.core.view.ViewCompat
9
+ import androidx.core.view.WindowInsetsCompat
7
10
  import com.reactnativekeyboardcontroller.log.Logger
8
11
 
9
12
  /**
@@ -11,6 +14,7 @@ import com.reactnativekeyboardcontroller.log.Logger
11
14
  * to ensure that insets are always received.
12
15
  * @see https://stackoverflow.com/a/61909205/9272042
13
16
  */
17
+ @SuppressLint("ObsoleteSdkInt")
14
18
  fun View.requestApplyInsetsWhenAttached() {
15
19
  // https://chris.banes.dev/2019/04/12/insets-listeners-to-layouts/
16
20
  if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT && isAttachedToWindow) {
@@ -38,14 +42,16 @@ private val tmpIntArr = IntArray(2)
38
42
  /**
39
43
  * Function which updates the given [rect] with this view's position and bounds in its window.
40
44
  */
41
- @RequiresApi(Build.VERSION_CODES.KITKAT)
45
+ @SuppressLint("ObsoleteSdkInt")
42
46
  fun View.copyBoundsInWindow(rect: Rect) {
43
- if (isAttachedToWindow) {
44
- rect.set(0, 0, width, height)
45
- getLocationInWindow(tmpIntArr)
46
- rect.offset(tmpIntArr[0], tmpIntArr[1])
47
- } else {
48
- Logger.w("View.copyBoundsInWindow", "Can not copy bounds as view is not attached to window")
47
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
48
+ if (isAttachedToWindow) {
49
+ rect.set(0, 0, width, height)
50
+ getLocationInWindow(tmpIntArr)
51
+ rect.offset(tmpIntArr[0], tmpIntArr[1])
52
+ } else {
53
+ Logger.w("View.copyBoundsInWindow", "Can not copy bounds as view is not attached to window")
54
+ }
49
55
  }
50
56
  }
51
57
 
@@ -55,3 +61,41 @@ val View.screenLocation get(): IntArray {
55
61
 
56
62
  return point
57
63
  }
64
+
65
+ /**
66
+ * Safely replaces status bar insets so that when we edge-to-edge mode gets disabled/enabled
67
+ * the app content is not jumping/resizing a window.
68
+ * */
69
+ @Suppress("DEPRECATION")
70
+ fun View.replaceStatusBarInsets(
71
+ insets: WindowInsetsCompat,
72
+ isStatusBarTranslucent: Boolean,
73
+ active: Boolean,
74
+ ): WindowInsetsCompat {
75
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
76
+ val sysBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
77
+ val navBars = insets.getInsets(WindowInsetsCompat.Type.navigationBars())
78
+ val ime = insets.getInsets(WindowInsetsCompat.Type.ime())
79
+ val adjustedTop = if (isStatusBarTranslucent) 0 else sysBars.top
80
+ // pick bottom: use IME if present, otherwise nav bar bottom (respect translucency)
81
+ val bottomFromImeOrNav = if (ime.bottom > 0) ime.bottom else navBars.bottom
82
+ val adjustedInsets =
83
+ WindowInsetsCompat
84
+ .Builder(insets)
85
+ .setInsets(
86
+ WindowInsetsCompat.Type.systemBars(),
87
+ Insets.of(sysBars.left, adjustedTop, sysBars.right, if (active) sysBars.bottom else bottomFromImeOrNav),
88
+ ).build()
89
+
90
+ return ViewCompat.onApplyWindowInsets(this, adjustedInsets)
91
+ } else {
92
+ val defaultInsets = ViewCompat.onApplyWindowInsets(this, insets)
93
+
94
+ return defaultInsets.replaceSystemWindowInsets(
95
+ defaultInsets.systemWindowInsetLeft,
96
+ if (isStatusBarTranslucent) 0 else defaultInsets.systemWindowInsetTop,
97
+ defaultInsets.systemWindowInsetRight,
98
+ defaultInsets.systemWindowInsetBottom,
99
+ )
100
+ }
101
+ }
@@ -1,17 +1,20 @@
1
1
  package com.reactnativekeyboardcontroller.modules
2
2
 
3
3
  import android.content.Context
4
+ import android.os.Build
4
5
  import android.view.View
5
6
  import android.view.WindowManager
6
7
  import android.view.inputmethod.InputMethodManager
7
8
  import com.facebook.react.bridge.ReactApplicationContext
8
9
  import com.facebook.react.bridge.UiThreadUtil
10
+ import com.reactnativekeyboardcontroller.interactive.KeyboardAnimationController
9
11
  import com.reactnativekeyboardcontroller.traversal.FocusedInputHolder
10
12
  import com.reactnativekeyboardcontroller.traversal.ViewHierarchyNavigator
11
13
 
12
14
  class KeyboardControllerModuleImpl(
13
15
  private val mReactContext: ReactApplicationContext,
14
16
  ) {
17
+ private val controller = KeyboardAnimationController()
15
18
  private val mDefaultMode: Int = getCurrentMode()
16
19
 
17
20
  fun setInputMode(mode: Int) {
@@ -26,16 +29,33 @@ class KeyboardControllerModuleImpl(
26
29
  // no-op on Android
27
30
  }
28
31
 
29
- fun dismiss(keepFocus: Boolean) {
32
+ fun dismiss(
33
+ keepFocus: Boolean,
34
+ animated: Boolean,
35
+ ) {
30
36
  val activity = mReactContext.currentActivity
31
37
  val view: View? = FocusedInputHolder.get()
32
38
 
33
39
  if (view != null) {
34
40
  UiThreadUtil.runOnUiThread {
35
- val imm = activity?.getSystemService(Context.INPUT_METHOD_SERVICE) as? InputMethodManager
36
- imm?.hideSoftInputFromWindow(view.windowToken, 0)
37
- if (!keepFocus) {
38
- view.clearFocus()
41
+ fun maybeClearFocus() {
42
+ if (!keepFocus) {
43
+ view.clearFocus()
44
+ }
45
+ }
46
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && !animated) {
47
+ controller.startControlRequest(view) { insetsController ->
48
+ insetsController.finish(false)
49
+
50
+ view.post {
51
+ maybeClearFocus()
52
+ }
53
+ }
54
+ } else {
55
+ val imm = activity?.getSystemService(Context.INPUT_METHOD_SERVICE) as? InputMethodManager
56
+ imm?.hideSoftInputFromWindow(view.windowToken, 0)
57
+
58
+ maybeClearFocus()
39
59
  }
40
60
  }
41
61
  }
@@ -2,9 +2,9 @@ package com.reactnativekeyboardcontroller.modules.statusbar
2
2
 
3
3
  import android.animation.ArgbEvaluator
4
4
  import android.animation.ValueAnimator
5
+ import android.annotation.SuppressLint
5
6
  import android.app.Activity
6
7
  import android.os.Build
7
- import androidx.annotation.RequiresApi
8
8
  import androidx.core.view.WindowInsetsCompat
9
9
  import androidx.core.view.WindowInsetsControllerCompat
10
10
  import com.facebook.react.bridge.ReactApplicationContext
@@ -23,11 +23,11 @@ class StatusBarManagerCompatModuleImpl(
23
23
  private var controller: WindowInsetsControllerCompat? = null
24
24
  private var lastActivity = WeakReference<Activity?>(null)
25
25
 
26
+ /**
27
+ * This method always uses new API, because original implementation may mess up system insets
28
+ * and they will never be restored properly (even if you enabled edge-to-edge mode etc.)
29
+ */
26
30
  fun setHidden(hidden: Boolean) {
27
- if (!isEnabled()) {
28
- return original.setHidden(hidden)
29
- }
30
-
31
31
  UiThreadUtil.runOnUiThread {
32
32
  if (hidden) {
33
33
  getController()?.hide(WindowInsetsCompat.Type.statusBars())
@@ -37,37 +37,39 @@ class StatusBarManagerCompatModuleImpl(
37
37
  }
38
38
  }
39
39
 
40
- @RequiresApi(Build.VERSION_CODES.LOLLIPOP)
40
+ @SuppressLint("ObsoleteSdkInt")
41
41
  fun setColor(
42
42
  color: Int,
43
43
  animated: Boolean,
44
44
  ) {
45
- if (!isEnabled()) {
46
- return original.setColor(color.toDouble(), animated)
47
- }
48
-
49
- val activity = mReactContext.currentActivity
50
- if (activity == null) {
51
- Logger.w(
52
- TAG,
53
- "StatusBarManagerCompatModule: Ignored status bar change, current activity is null.",
54
- )
55
- return
56
- }
45
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
46
+ if (!isEnabled()) {
47
+ return original.setColor(color.toDouble(), animated)
48
+ }
57
49
 
58
- UiThreadUtil.runOnUiThread {
59
- val window = activity.window
50
+ val activity = mReactContext.currentActivity
51
+ if (activity == null) {
52
+ Logger.w(
53
+ TAG,
54
+ "StatusBarManagerCompatModule: Ignored status bar change, current activity is null.",
55
+ )
56
+ return
57
+ }
60
58
 
61
- if (animated) {
62
- val curColor: Int = window.statusBarColor
63
- val colorAnimation = ValueAnimator.ofObject(ArgbEvaluator(), curColor, color)
64
- colorAnimation.addUpdateListener { animator ->
65
- window.statusBarColor = animator.animatedValue as Int
59
+ UiThreadUtil.runOnUiThread {
60
+ val window = activity.window
61
+
62
+ if (animated) {
63
+ val curColor: Int = window.statusBarColor
64
+ val colorAnimation = ValueAnimator.ofObject(ArgbEvaluator(), curColor, color)
65
+ colorAnimation.addUpdateListener { animator ->
66
+ window.statusBarColor = animator.animatedValue as Int
67
+ }
68
+ colorAnimation.setDuration(DEFAULT_ANIMATION_TIME).startDelay = 0
69
+ colorAnimation.start()
70
+ } else {
71
+ window.statusBarColor = color
66
72
  }
67
- colorAnimation.setDuration(DEFAULT_ANIMATION_TIME).startDelay = 0
68
- colorAnimation.start()
69
- } else {
70
- window.statusBarColor = color
71
73
  }
72
74
  }
73
75
  }
@@ -4,6 +4,7 @@ import android.annotation.SuppressLint
4
4
  import android.content.res.Configuration
5
5
  import android.os.Handler
6
6
  import android.os.Looper
7
+ import android.view.WindowManager
7
8
  import android.widget.FrameLayout
8
9
  import androidx.core.view.ViewCompat
9
10
  import androidx.core.view.WindowCompat
@@ -13,6 +14,7 @@ import com.facebook.react.uimanager.ThemedReactContext
13
14
  import com.facebook.react.views.view.ReactViewGroup
14
15
  import com.reactnativekeyboardcontroller.extensions.content
15
16
  import com.reactnativekeyboardcontroller.extensions.removeSelf
17
+ import com.reactnativekeyboardcontroller.extensions.replaceStatusBarInsets
16
18
  import com.reactnativekeyboardcontroller.extensions.requestApplyInsetsWhenAttached
17
19
  import com.reactnativekeyboardcontroller.extensions.rootView
18
20
  import com.reactnativekeyboardcontroller.listeners.KeyboardAnimationCallback
@@ -129,14 +131,7 @@ class EdgeToEdgeReactViewGroup(
129
131
  )
130
132
  content?.layoutParams = params
131
133
 
132
- val defaultInsets = ViewCompat.onApplyWindowInsets(v, insets)
133
-
134
- defaultInsets.replaceSystemWindowInsets(
135
- defaultInsets.systemWindowInsetLeft,
136
- if (this.isStatusBarTranslucent) 0 else defaultInsets.systemWindowInsetTop,
137
- defaultInsets.systemWindowInsetRight,
138
- defaultInsets.systemWindowInsetBottom,
139
- )
134
+ v.replaceStatusBarInsets(insets, this.isStatusBarTranslucent, active)
140
135
  }
141
136
  }
142
137
  }
@@ -153,6 +148,8 @@ class EdgeToEdgeReactViewGroup(
153
148
  !isEdgeToEdge,
154
149
  )
155
150
  }
151
+ // unclear legacy flag if it was set earlier
152
+ reactContext.currentActivity?.window?.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN)
156
153
  }
157
154
  }
158
155
 
@@ -6,7 +6,6 @@ import android.os.Build
6
6
  import android.view.MotionEvent
7
7
  import android.view.VelocityTracker
8
8
  import android.view.ViewConfiguration
9
- import androidx.annotation.RequiresApi
10
9
  import androidx.core.view.ViewCompat
11
10
  import androidx.core.view.WindowInsetsCompat
12
11
  import com.facebook.react.uimanager.ThemedReactContext
@@ -50,7 +49,6 @@ class KeyboardGestureAreaReactViewGroup(
50
49
 
51
50
  private var velocityTracker: VelocityTracker? = null
52
51
 
53
- @RequiresApi(Build.VERSION_CODES.R)
54
52
  override fun dispatchTouchEvent(event: MotionEvent?): Boolean {
55
53
  if (velocityTracker == null) {
56
54
  // Obtain a VelocityTracker if we don't have one yet
@@ -86,7 +84,6 @@ class KeyboardGestureAreaReactViewGroup(
86
84
  // endregion
87
85
 
88
86
  // region Handlers
89
- @RequiresApi(Build.VERSION_CODES.KITKAT)
90
87
  private fun onActionDown(event: MotionEvent) {
91
88
  velocityTracker?.addMovement(event)
92
89
 
@@ -97,7 +94,6 @@ class KeyboardGestureAreaReactViewGroup(
97
94
  lastWindowY = bounds.top
98
95
  }
99
96
 
100
- @RequiresApi(Build.VERSION_CODES.R)
101
97
  private fun onActionMove(event: MotionEvent) {
102
98
  // Since the view is likely to be translated/moved as the WindowInsetsAnimation
103
99
  // progresses, we need to make sure we account for that change in our touch
@@ -230,11 +226,14 @@ class KeyboardGestureAreaReactViewGroup(
230
226
  else -> false
231
227
  }
232
228
 
233
- @RequiresApi(Build.VERSION_CODES.R)
234
229
  private fun getWindowHeight(): Int {
235
- val metrics = reactContext.currentActivity?.windowManager?.currentWindowMetrics
230
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
231
+ val metrics = reactContext.currentActivity?.windowManager?.currentWindowMetrics
236
232
 
237
- return metrics?.bounds?.height() ?: 0
233
+ return metrics?.bounds?.height() ?: 0
234
+ }
235
+
236
+ return 0
238
237
  }
239
238
 
240
239
  companion object {
@@ -28,8 +28,11 @@ class KeyboardControllerModule(
28
28
  }
29
29
 
30
30
  @ReactMethod
31
- fun dismiss(keepFocus: Boolean) {
32
- module.dismiss(keepFocus)
31
+ fun dismiss(
32
+ keepFocus: Boolean,
33
+ animated: Boolean,
34
+ ) {
35
+ module.dismiss(keepFocus, animated)
33
36
  }
34
37
 
35
38
  @ReactMethod
@@ -1,7 +1,5 @@
1
1
  package com.reactnativekeyboardcontroller
2
2
 
3
- import android.os.Build
4
- import androidx.annotation.RequiresApi
5
3
  import com.facebook.react.bridge.ReactApplicationContext
6
4
  import com.facebook.react.bridge.ReactContextBaseJavaModule
7
5
  import com.facebook.react.bridge.ReactMethod
@@ -22,7 +20,6 @@ class StatusBarManagerCompatModule(
22
20
  }
23
21
 
24
22
  @ReactMethod
25
- @RequiresApi(Build.VERSION_CODES.LOLLIPOP)
26
23
  private fun setColor(
27
24
  color: Int,
28
25
  animated: Boolean,
@@ -76,13 +76,13 @@ RCT_EXPORT_METHOD(preload)
76
76
  }
77
77
 
78
78
  #ifdef RCT_NEW_ARCH_ENABLED
79
- - (void)dismiss:(BOOL)keepFocus
79
+ - (void)dismiss:(BOOL)keepFocus animated:(BOOL)animated
80
80
  #else
81
- RCT_EXPORT_METHOD(dismiss : (BOOL)keepFocus)
81
+ RCT_EXPORT_METHOD(dismiss : (BOOL)keepFocus animated : (BOOL)animated)
82
82
  #endif
83
83
  {
84
84
  dispatch_async(dispatch_get_main_queue(), ^{
85
- [KeyboardControllerModuleImpl dismiss:keepFocus];
85
+ [KeyboardControllerModuleImpl dismiss:keepFocus animated:animated];
86
86
  });
87
87
  }
88
88
 
@@ -13,26 +13,36 @@ public class KeyboardControllerModuleImpl: NSObject {
13
13
  private static let keyboardRevealGestureName = "keyboardRevealGesture"
14
14
 
15
15
  @objc
16
- public static func dismiss(_ keepFocus: Bool) {
17
- let responder = UIResponder.current
16
+ public static func dismiss(_ keepFocus: Bool, animated: Bool) {
17
+ let work = {
18
+ let responder = UIResponder.current
18
19
 
19
- if keepFocus {
20
- guard let input = responder as? TextInput else { return }
21
- let tapGesture = UITapGestureRecognizer(target: self, action: #selector(onTextInputTapped(_:)))
22
- tapGesture.name = keyboardRevealGestureName
23
- input.addGestureRecognizer(tapGesture)
20
+ if keepFocus {
21
+ guard let input = responder as? TextInput else { return }
22
+ let tapGesture = UITapGestureRecognizer(target: self, action: #selector(onTextInputTapped(_:)))
23
+ tapGesture.name = keyboardRevealGestureName
24
+ input.addGestureRecognizer(tapGesture)
24
25
 
25
- input.inputView = UIView()
26
- input.reloadInputViews()
26
+ input.inputView = UIView()
27
+ input.reloadInputViews()
27
28
 
28
- NotificationCenter.default.addObserver(
29
- self,
30
- selector: #selector(onResponderResigned(_:)),
31
- name: UITextField.textDidEndEditingNotification,
32
- object: input
33
- )
29
+ NotificationCenter.default.addObserver(
30
+ self,
31
+ selector: #selector(onResponderResigned(_:)),
32
+ name: UITextField.textDidEndEditingNotification,
33
+ object: input
34
+ )
35
+ } else {
36
+ responder?.resignFirstResponder()
37
+ }
38
+ }
39
+
40
+ if !animated {
41
+ UIView.performWithoutAnimation {
42
+ work()
43
+ }
34
44
  } else {
35
- responder?.resignFirstResponder()
45
+ work()
36
46
  }
37
47
  }
38
48
 
@@ -217,7 +217,12 @@ using namespace facebook::react;
217
217
  {
218
218
  [super layoutSubviews];
219
219
 
220
- CGSize screenSize = [UIScreen mainScreen].bounds.size;
220
+ UIWindow *window = self.window;
221
+ if (!window) {
222
+ return;
223
+ }
224
+
225
+ CGSize screenSize = window.bounds.size;
221
226
  if (CGSizeEqualToSize(screenSize, _lastScreenSize)) {
222
227
  return;
223
228
  }
@@ -88,7 +88,8 @@ class KeyboardControllerView: UIView {
88
88
  override func layoutSubviews() {
89
89
  super.layoutSubviews()
90
90
 
91
- let screenSize = UIScreen.main.bounds.size
91
+ guard let window = window else { return }
92
+ let screenSize = window.bounds.size
92
93
 
93
94
  if lastScreenSize == screenSize {
94
95
  return
@@ -222,10 +222,9 @@ RCT_EXPORT_VIEW_PROPERTY(enabled, BOOL)
222
222
  #ifdef RCT_NEW_ARCH_ENABLED
223
223
  - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
224
224
  {
225
- const auto &oldViewProps = *std::static_pointer_cast<const KeyboardExtenderProps>(_props);
226
225
  const auto &newViewProps = *std::static_pointer_cast<const KeyboardExtenderProps>(props);
227
226
 
228
- if (newViewProps.enabled != oldViewProps.enabled) {
227
+ if (newViewProps.enabled != self.enabled) {
229
228
  [self updateEnabledState:newViewProps.enabled];
230
229
  }
231
230
 
package/jest/index.js CHANGED
@@ -42,6 +42,21 @@ const state = {
42
42
  isVisible: false,
43
43
  };
44
44
 
45
+ const DefaultKeyboardToolbarTheme = {
46
+ light: {
47
+ primary: "#2c2c2c",
48
+ disabled: "#B0BEC5",
49
+ background: "#f3f3f4",
50
+ ripple: "#bcbcbcbc",
51
+ },
52
+ dark: {
53
+ primary: "#fafafa",
54
+ disabled: "#707070",
55
+ background: "#2C2C2E",
56
+ ripple: "#F8F8F888",
57
+ },
58
+ };
59
+
45
60
  const mock = {
46
61
  // hooks
47
62
  /// keyboard
@@ -105,6 +120,8 @@ const mock = {
105
120
  KeyboardAvoidingView: View,
106
121
  KeyboardAwareScrollView: ScrollView,
107
122
  KeyboardToolbar: View,
123
+ // themes
124
+ DefaultKeyboardToolbarTheme,
108
125
  };
109
126
 
110
127
  module.exports = mock;
@@ -14,8 +14,7 @@ var _eventMappings = require("./event-mappings");
14
14
  var _internal = require("./internal");
15
15
  var _module = require("./module");
16
16
  var _reanimated = require("./reanimated");
17
- 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); }
18
- 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 && {}.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
+ 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); }
19
18
  /* eslint react/jsx-sort-props: off */
20
19
 
21
20
  const IS_EDGE_TO_EDGE = (0, _reactNativeIsEdgeToEdge.isEdgeToEdge)();
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeIsEdgeToEdge","_reactNativeReanimated","_bindings","_context","_eventMappings","_internal","_module","_reanimated","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","IS_EDGE_TO_EDGE","isEdgeToEdge","KeyboardControllerViewAnimated","Reanimated","createAnimatedComponent","Animated","KeyboardControllerView","styles","StyleSheet","create","container","flex","hidden","display","position","OS","Platform","KeyboardProvider","props","children","statusBarTranslucent","navigationBarTranslucent","preserveEdgeToEdge","enabled","initiallyEnabled","preload","viewTagRef","useRef","setEnabled","useState","progress","useAnimatedValue","height","progressSV","useSharedValue","heightSV","layout","setKeyboardHandlers","useEventHandlerRegistration","keyboardEventsMap","setInputHandlers","focusedInputEventsMap","context","useMemo","animated","multiply","reanimated","style","transform","translateX","translateY","onKeyboardMove","event","nativeEvent","useNativeDriver","updateSharedValues","platforms","includes","value","keyboardHandler","useAnimatedKeyboardHandler","onKeyboardMoveStart","onKeyboardMoveInteractive","onKeyboardMoveEnd","inputLayoutHandler","useFocusedInputLayoutHandler","onFocusedInputLayoutChanged","target","useEffect","KeyboardController","__DEV__","controlEdgeToEdgeValues","createElement","KeyboardContext","Provider","ref","onKeyboardMoveReanimated","undefined","onFocusedInputLayoutChangedReanimated","View","exports"],"sources":["animated.tsx"],"sourcesContent":["/* eslint react/jsx-sort-props: off */\nimport React, { useEffect, useMemo, useRef, useState } from \"react\";\nimport { Animated, Platform, StyleSheet } from \"react-native\";\nimport {\n controlEdgeToEdgeValues,\n isEdgeToEdge,\n} from \"react-native-is-edge-to-edge\";\nimport Reanimated, { useSharedValue } from \"react-native-reanimated\";\n\nimport { KeyboardControllerView } from \"./bindings\";\nimport { KeyboardContext } from \"./context\";\nimport { focusedInputEventsMap, keyboardEventsMap } from \"./event-mappings\";\nimport { useAnimatedValue, useEventHandlerRegistration } from \"./internal\";\nimport { KeyboardController } from \"./module\";\nimport {\n useAnimatedKeyboardHandler,\n useFocusedInputLayoutHandler,\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 IS_EDGE_TO_EDGE = isEdgeToEdge();\n\nconst KeyboardControllerViewAnimated = Reanimated.createAnimatedComponent(\n Animated.createAnimatedComponent(KeyboardControllerView),\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 * @platform android\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/14\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 * @platform android\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/119\n */\n navigationBarTranslucent?: boolean;\n /**\n * A boolean property indicating whether to keep edge-to-edge mode always enabled (even when you disable the module).\n * Defaults to `false`.\n *\n * @platform android\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/592\n */\n preserveEdgeToEdge?: boolean;\n /**\n * A boolean prop indicating whether the module is enabled. It indicate only initial state\n * (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 * A boolean prop indicating whether to preload the keyboard to reduce time-to-interaction (TTI) on first input focus.\n * Defaults to `true`.\n *\n * @platform ios\n */\n preload?: 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\n/**\n * A component that wrap your app. Under the hood it works with {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller-view|KeyboardControllerView} to receive events during keyboard movements,\n * maps these events to `Animated`/`Reanimated` values and store them in context.\n *\n * @param props - Provider props, such as `statusBarTranslucent`, `navigationBarTranslucent`, etc.\n * @returns A component that should be mounted in root of your App layout.\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-provider|Documentation} page for more details.\n * @example\n * ```tsx\n * <KeyboardProvider>\n * <NavigationContainer />\n * </KeyboardProvider>\n * ```\n */\nexport const KeyboardProvider = (props: KeyboardProviderProps) => {\n const {\n children,\n statusBarTranslucent,\n navigationBarTranslucent,\n preserveEdgeToEdge,\n enabled: initiallyEnabled = true,\n preload = true,\n } = props;\n // ref\n const viewTagRef = useRef<React.Component<KeyboardControllerProps>>(null);\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 = useEventHandlerRegistration<KeyboardHandler>(\n keyboardEventsMap,\n viewTagRef,\n );\n const setInputHandlers = useEventHandlerRegistration<FocusedInputHandler>(\n focusedInputEventsMap,\n viewTagRef,\n );\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 // Setting useNativeDriver to true on web triggers a warning due to the absence of a native driver for web. Therefore, it is set to false.\n { useNativeDriver: Platform.OS !== \"web\" },\n ),\n [],\n );\n // handlers\n const updateSharedValues = (event: NativeEvent, platforms: string[]) => {\n \"worklet\";\n\n if (platforms.includes(OS)) {\n // eslint-disable-next-line react-compiler/react-compiler\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 updateSharedValues(event, [\"ios\"]);\n },\n onKeyboardMove: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"android\"]);\n },\n onKeyboardMoveInteractive: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"android\", \"ios\"]);\n },\n onKeyboardMoveEnd: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"android\"]);\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\n useEffect(() => {\n if (preload) {\n KeyboardController.preload();\n }\n }, [preload]);\n\n if (__DEV__) {\n controlEdgeToEdgeValues({\n statusBarTranslucent,\n navigationBarTranslucent,\n preserveEdgeToEdge,\n });\n }\n\n return (\n <KeyboardContext.Provider value={context}>\n <KeyboardControllerViewAnimated\n ref={viewTagRef}\n enabled={enabled}\n navigationBarTranslucent={IS_EDGE_TO_EDGE || navigationBarTranslucent}\n statusBarTranslucent={IS_EDGE_TO_EDGE || statusBarTranslucent}\n preserveEdgeToEdge={IS_EDGE_TO_EDGE || preserveEdgeToEdge}\n style={styles.container}\n // on*Reanimated prop must precede animated handlers to work correctly\n onKeyboardMoveReanimated={keyboardHandler}\n onKeyboardMoveStart={OS === \"ios\" ? onKeyboardMove : undefined}\n onKeyboardMove={OS === \"android\" ? onKeyboardMove : undefined}\n onKeyboardMoveInteractive={onKeyboardMove}\n onKeyboardMoveEnd={OS === \"android\" ? onKeyboardMove : undefined}\n onFocusedInputLayoutChangedReanimated={inputLayoutHandler}\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":";;;;;;AACA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,wBAAA,GAAAF,OAAA;AAIA,IAAAG,sBAAA,GAAAJ,uBAAA,CAAAC,OAAA;AAEA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,cAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AACA,IAAAS,WAAA,GAAAT,OAAA;AAGsB,SAAAU,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAA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,SAAU;IAC/D1B,cAAc,EAAEpC,EAAE,KAAK,SAAS,GAAGoC,cAAc,GAAG0B,SAAU;IAC9Df,yBAAyB,EAAEX,cAAe;IAC1CY,iBAAiB,EAAEhD,EAAE,KAAK,SAAS,GAAGoC,cAAc,GAAG0B,SAAU;IACjEC,qCAAqC,EAAEd;EAAmB,GAEzD7C,QAC6B,CAAC,eACjCnD,MAAA,CAAAkB,OAAA,CAAAsF,aAAA,CAACrG,YAAA,CAAAkC,QAAQ,CAAC0E,IAAI;IACZ;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACAhC,KAAK,EAAEA;EAAM,CACd,CACuB,CAAC;AAE/B,CAAC;AAACiC,OAAA,CAAA/D,gBAAA,GAAAA,gBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeIsEdgeToEdge","_reactNativeReanimated","_bindings","_context","_eventMappings","_internal","_module","_reanimated","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","IS_EDGE_TO_EDGE","isEdgeToEdge","KeyboardControllerViewAnimated","Reanimated","createAnimatedComponent","Animated","KeyboardControllerView","styles","StyleSheet","create","container","flex","hidden","display","position","OS","Platform","KeyboardProvider","props","children","statusBarTranslucent","navigationBarTranslucent","preserveEdgeToEdge","enabled","initiallyEnabled","preload","viewTagRef","useRef","setEnabled","useState","progress","useAnimatedValue","height","progressSV","useSharedValue","heightSV","layout","setKeyboardHandlers","useEventHandlerRegistration","keyboardEventsMap","setInputHandlers","focusedInputEventsMap","context","useMemo","animated","multiply","reanimated","style","transform","translateX","translateY","onKeyboardMove","event","nativeEvent","useNativeDriver","updateSharedValues","platforms","includes","value","keyboardHandler","useAnimatedKeyboardHandler","onKeyboardMoveStart","onKeyboardMoveInteractive","onKeyboardMoveEnd","inputLayoutHandler","useFocusedInputLayoutHandler","onFocusedInputLayoutChanged","target","useEffect","KeyboardController","__DEV__","controlEdgeToEdgeValues","createElement","KeyboardContext","Provider","ref","onKeyboardMoveReanimated","undefined","onFocusedInputLayoutChangedReanimated","View","exports"],"sources":["animated.tsx"],"sourcesContent":["/* eslint react/jsx-sort-props: off */\nimport React, { useEffect, useMemo, useRef, useState } from \"react\";\nimport { Animated, Platform, StyleSheet } from \"react-native\";\nimport {\n controlEdgeToEdgeValues,\n isEdgeToEdge,\n} from \"react-native-is-edge-to-edge\";\nimport Reanimated, { useSharedValue } from \"react-native-reanimated\";\n\nimport { KeyboardControllerView } from \"./bindings\";\nimport { KeyboardContext } from \"./context\";\nimport { focusedInputEventsMap, keyboardEventsMap } from \"./event-mappings\";\nimport { useAnimatedValue, useEventHandlerRegistration } from \"./internal\";\nimport { KeyboardController } from \"./module\";\nimport {\n useAnimatedKeyboardHandler,\n useFocusedInputLayoutHandler,\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 IS_EDGE_TO_EDGE = isEdgeToEdge();\n\nconst KeyboardControllerViewAnimated = Reanimated.createAnimatedComponent(\n Animated.createAnimatedComponent(KeyboardControllerView),\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 * @platform android\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/14\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 * @platform android\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/119\n */\n navigationBarTranslucent?: boolean;\n /**\n * A boolean property indicating whether to keep edge-to-edge mode always enabled (even when you disable the module).\n * Defaults to `false`.\n *\n * @platform android\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/592\n */\n preserveEdgeToEdge?: boolean;\n /**\n * A boolean prop indicating whether the module is enabled. It indicate only initial state\n * (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 * A boolean prop indicating whether to preload the keyboard to reduce time-to-interaction (TTI) on first input focus.\n * Defaults to `true`.\n *\n * @platform ios\n */\n preload?: 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\n/**\n * A component that wrap your app. Under the hood it works with {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller-view|KeyboardControllerView} to receive events during keyboard movements,\n * maps these events to `Animated`/`Reanimated` values and store them in context.\n *\n * @param props - Provider props, such as `statusBarTranslucent`, `navigationBarTranslucent`, etc.\n * @returns A component that should be mounted in root of your App layout.\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-provider|Documentation} page for more details.\n * @example\n * ```tsx\n * <KeyboardProvider>\n * <NavigationContainer />\n * </KeyboardProvider>\n * ```\n */\nexport const KeyboardProvider = (props: KeyboardProviderProps) => {\n const {\n children,\n statusBarTranslucent,\n navigationBarTranslucent,\n preserveEdgeToEdge,\n enabled: initiallyEnabled = true,\n preload = true,\n } = props;\n // ref\n const viewTagRef = useRef<React.Component<KeyboardControllerProps>>(null);\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 = useEventHandlerRegistration<KeyboardHandler>(\n keyboardEventsMap,\n viewTagRef,\n );\n const setInputHandlers = useEventHandlerRegistration<FocusedInputHandler>(\n focusedInputEventsMap,\n viewTagRef,\n );\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 // Setting useNativeDriver to true on web triggers a warning due to the absence of a native driver for web. Therefore, it is set to false.\n { useNativeDriver: Platform.OS !== \"web\" },\n ),\n [],\n );\n // handlers\n const updateSharedValues = (event: NativeEvent, platforms: string[]) => {\n \"worklet\";\n\n if (platforms.includes(OS)) {\n // eslint-disable-next-line react-compiler/react-compiler\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 updateSharedValues(event, [\"ios\"]);\n },\n onKeyboardMove: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"android\"]);\n },\n onKeyboardMoveInteractive: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"android\", \"ios\"]);\n },\n onKeyboardMoveEnd: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"android\"]);\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\n useEffect(() => {\n if (preload) {\n KeyboardController.preload();\n }\n }, [preload]);\n\n if (__DEV__) {\n controlEdgeToEdgeValues({\n statusBarTranslucent,\n navigationBarTranslucent,\n preserveEdgeToEdge,\n });\n }\n\n return (\n <KeyboardContext.Provider value={context}>\n <KeyboardControllerViewAnimated\n ref={viewTagRef}\n enabled={enabled}\n navigationBarTranslucent={IS_EDGE_TO_EDGE || navigationBarTranslucent}\n statusBarTranslucent={IS_EDGE_TO_EDGE || statusBarTranslucent}\n preserveEdgeToEdge={IS_EDGE_TO_EDGE || preserveEdgeToEdge}\n style={styles.container}\n // on*Reanimated prop must precede animated handlers to work correctly\n onKeyboardMoveReanimated={keyboardHandler}\n onKeyboardMoveStart={OS === \"ios\" ? onKeyboardMove : undefined}\n onKeyboardMove={OS === \"android\" ? onKeyboardMove : undefined}\n onKeyboardMoveInteractive={onKeyboardMove}\n onKeyboardMoveEnd={OS === \"android\" ? onKeyboardMove : undefined}\n onFocusedInputLayoutChangedReanimated={inputLayoutHandler}\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":";;;;;;AACA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,wBAAA,GAAAF,OAAA;AAIA,IAAAG,sBAAA,GAAAJ,uBAAA,CAAAC,OAAA;AAEA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,cAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,O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ACd;IAAA;IACAkE,wBAAwB,EAAEjB,eAAgB;IAC1CE,mBAAmB,EAAE9C,EAAE,KAAK,KAAK,GAAGoC,cAAc,GAAG0B,SAAU;IAC/D1B,cAAc,EAAEpC,EAAE,KAAK,SAAS,GAAGoC,cAAc,GAAG0B,SAAU;IAC9Df,yBAAyB,EAAEX,cAAe;IAC1CY,iBAAiB,EAAEhD,EAAE,KAAK,SAAS,GAAGoC,cAAc,GAAG0B,SAAU;IACjEC,qCAAqC,EAAEd;EAAmB,GAEzD7C,QAC6B,CAAC,eACjClD,MAAA,CAAAsB,OAAA,CAAAiF,aAAA,CAACpG,YAAA,CAAAiC,QAAQ,CAAC0E,IAAI;IACZ;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACAhC,KAAK,EAAEA;EAAM,CACd,CACuB,CAAC;AAE/B,CAAC;AAACiC,OAAA,CAAA/D,gBAAA,GAAAA,gBAAA","ignoreList":[]}
@@ -9,8 +9,7 @@ var _reactNative = require("react-native");
9
9
  var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated"));
10
10
  var _hooks = require("../../hooks");
11
11
  var _hooks2 = require("./hooks");
12
- 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); }
13
- 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 && {}.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; }
12
+ 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
13
  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
14
  const defaultLayout = {
16
15
  x: 0,