react-native-keyboard-controller 1.17.4 → 1.18.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 (185) hide show
  1. package/README.md +4 -1
  2. package/android/src/base/java/com/reactnativekeyboardcontroller/KeyboardControllerPackage.kt +6 -5
  3. package/android/src/fabric/java/com/reactnativekeyboardcontroller/KeyboardBackgroundViewManager.kt +19 -0
  4. package/android/src/fabric/java/com/reactnativekeyboardcontroller/KeyboardControllerModule.kt +4 -0
  5. package/android/src/fabric/java/com/reactnativekeyboardcontroller/KeyboardControllerViewManager.kt +3 -5
  6. package/android/src/fabric/java/com/reactnativekeyboardcontroller/KeyboardGestureAreaViewManager.kt +3 -5
  7. package/android/src/fabric/java/com/reactnativekeyboardcontroller/OverKeyboardViewManager.kt +3 -5
  8. package/android/src/fabric/java/com/reactnativekeyboardcontroller/StatusBarManagerCompatModule.kt +3 -1
  9. package/android/src/main/java/com/reactnativekeyboardcontroller/extensions/Context.kt +20 -0
  10. package/android/src/main/java/com/reactnativekeyboardcontroller/extensions/ThemedReactContext.kt +2 -12
  11. package/android/src/main/java/com/reactnativekeyboardcontroller/managers/KeyboardBackgroundViewManagerImpl.kt +13 -0
  12. package/android/src/main/java/com/reactnativekeyboardcontroller/managers/KeyboardControllerViewManagerImpl.kt +2 -6
  13. package/android/src/main/java/com/reactnativekeyboardcontroller/managers/KeyboardGestureAreaViewManagerImpl.kt +1 -5
  14. package/android/src/main/java/com/reactnativekeyboardcontroller/managers/OverKeyboardViewManagerImpl.kt +1 -5
  15. package/android/src/main/java/com/reactnativekeyboardcontroller/modules/KeyboardControllerModuleImpl.kt +4 -0
  16. package/android/src/main/java/com/reactnativekeyboardcontroller/modules/{StatusBarManagerCompatModuleImpl.kt → statusbar/StatusBarManagerCompatModuleImpl.kt} +31 -5
  17. package/android/src/main/java/com/reactnativekeyboardcontroller/modules/statusbar/StatusBarModuleProxy.kt +86 -0
  18. package/android/src/main/java/com/reactnativekeyboardcontroller/views/EdgeToEdgeReactViewGroup.kt +9 -11
  19. package/android/src/main/java/com/reactnativekeyboardcontroller/views/background/KeyboardBackgroundViewGroup.kt +35 -0
  20. package/android/src/main/java/com/reactnativekeyboardcontroller/views/background/Skins.kt +91 -0
  21. package/android/src/main/jni/reactnativekeyboardcontroller.h +1 -0
  22. package/android/src/main/res/values/attrs.xml +7 -0
  23. package/android/src/main/res/values/colors.xml +35 -0
  24. package/android/src/main/res/values-v29/colors.xml +5 -0
  25. package/android/src/main/res/values-v30/colors.xml +17 -0
  26. package/android/src/main/res/values-v33/colors.xml +16 -0
  27. package/android/src/main/res/values-v34/colors.xml +18 -0
  28. package/android/src/main/res/values-v35/colors.xml +10 -0
  29. package/android/src/paper/java/com/reactnativekeyboardcontroller/KeyboardBackgroundViewManager.kt +15 -0
  30. package/android/src/paper/java/com/reactnativekeyboardcontroller/KeyboardControllerModule.kt +5 -0
  31. package/android/src/paper/java/com/reactnativekeyboardcontroller/KeyboardControllerViewManager.kt +2 -5
  32. package/android/src/paper/java/com/reactnativekeyboardcontroller/KeyboardGestureAreaViewManager.kt +2 -5
  33. package/android/src/paper/java/com/reactnativekeyboardcontroller/OverKeyboardViewManager.kt +2 -5
  34. package/android/src/paper/java/com/reactnativekeyboardcontroller/StatusBarManagerCompatModule.kt +3 -1
  35. package/android/src/turbo/java/com/reactnativekeyboardcontroller/KeyboardControllerPackage.kt +5 -5
  36. package/common/cpp/react/renderer/components/reactnativekeyboardcontroller/RNKCKeyboardBackgroundViewComponentDescriptor.h +27 -0
  37. package/common/cpp/react/renderer/components/reactnativekeyboardcontroller/RNKCKeyboardBackgroundViewShadowNode.cpp +14 -0
  38. package/common/cpp/react/renderer/components/reactnativekeyboardcontroller/RNKCKeyboardBackgroundViewShadowNode.h +30 -0
  39. package/common/cpp/react/renderer/components/reactnativekeyboardcontroller/RNKCKeyboardBackgroundViewState.h +28 -0
  40. package/common/cpp/react/renderer/components/reactnativekeyboardcontroller/RNKCKeyboardExtenderComponentDescriptor.h +27 -0
  41. package/common/cpp/react/renderer/components/reactnativekeyboardcontroller/RNKCKeyboardExtenderShadowNode.cpp +14 -0
  42. package/common/cpp/react/renderer/components/reactnativekeyboardcontroller/RNKCKeyboardExtenderShadowNode.h +30 -0
  43. package/common/cpp/react/renderer/components/reactnativekeyboardcontroller/RNKCKeyboardExtenderState.h +28 -0
  44. package/ios/KeyboardControllerModule.mm +9 -0
  45. package/ios/delegates/KCTextInputCompositeDelegate.swift +5 -5
  46. package/ios/events/KeyboardEventEmitterPayload.swift +1 -1
  47. package/ios/extensions/String.swift +12 -0
  48. package/ios/extensions/UIResponder.swift +27 -0
  49. package/ios/interactive/KeyboardAreaExtender.swift +5 -5
  50. package/ios/observers/FocusedInputObserver.swift +14 -5
  51. package/ios/observers/KeyboardMovementObserver.swift +24 -9
  52. package/ios/protocols/TextInput.swift +22 -0
  53. package/ios/swizzling/UIResponderSwizzle.swift +3 -0
  54. package/ios/traversal/KeyboardView.swift +6 -3
  55. package/ios/views/KeyboardBackgroundViewManager.h +29 -0
  56. package/ios/views/KeyboardBackgroundViewManager.mm +168 -0
  57. package/ios/views/KeyboardExtenderContainerView.swift +59 -0
  58. package/ios/views/KeyboardExtenderManager.h +29 -0
  59. package/ios/views/KeyboardExtenderManager.mm +287 -0
  60. package/jest/index.js +6 -1
  61. package/lib/commonjs/animated.js +7 -10
  62. package/lib/commonjs/animated.js.map +1 -1
  63. package/lib/commonjs/bindings.js +15 -1
  64. package/lib/commonjs/bindings.js.map +1 -1
  65. package/lib/commonjs/bindings.native.js +5 -1
  66. package/lib/commonjs/bindings.native.js.map +1 -1
  67. package/lib/commonjs/components/KeyboardAwareScrollView/index.js +49 -29
  68. package/lib/commonjs/components/KeyboardAwareScrollView/index.js.map +1 -1
  69. package/lib/commonjs/components/KeyboardToolbar/Arrow.js +2 -3
  70. package/lib/commonjs/components/KeyboardToolbar/Arrow.js.map +1 -1
  71. package/lib/commonjs/components/KeyboardToolbar/Button.js +2 -3
  72. package/lib/commonjs/components/KeyboardToolbar/Button.js.map +1 -1
  73. package/lib/commonjs/components/KeyboardToolbar/constants.js +17 -0
  74. package/lib/commonjs/components/KeyboardToolbar/constants.js.map +1 -0
  75. package/lib/commonjs/components/KeyboardToolbar/index.js +25 -22
  76. package/lib/commonjs/components/KeyboardToolbar/index.js.map +1 -1
  77. package/lib/commonjs/hooks/useKeyboardState/index.js +18 -8
  78. package/lib/commonjs/hooks/useKeyboardState/index.js.map +1 -1
  79. package/lib/commonjs/index.js +8 -1
  80. package/lib/commonjs/index.js.map +1 -1
  81. package/lib/commonjs/module.js +2 -1
  82. package/lib/commonjs/module.js.map +1 -1
  83. package/lib/commonjs/specs/KeyboardBackgroundViewNativeComponent.js +12 -0
  84. package/lib/commonjs/specs/KeyboardBackgroundViewNativeComponent.js.map +1 -0
  85. package/lib/commonjs/specs/KeyboardExtenderNativeComponent.js +13 -0
  86. package/lib/commonjs/specs/KeyboardExtenderNativeComponent.js.map +1 -0
  87. package/lib/commonjs/specs/NativeKeyboardController.js.map +1 -1
  88. package/lib/commonjs/types/module.js.map +1 -1
  89. package/lib/commonjs/types/views.js.map +1 -1
  90. package/lib/commonjs/views/KeyboardExtender/index.ios.js +43 -0
  91. package/lib/commonjs/views/KeyboardExtender/index.ios.js.map +1 -0
  92. package/lib/commonjs/views/KeyboardExtender/index.js +46 -0
  93. package/lib/commonjs/views/KeyboardExtender/index.js.map +1 -0
  94. package/lib/commonjs/views/index.js +7 -0
  95. package/lib/commonjs/views/index.js.map +1 -1
  96. package/lib/module/animated.js +8 -11
  97. package/lib/module/animated.js.map +1 -1
  98. package/lib/module/bindings.js +14 -0
  99. package/lib/module/bindings.js.map +1 -1
  100. package/lib/module/bindings.native.js +4 -0
  101. package/lib/module/bindings.native.js.map +1 -1
  102. package/lib/module/components/KeyboardAwareScrollView/index.js +50 -30
  103. package/lib/module/components/KeyboardAwareScrollView/index.js.map +1 -1
  104. package/lib/module/components/KeyboardToolbar/Arrow.js +2 -2
  105. package/lib/module/components/KeyboardToolbar/Arrow.js.map +1 -1
  106. package/lib/module/components/KeyboardToolbar/Button.js +2 -2
  107. package/lib/module/components/KeyboardToolbar/Button.js.map +1 -1
  108. package/lib/module/components/KeyboardToolbar/constants.js +11 -0
  109. package/lib/module/components/KeyboardToolbar/constants.js.map +1 -0
  110. package/lib/module/components/KeyboardToolbar/index.js +17 -14
  111. package/lib/module/components/KeyboardToolbar/index.js.map +1 -1
  112. package/lib/module/hooks/useKeyboardState/index.js +18 -6
  113. package/lib/module/hooks/useKeyboardState/index.js.map +1 -1
  114. package/lib/module/index.js +1 -1
  115. package/lib/module/index.js.map +1 -1
  116. package/lib/module/module.js +2 -1
  117. package/lib/module/module.js.map +1 -1
  118. package/lib/module/specs/KeyboardBackgroundViewNativeComponent.js +5 -0
  119. package/lib/module/specs/KeyboardBackgroundViewNativeComponent.js.map +1 -0
  120. package/lib/module/specs/KeyboardExtenderNativeComponent.js +6 -0
  121. package/lib/module/specs/KeyboardExtenderNativeComponent.js.map +1 -0
  122. package/lib/module/specs/NativeKeyboardController.js.map +1 -1
  123. package/lib/module/types/module.js.map +1 -1
  124. package/lib/module/types/views.js.map +1 -1
  125. package/lib/module/views/KeyboardExtender/index.ios.js +36 -0
  126. package/lib/module/views/KeyboardExtender/index.ios.js.map +1 -0
  127. package/lib/module/views/KeyboardExtender/index.js +39 -0
  128. package/lib/module/views/KeyboardExtender/index.js.map +1 -0
  129. package/lib/module/views/index.js +1 -0
  130. package/lib/module/views/index.js.map +1 -1
  131. package/lib/typescript/animated.d.ts +7 -0
  132. package/lib/typescript/bindings.d.ts +14 -1
  133. package/lib/typescript/bindings.native.d.ts +3 -1
  134. package/lib/typescript/components/KeyboardAwareScrollView/index.d.ts +2 -2
  135. package/lib/typescript/components/KeyboardToolbar/constants.d.ts +10 -0
  136. package/lib/typescript/hooks/useKeyboardState/index.d.ts +8 -2
  137. package/lib/typescript/index.d.ts +1 -1
  138. package/lib/typescript/specs/KeyboardBackgroundViewNativeComponent.d.ts +6 -0
  139. package/lib/typescript/specs/KeyboardExtenderNativeComponent.d.ts +7 -0
  140. package/lib/typescript/specs/NativeKeyboardController.d.ts +1 -0
  141. package/lib/typescript/types/module.d.ts +15 -3
  142. package/lib/typescript/types/views.d.ts +5 -0
  143. package/lib/typescript/views/KeyboardExtender/index.d.ts +19 -0
  144. package/lib/typescript/views/KeyboardExtender/index.ios.d.ts +19 -0
  145. package/lib/typescript/views/index.d.ts +1 -0
  146. package/package.json +7 -3
  147. package/react-native.config.js +1 -0
  148. package/src/animated.tsx +14 -9
  149. package/src/bindings.native.ts +8 -0
  150. package/src/bindings.ts +18 -0
  151. package/src/components/KeyboardAwareScrollView/index.tsx +72 -47
  152. package/src/components/KeyboardToolbar/Arrow.tsx +2 -2
  153. package/src/components/KeyboardToolbar/Button.tsx +2 -2
  154. package/src/components/KeyboardToolbar/constants.ts +15 -0
  155. package/src/components/KeyboardToolbar/index.tsx +45 -17
  156. package/src/hooks/useKeyboardState/index.ts +25 -6
  157. package/src/index.ts +1 -1
  158. package/src/module.ts +2 -1
  159. package/src/specs/KeyboardBackgroundViewNativeComponent.ts +10 -0
  160. package/src/specs/KeyboardExtenderNativeComponent.ts +13 -0
  161. package/src/specs/NativeKeyboardController.ts +1 -0
  162. package/src/types/module.ts +17 -3
  163. package/src/types/views.ts +5 -0
  164. package/src/views/KeyboardExtender/index.ios.tsx +35 -0
  165. package/src/views/KeyboardExtender/index.tsx +42 -0
  166. package/src/views/index.ts +1 -0
  167. package/ios/extensions/UIKeyboardAppearance.swift +0 -21
  168. package/lib/commonjs/components/hooks/useColorScheme.js +0 -10
  169. package/lib/commonjs/components/hooks/useColorScheme.js.map +0 -1
  170. package/lib/commonjs/monkey-patch.android.js +0 -53
  171. package/lib/commonjs/monkey-patch.android.js.map +0 -1
  172. package/lib/commonjs/monkey-patch.js +0 -11
  173. package/lib/commonjs/monkey-patch.js.map +0 -1
  174. package/lib/module/components/hooks/useColorScheme.js +0 -4
  175. package/lib/module/components/hooks/useColorScheme.js.map +0 -1
  176. package/lib/module/monkey-patch.android.js +0 -42
  177. package/lib/module/monkey-patch.android.js.map +0 -1
  178. package/lib/module/monkey-patch.js +0 -5
  179. package/lib/module/monkey-patch.js.map +0 -1
  180. package/lib/typescript/components/hooks/useColorScheme.d.ts +0 -2
  181. package/lib/typescript/monkey-patch.android.d.ts +0 -2
  182. package/lib/typescript/monkey-patch.d.ts +0 -2
  183. package/src/components/hooks/useColorScheme.ts +0 -5
  184. package/src/monkey-patch.android.ts +0 -41
  185. package/src/monkey-patch.ts +0 -5
@@ -0,0 +1,35 @@
1
+ <resources>
2
+ <style name="aosp_light">
3
+ <item name="color">#ebeff1</item>
4
+ </style>
5
+ <style name="gboard_dark">
6
+ <item name="color">#1c1c2c</item>
7
+ </style>
8
+ <style name="gboard_light">
9
+ <item name="color">#ebeff1</item>
10
+ </style>
11
+ <style name="gboard_tts_dark">
12
+ <item name="color">#202124</item>
13
+ </style>
14
+ <style name="gboard_tts_light">
15
+ <item name="color">#f8f9fa</item>
16
+ </style>
17
+ <style name="swiftkey_dark">
18
+ <item name="color">#141414</item>
19
+ </style>
20
+ <style name="swiftkey_light">
21
+ <item name="color">#f1f1f1</item>
22
+ </style>
23
+ <style name="yandex_dark">
24
+ <item name="color">#1a1b20</item>
25
+ </style>
26
+ <style name="yandex_light">
27
+ <item name="color">#eeedf4</item>
28
+ </style>
29
+ <style name="samsung_dark">
30
+ <item name="color">#080808</item>
31
+ </style>
32
+ <style name="samsung_light">
33
+ <item name="color">#e4e4e4</item>
34
+ </style>
35
+ </resources>
@@ -0,0 +1,5 @@
1
+ <resources>
2
+ <style name="gboard_tts_light">
3
+ <item name="color">#ebeff1</item>
4
+ </style>
5
+ </resources>
@@ -0,0 +1,17 @@
1
+ <resources>
2
+ <style name="gboard_dark">
3
+ <item name="color">#292e32</item>
4
+ </style>
5
+ <style name="gboard_light">
6
+ <item name="color">#e8eaed</item>
7
+ </style>
8
+ <style name="gboard_tts_light">
9
+ <item name="color">#f8f9fa</item>
10
+ </style>
11
+ <style name="yandex_dark">
12
+ <item name="color">#121212</item>
13
+ </style>
14
+ <style name="yandex_light">
15
+ <item name="color">#eaeef2</item>
16
+ </style>
17
+ </resources>
@@ -0,0 +1,16 @@
1
+ <resources>
2
+ <style name="gboard_dark">
3
+ <item name="color">@android:color/system_neutral1_900</item>
4
+ </style>
5
+ <style name="gboard_light">
6
+ <item name="color">@android:color/system_neutral1_50</item>
7
+ </style>
8
+ <style name="yandex_dark">
9
+ <item name="color">@android:color/system_neutral2_900</item>
10
+ <!-- TODO: doesn't match -->
11
+ </style>
12
+ <style name="yandex_light">
13
+ <item name="color">@android:color/system_neutral2_50</item>
14
+ <!-- TODO: doesn't match -->
15
+ </style>
16
+ </resources>
@@ -0,0 +1,18 @@
1
+ <resources>
2
+ <style name="gboard_dark">
3
+ <item name="color">@android:color/system_neutral1_900</item>
4
+ </style>
5
+ <style name="gboard_light">
6
+ <item name="color">@android:color/system_neutral1_50</item>
7
+ </style>
8
+ <style name="yandex_dark">
9
+ <item name="color">@android:color/system_neutral1_900</item>
10
+ </style>
11
+ <style name="yandex_light">
12
+ <item name="color">@android:color/system_neutral1_50</item>
13
+ <item name="tone">-3</item>
14
+ </style>
15
+ <style name="samsung_dark">
16
+ <item name="color">#030303</item>
17
+ </style>
18
+ </resources>
@@ -0,0 +1,10 @@
1
+ <resources>
2
+ <style name="gboard_dark">
3
+ <item name="color">@android:color/system_neutral1_900</item>
4
+ <item name="tone">4</item>
5
+ </style>
6
+ <style name="gboard_light">
7
+ <item name="color">@android:color/system_neutral1_50</item>
8
+ <item name="tone">-3</item>
9
+ </style>
10
+ </resources>
@@ -0,0 +1,15 @@
1
+ package com.reactnativekeyboardcontroller
2
+
3
+ import com.facebook.react.uimanager.ThemedReactContext
4
+ import com.facebook.react.views.view.ReactViewManager
5
+ import com.reactnativekeyboardcontroller.managers.KeyboardBackgroundViewManagerImpl
6
+ import com.reactnativekeyboardcontroller.views.background.KeyboardBackgroundViewGroup
7
+
8
+ class KeyboardBackgroundViewManager : ReactViewManager() {
9
+ private val manager = KeyboardBackgroundViewManagerImpl()
10
+
11
+ override fun getName(): String = KeyboardBackgroundViewManagerImpl.NAME
12
+
13
+ override fun createViewInstance(reactContext: ThemedReactContext): KeyboardBackgroundViewGroup =
14
+ manager.createViewInstance(reactContext)
15
+ }
@@ -22,6 +22,11 @@ class KeyboardControllerModule(
22
22
  module.setDefaultMode()
23
23
  }
24
24
 
25
+ @ReactMethod
26
+ fun preload() {
27
+ module.preload()
28
+ }
29
+
25
30
  @ReactMethod
26
31
  fun dismiss(keepFocus: Boolean) {
27
32
  module.dismiss(keepFocus)
@@ -1,6 +1,5 @@
1
1
  package com.reactnativekeyboardcontroller
2
2
 
3
- import com.facebook.react.bridge.ReactApplicationContext
4
3
  import com.facebook.react.uimanager.ThemedReactContext
5
4
  import com.facebook.react.uimanager.annotations.ReactProp
6
5
  import com.facebook.react.views.view.ReactViewGroup
@@ -8,10 +7,8 @@ import com.facebook.react.views.view.ReactViewManager
8
7
  import com.reactnativekeyboardcontroller.managers.KeyboardControllerViewManagerImpl
9
8
  import com.reactnativekeyboardcontroller.views.EdgeToEdgeReactViewGroup
10
9
 
11
- class KeyboardControllerViewManager(
12
- mReactContext: ReactApplicationContext,
13
- ) : ReactViewManager() {
14
- private val manager = KeyboardControllerViewManagerImpl(mReactContext)
10
+ class KeyboardControllerViewManager : ReactViewManager() {
11
+ private val manager = KeyboardControllerViewManagerImpl()
15
12
 
16
13
  // region Lifecycle
17
14
  override fun createViewInstance(context: ThemedReactContext): ReactViewGroup = manager.createViewInstance(context)
@@ -1,16 +1,13 @@
1
1
  package com.reactnativekeyboardcontroller
2
2
 
3
- import com.facebook.react.bridge.ReactApplicationContext
4
3
  import com.facebook.react.uimanager.ThemedReactContext
5
4
  import com.facebook.react.uimanager.annotations.ReactProp
6
5
  import com.facebook.react.views.view.ReactViewManager
7
6
  import com.reactnativekeyboardcontroller.managers.KeyboardGestureAreaViewManagerImpl
8
7
  import com.reactnativekeyboardcontroller.views.KeyboardGestureAreaReactViewGroup
9
8
 
10
- class KeyboardGestureAreaViewManager(
11
- mReactContext: ReactApplicationContext,
12
- ) : ReactViewManager() {
13
- private val manager = KeyboardGestureAreaViewManagerImpl(mReactContext)
9
+ class KeyboardGestureAreaViewManager : ReactViewManager() {
10
+ private val manager = KeyboardGestureAreaViewManagerImpl()
14
11
 
15
12
  override fun getName(): String = KeyboardGestureAreaViewManagerImpl.NAME
16
13
 
@@ -1,6 +1,5 @@
1
1
  package com.reactnativekeyboardcontroller
2
2
 
3
- import com.facebook.react.bridge.ReactApplicationContext
4
3
  import com.facebook.react.uimanager.LayoutShadowNode
5
4
  import com.facebook.react.uimanager.ThemedReactContext
6
5
  import com.facebook.react.uimanager.ViewGroupManager
@@ -9,10 +8,8 @@ import com.reactnativekeyboardcontroller.managers.OverKeyboardViewManagerImpl
9
8
  import com.reactnativekeyboardcontroller.views.overlay.OverKeyboardHostShadowNode
10
9
  import com.reactnativekeyboardcontroller.views.overlay.OverKeyboardHostView
11
10
 
12
- class OverKeyboardViewManager(
13
- mReactContext: ReactApplicationContext,
14
- ) : ViewGroupManager<OverKeyboardHostView>() {
15
- private val manager = OverKeyboardViewManagerImpl(mReactContext)
11
+ class OverKeyboardViewManager : ViewGroupManager<OverKeyboardHostView>() {
12
+ private val manager = OverKeyboardViewManagerImpl()
16
13
 
17
14
  override fun getName(): String = OverKeyboardViewManagerImpl.NAME
18
15
 
@@ -5,7 +5,7 @@ import androidx.annotation.RequiresApi
5
5
  import com.facebook.react.bridge.ReactApplicationContext
6
6
  import com.facebook.react.bridge.ReactContextBaseJavaModule
7
7
  import com.facebook.react.bridge.ReactMethod
8
- import com.reactnativekeyboardcontroller.modules.StatusBarManagerCompatModuleImpl
8
+ import com.reactnativekeyboardcontroller.modules.statusbar.StatusBarManagerCompatModuleImpl
9
9
 
10
10
  class StatusBarManagerCompatModule(
11
11
  mReactContext: ReactApplicationContext,
@@ -14,6 +14,8 @@ class StatusBarManagerCompatModule(
14
14
 
15
15
  override fun getName(): String = StatusBarManagerCompatModuleImpl.NAME
16
16
 
17
+ override fun getConstants(): MutableMap<String, Any>? = module.getConstants()
18
+
17
19
  @ReactMethod
18
20
  private fun setHidden(hidden: Boolean) {
19
21
  module.setHidden(hidden)
@@ -7,7 +7,7 @@ import com.facebook.react.module.model.ReactModuleInfo
7
7
  import com.facebook.react.module.model.ReactModuleInfoProvider
8
8
  import com.facebook.react.uimanager.ViewManager
9
9
  import com.reactnativekeyboardcontroller.modules.KeyboardControllerModuleImpl
10
- import com.reactnativekeyboardcontroller.modules.StatusBarManagerCompatModuleImpl
10
+ import com.reactnativekeyboardcontroller.modules.statusbar.StatusBarManagerCompatModuleImpl
11
11
 
12
12
  class KeyboardControllerPackage : TurboReactPackage() {
13
13
  override fun getModule(
@@ -45,7 +45,7 @@ class KeyboardControllerPackage : TurboReactPackage() {
45
45
  ReactModuleInfo(
46
46
  StatusBarManagerCompatModuleImpl.NAME,
47
47
  StatusBarManagerCompatModuleImpl.NAME,
48
- false, // canOverrideExistingModule
48
+ true, // canOverrideExistingModule
49
49
  false, // needsEagerInit
50
50
  true, // hasConstants
51
51
  false, // isCxxModule
@@ -56,8 +56,8 @@ class KeyboardControllerPackage : TurboReactPackage() {
56
56
 
57
57
  override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> =
58
58
  listOf(
59
- KeyboardControllerViewManager(reactContext),
60
- KeyboardGestureAreaViewManager(reactContext),
61
- OverKeyboardViewManager(reactContext),
59
+ KeyboardControllerViewManager(),
60
+ KeyboardGestureAreaViewManager(),
61
+ OverKeyboardViewManager(),
62
62
  )
63
63
  }
@@ -0,0 +1,27 @@
1
+ //
2
+ // RNKCKeyboardBackgroundViewComponentDescriptor.h
3
+ // Pods
4
+ //
5
+ // Created by Kiryl Ziusko on 18/05/2025.
6
+ //
7
+
8
+ #pragma once
9
+
10
+ #include "RNKCKeyboardBackgroundViewShadowNode.h"
11
+
12
+ #include <react/debug/react_native_assert.h>
13
+ #include <react/renderer/components/reactnativekeyboardcontroller/Props.h>
14
+ #include <react/renderer/core/ConcreteComponentDescriptor.h>
15
+
16
+ namespace facebook::react {
17
+ class KeyboardBackgroundViewComponentDescriptor final
18
+ : public ConcreteComponentDescriptor<KeyboardBackgroundViewShadowNode> {
19
+ public:
20
+ using ConcreteComponentDescriptor::ConcreteComponentDescriptor;
21
+ void adopt(ShadowNode &shadowNode) const override {
22
+ react_native_assert(dynamic_cast<KeyboardBackgroundViewShadowNode *>(&shadowNode));
23
+ ConcreteComponentDescriptor::adopt(shadowNode);
24
+ }
25
+ };
26
+
27
+ } // namespace facebook::react
@@ -0,0 +1,14 @@
1
+ //
2
+ // RNKCKeyboardBackgroundViewShadowNode.cpp
3
+ // Pods
4
+ //
5
+ // Created by Kiryl Ziusko on 18/05/2025.
6
+ //
7
+
8
+ #include "RNKCKeyboardBackgroundViewShadowNode.h"
9
+
10
+ namespace facebook::react {
11
+
12
+ extern const char KeyboardBackgroundViewComponentName[] = "KeyboardBackgroundView";
13
+
14
+ } // namespace facebook::react
@@ -0,0 +1,30 @@
1
+ //
2
+ // RNKCKeyboardBackgroundViewShadowNode.h
3
+ // Pods
4
+ //
5
+ // Created by Kiryl Ziusko on 18/05/2025.
6
+ //
7
+
8
+ #pragma once
9
+
10
+ #include "RNKCKeyboardBackgroundViewState.h"
11
+
12
+ #include <react/renderer/components/reactnativekeyboardcontroller/EventEmitters.h>
13
+ #include <react/renderer/components/reactnativekeyboardcontroller/Props.h>
14
+ #include <react/renderer/components/view/ConcreteViewShadowNode.h>
15
+ #include <jsi/jsi.h>
16
+
17
+ namespace facebook::react {
18
+
19
+ JSI_EXPORT extern const char KeyboardBackgroundViewComponentName[];
20
+
21
+ /*
22
+ * `ShadowNode` for <KeyboardBackgroundView> component.
23
+ */
24
+ using KeyboardBackgroundViewShadowNode = ConcreteViewShadowNode<
25
+ KeyboardBackgroundViewComponentName,
26
+ KeyboardBackgroundViewProps,
27
+ KeyboardBackgroundViewEventEmitter,
28
+ KeyboardBackgroundViewState>;
29
+
30
+ } // namespace facebook::react
@@ -0,0 +1,28 @@
1
+ //
2
+ // RNKCKeyboardBackgroundViewState.h
3
+ // Pods
4
+ //
5
+ // Created by Kiryl Ziusko on 18/05/2025.
6
+ //
7
+
8
+ #pragma once
9
+
10
+ #ifdef ANDROID
11
+ #include <folly/dynamic.h>
12
+ #endif
13
+
14
+ namespace facebook::react {
15
+
16
+ class KeyboardBackgroundViewState {
17
+ public:
18
+ KeyboardBackgroundViewState() = default;
19
+
20
+ #ifdef ANDROID
21
+ KeyboardBackgroundViewState(KeyboardBackgroundViewState const &previousState, folly::dynamic data) {}
22
+ folly::dynamic getDynamic() const {
23
+ return {};
24
+ }
25
+ #endif
26
+ };
27
+
28
+ } // namespace facebook::react
@@ -0,0 +1,27 @@
1
+ //
2
+ // RNKCKeyboardExtenderComponentDescriptor.h
3
+ // Pods
4
+ //
5
+ // Created by Kiryl Ziusko on 25/06/2025.
6
+ //
7
+
8
+ #pragma once
9
+
10
+ #include "RNKCKeyboardExtenderShadowNode.h"
11
+
12
+ #include <react/debug/react_native_assert.h>
13
+ #include <react/renderer/components/reactnativekeyboardcontroller/Props.h>
14
+ #include <react/renderer/core/ConcreteComponentDescriptor.h>
15
+
16
+ namespace facebook::react {
17
+ class KeyboardExtenderComponentDescriptor final
18
+ : public ConcreteComponentDescriptor<KeyboardExtenderShadowNode> {
19
+ public:
20
+ using ConcreteComponentDescriptor::ConcreteComponentDescriptor;
21
+ void adopt(ShadowNode &shadowNode) const override {
22
+ react_native_assert(dynamic_cast<KeyboardExtenderShadowNode *>(&shadowNode));
23
+ ConcreteComponentDescriptor::adopt(shadowNode);
24
+ }
25
+ };
26
+
27
+ } // namespace facebook::react
@@ -0,0 +1,14 @@
1
+ //
2
+ // RNKCKeyboardExtenderShadowNode.cpp
3
+ // Pods
4
+ //
5
+ // Created by Kiryl Ziusko on 25/06/2025.
6
+ //
7
+
8
+ #include "RNKCKeyboardExtenderShadowNode.h"
9
+
10
+ namespace facebook::react {
11
+
12
+ extern const char KeyboardExtenderComponentName[] = "KeyboardExtender";
13
+
14
+ } // namespace facebook::react
@@ -0,0 +1,30 @@
1
+ //
2
+ // RNKCKeyboardExtenderShadowNode.h
3
+ // Pods
4
+ //
5
+ // Created by Kiryl Ziusko on 25/06/2025.
6
+ //
7
+
8
+ #pragma once
9
+
10
+ #include "RNKCKeyboardExtenderState.h"
11
+
12
+ #include <react/renderer/components/reactnativekeyboardcontroller/EventEmitters.h>
13
+ #include <react/renderer/components/reactnativekeyboardcontroller/Props.h>
14
+ #include <react/renderer/components/view/ConcreteViewShadowNode.h>
15
+ #include <jsi/jsi.h>
16
+
17
+ namespace facebook::react {
18
+
19
+ JSI_EXPORT extern const char KeyboardExtenderComponentName[];
20
+
21
+ /*
22
+ * `ShadowNode` for <KeyboardExtender> component.
23
+ */
24
+ using KeyboardExtenderShadowNode = ConcreteViewShadowNode<
25
+ KeyboardExtenderComponentName,
26
+ KeyboardExtenderProps,
27
+ KeyboardExtenderEventEmitter,
28
+ KeyboardExtenderState>;
29
+
30
+ } // namespace facebook::react
@@ -0,0 +1,28 @@
1
+ //
2
+ // RNKCKeyboardExtenderState.h
3
+ // Pods
4
+ //
5
+ // Created by Kiryl Ziusko on 25/06/2025.
6
+ //
7
+
8
+ #pragma once
9
+
10
+ #ifdef ANDROID
11
+ #include <folly/dynamic.h>
12
+ #endif
13
+
14
+ namespace facebook::react {
15
+
16
+ class KeyboardExtenderState {
17
+ public:
18
+ KeyboardExtenderState() = default;
19
+
20
+ #ifdef ANDROID
21
+ KeyboardExtenderState(KeyboardExtenderState const &previousState, folly::dynamic data) {}
22
+ folly::dynamic getDynamic() const {
23
+ return {};
24
+ }
25
+ #endif
26
+ };
27
+
28
+ } // namespace facebook::react
@@ -67,6 +67,15 @@ RCT_EXPORT_METHOD(setInputMode : (nonnull NSNumber *)mode)
67
67
  {
68
68
  }
69
69
 
70
+ #ifdef RCT_NEW_ARCH_ENABLED
71
+ - (void)preload
72
+ #else
73
+ RCT_EXPORT_METHOD(preload)
74
+ #endif
75
+ {
76
+ [UIResponder preloadKeyboardIfNeeded];
77
+ }
78
+
70
79
  #ifdef RCT_NEW_ARCH_ENABLED
71
80
  - (void)dismiss:(BOOL)keepFocus
72
81
  #else
@@ -54,7 +54,7 @@ class KCTextInputCompositeDelegate: NSObject, UITextViewDelegate, UITextFieldDel
54
54
  // Keep track of which textField we’re observing (iOS < 13 only)
55
55
  private weak var observedTextFieldForSelection: UITextField?
56
56
 
57
- public init(
57
+ init(
58
58
  onSelectionChange: @escaping (_ event: NSDictionary) -> Void,
59
59
  onTextChange: @escaping (_ text: String?) -> Void
60
60
  ) {
@@ -64,7 +64,7 @@ class KCTextInputCompositeDelegate: NSObject, UITextViewDelegate, UITextFieldDel
64
64
 
65
65
  // MARK: setters/getters
66
66
 
67
- public func setTextViewDelegate(delegate: UITextViewDelegate?) {
67
+ func setTextViewDelegate(delegate: UITextViewDelegate?) {
68
68
  // remove KVO from any old textView
69
69
  if let oldTextField = observedTextFieldForSelection {
70
70
  removeSelectionRangeObserver(from: oldTextField)
@@ -75,7 +75,7 @@ class KCTextInputCompositeDelegate: NSObject, UITextViewDelegate, UITextFieldDel
75
75
  observedTextFieldForSelection = nil
76
76
  }
77
77
 
78
- public func setTextFieldDelegate(delegate: UITextFieldDelegate?, textField: UITextField?) {
78
+ func setTextFieldDelegate(delegate: UITextFieldDelegate?, textField: UITextField?) {
79
79
  // remove KVO from any old textField
80
80
  if let oldTextField = observedTextFieldForSelection {
81
81
  removeSelectionRangeObserver(from: oldTextField)
@@ -96,7 +96,7 @@ class KCTextInputCompositeDelegate: NSObject, UITextViewDelegate, UITextFieldDel
96
96
  }
97
97
  }
98
98
 
99
- public func canSubstituteTextFieldDelegate(delegate: UITextFieldDelegate?) -> Bool {
99
+ func canSubstituteTextFieldDelegate(delegate: UITextFieldDelegate?) -> Bool {
100
100
  let type = String(describing: delegate)
101
101
  if type.range(of: "SQIPTextFieldInputModifier") != nil {
102
102
  // SQIPTextFieldInputModifier is a private class used internally by Square.
@@ -112,7 +112,7 @@ class KCTextInputCompositeDelegate: NSObject, UITextViewDelegate, UITextFieldDel
112
112
  }
113
113
 
114
114
  // Getter for the active delegate
115
- public var activeDelegate: AnyObject? {
115
+ var activeDelegate: AnyObject? {
116
116
  return textViewDelegate ?? textFieldDelegate
117
117
  }
118
118
 
@@ -17,7 +17,7 @@ public func buildEventParams(_ height: Double, _ duration: Int, _ tag: NSNumber)
17
17
  data["timestamp"] = Date.currentTimeStamp
18
18
  data["target"] = tag
19
19
  data["type"] = input?.keyboardType.name ?? "default"
20
- data["appearance"] = input?.keyboardAppearance.name ?? "default"
20
+ data["appearance"] = input?.keyboardAppearanceValue ?? "light"
21
21
 
22
22
  return data
23
23
  }
@@ -0,0 +1,12 @@
1
+ //
2
+ // String.swift
3
+ // Pods
4
+ //
5
+ // Created by Kiryl Ziusko on 10/06/2025.
6
+ //
7
+
8
+ public extension String {
9
+ func hasAnyPrefix(_ prefixes: [String]) -> Bool {
10
+ prefixes.contains { hasPrefix($0) }
11
+ }
12
+ }
@@ -63,3 +63,30 @@ public extension Optional where Wrapped: UIResponder {
63
63
  return -1
64
64
  }
65
65
  }
66
+
67
+ @objc
68
+ public extension UIResponder {
69
+ private static var hasPreloadedKeyboard = false
70
+ static var isKeyboardPreloading = false
71
+
72
+ /// Preloads the keyboard UI to reduce first-time lag when showing a keyboard.
73
+ /// https://stackoverflow.com/questions/9357026/super-slow-lag-delay-on-initial-keyboard-animation-of-uitextfield/20436797#20436797
74
+ static func preloadKeyboardIfNeeded() {
75
+ guard !hasPreloadedKeyboard else { return }
76
+ hasPreloadedKeyboard = true
77
+ isKeyboardPreloading = true
78
+
79
+ DispatchQueue.main.async {
80
+ defer { isKeyboardPreloading = false }
81
+ guard let window = UIApplication.shared.activeWindow else { return }
82
+
83
+ let lagFreeField = UITextField(frame: .zero)
84
+ lagFreeField.isHidden = true
85
+ window.addSubview(lagFreeField)
86
+
87
+ lagFreeField.becomeFirstResponder()
88
+ lagFreeField.resignFirstResponder()
89
+ lagFreeField.removeFromSuperview()
90
+ }
91
+ }
92
+ }
@@ -8,7 +8,7 @@
8
8
  class KeyboardAreaExtender: NSObject {
9
9
  private var currentInputAccessoryView: InvisibleInputAccessoryView?
10
10
 
11
- @objc public static let shared = KeyboardAreaExtender()
11
+ @objc static let shared = KeyboardAreaExtender()
12
12
 
13
13
  override private init() {
14
14
  super.init()
@@ -24,11 +24,11 @@ class KeyboardAreaExtender: NSObject {
24
24
  NotificationCenter.default.removeObserver(self)
25
25
  }
26
26
 
27
- public var offset: CGFloat {
27
+ var offset: CGFloat {
28
28
  return currentInputAccessoryView?.frame.height ?? 0
29
29
  }
30
30
 
31
- public func hide() {
31
+ func hide() {
32
32
  if isVisible {
33
33
  NotificationCenter.default.post(
34
34
  name: .shouldIgnoreKeyboardEvents, object: nil, userInfo: ["ignore": true]
@@ -37,11 +37,11 @@ class KeyboardAreaExtender: NSObject {
37
37
  }
38
38
  }
39
39
 
40
- public func remove() {
40
+ func remove() {
41
41
  currentInputAccessoryView = nil
42
42
  }
43
43
 
44
- public func updateHeight(to newHeight: CGFloat, for nativeID: String) {
44
+ func updateHeight(to newHeight: CGFloat, for nativeID: String) {
45
45
  if UIResponder.current.nativeID == nativeID {
46
46
  currentInputAccessoryView?.updateHeight(to: newHeight)
47
47
  }
@@ -140,6 +140,11 @@ public class FocusedInputObserver: NSObject {
140
140
  currentInput = currentResponder?.superview as UIView?
141
141
 
142
142
  setupObservers()
143
+ // dispatch onSelectionChange on focus
144
+ if let textInput = responder as? UITextInput {
145
+ updateSelectionPosition(textInput: textInput, sendEvent: onSelectionChange)
146
+ }
147
+
143
148
  syncUpLayout()
144
149
 
145
150
  FocusedInputHolder.shared.set(currentResponder as? TextInput)
@@ -211,7 +216,15 @@ public class FocusedInputObserver: NSObject {
211
216
  self.onLayoutChange(view: view, change: change)
212
217
  }
213
218
 
214
- substituteDelegate(currentResponder)
219
+ // Substitute a delegate in the next frame.
220
+ // This is only applicable if the autoFocus prop is true.
221
+ // Other libraries (e.g., decorator views) might mount *after* the
222
+ // TextInput and inject their own delegates at that point.
223
+ // If we substitute our delegate too early (e.g., during autoFocus), and later restore it when the keyboard hides,
224
+ // we may accidentally overwrite a delegate injected by another library — breaking its logic.
225
+ DispatchQueue.main.async {
226
+ self.substituteDelegate(self.currentResponder)
227
+ }
215
228
  }
216
229
  }
217
230
 
@@ -240,10 +253,6 @@ public class FocusedInputObserver: NSObject {
240
253
  textView.setForceDelegate(delegate)
241
254
  }
242
255
  }
243
- // dispatch onSelectionChange on focus
244
- if let textInput = input as? UITextInput {
245
- updateSelectionPosition(textInput: textInput, sendEvent: onSelectionChange)
246
- }
247
256
  }
248
257
 
249
258
  private func substituteDelegateBack(_ input: UIResponder?) {