react-native-keyboard-controller 1.19.3 → 1.19.5

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.
@@ -26,6 +26,10 @@ def isNewArchitectureEnabled() {
26
26
  return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
27
27
  }
28
28
 
29
+ def isEdgeToEdgeEnabled() {
30
+ return project.hasProperty("edgeToEdgeEnabled") && project.edgeToEdgeEnabled == "true"
31
+ }
32
+
29
33
  def reactNativeArchitectures() {
30
34
  def value = project.getProperties().get("reactNativeArchitectures")
31
35
  return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
@@ -55,6 +59,7 @@ android {
55
59
  versionCode 1
56
60
  versionName "1.0"
57
61
  buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
62
+ buildConfigField "boolean", "IS_EDGE_TO_EDGE_ENABLED", isEdgeToEdgeEnabled().toString()
58
63
  ndk {
59
64
  abiFilters (*reactNativeArchitectures())
60
65
  }
@@ -9,6 +9,7 @@ import androidx.core.view.WindowInsetsCompat
9
9
  import androidx.core.view.WindowInsetsControllerCompat
10
10
  import com.facebook.react.bridge.ReactApplicationContext
11
11
  import com.facebook.react.bridge.UiThreadUtil
12
+ import com.reactnativekeyboardcontroller.BuildConfig
12
13
  import com.reactnativekeyboardcontroller.log.Logger
13
14
  import com.reactnativekeyboardcontroller.views.EdgeToEdgeReactViewGroup
14
15
  import com.reactnativekeyboardcontroller.views.EdgeToEdgeViewRegistry
@@ -38,6 +39,7 @@ class StatusBarManagerCompatModuleImpl(
38
39
  }
39
40
 
40
41
  @SuppressLint("ObsoleteSdkInt")
42
+ @Suppress("detekt:ReturnCount")
41
43
  fun setColor(
42
44
  color: Int,
43
45
  animated: Boolean,
@@ -47,6 +49,11 @@ class StatusBarManagerCompatModuleImpl(
47
49
  return original.setColor(color.toDouble(), animated)
48
50
  }
49
51
 
52
+ if (BuildConfig.IS_EDGE_TO_EDGE_ENABLED) {
53
+ Logger.w(TAG, "StatusBarModule: Ignored status bar change, current activity is edge-to-edge.")
54
+ return
55
+ }
56
+
50
57
  val activity = mReactContext.currentActivity
51
58
  if (activity == null) {
52
59
  Logger.w(
@@ -79,6 +86,11 @@ class StatusBarManagerCompatModuleImpl(
79
86
  return original.setTranslucent(translucent)
80
87
  }
81
88
 
89
+ if (BuildConfig.IS_EDGE_TO_EDGE_ENABLED) {
90
+ Logger.w(TAG, "StatusBarModule: Ignored status bar change, current activity is edge-to-edge.")
91
+ return
92
+ }
93
+
82
94
  UiThreadUtil.runOnUiThread {
83
95
  view()?.forceStatusBarTranslucent(translucent)
84
96
  }
@@ -11,7 +11,7 @@ import UIKit
11
11
  * A compatibility view that resolves to `KeyboardView` on iOS < 26
12
12
  * and uses `keyboardLayoutGuide` on iOS 26+.
13
13
  */
14
- final class KeyboardTrackingView: UIView {
14
+ public final class KeyboardTrackingView: UIView {
15
15
  private var keyboardView: UIView? { KeyboardViewLocator.shared.resolve() }
16
16
  private var keyboardHeight = 0.0
17
17
  private weak var currentAttachedView: UIView?
@@ -56,18 +56,17 @@ final class KeyboardTrackingView: UIView {
56
56
  name: UIResponder.keyboardDidShowNotification,
57
57
  object: nil
58
58
  )
59
- attachToTopmostView()
60
59
  }
61
60
 
62
- override func willMove(toWindow newWindow: UIWindow?) {
61
+ override public func willMove(toWindow newWindow: UIWindow?) {
63
62
  // When the view is being removed from the window, we need to re-attach it
64
63
  if newWindow == nil, !isAttaching {
65
64
  attachToTopmostView()
66
65
  }
67
66
  }
68
67
 
69
- @objc private func attachToTopmostView() {
70
- guard let topView = UIApplication.topViewController()?.view else { return }
68
+ @objc public func attachToTopmostView(toWindow window: UIWindow? = nil) {
69
+ guard let topView = (window?.rootViewController ?? UIApplication.topViewController())?.view else { return }
71
70
 
72
71
  if currentAttachedView === topView { return }
73
72
 
@@ -18,7 +18,7 @@ public class KeyboardMovementObserver: NSObject {
18
18
  var onRequestAnimation: () -> Void
19
19
  var onCancelAnimation: () -> Void
20
20
  // progress tracker
21
- var keyboardTrackingView = KeyboardTrackingView()
21
+ @objc public var keyboardTrackingView = KeyboardTrackingView()
22
22
  var animation: KeyboardAnimation?
23
23
 
24
24
  var prevKeyboardPosition = 0.0
@@ -259,6 +259,14 @@ using namespace facebook::react;
259
259
  }
260
260
  }
261
261
 
262
+ - (void)didMoveToWindow
263
+ {
264
+ [super didMoveToWindow];
265
+ if (self.window) {
266
+ [keyboardObserver.keyboardTrackingView attachToTopmostViewToWindow:self.window];
267
+ }
268
+ }
269
+
262
270
  - (void)mount
263
271
  {
264
272
  [inputObserver mount];
@@ -85,6 +85,13 @@ class KeyboardControllerView: UIView {
85
85
  }
86
86
  }
87
87
 
88
+ override func didMoveToWindow() {
89
+ super.didMoveToWindow()
90
+ if window != nil {
91
+ keyboardObserver?.keyboardTrackingView.attachToTopmostView(toWindow: window)
92
+ }
93
+ }
94
+
88
95
  override func layoutSubviews() {
89
96
  super.layoutSubviews()
90
97
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-keyboard-controller",
3
- "version": "1.19.3",
3
+ "version": "1.19.5",
4
4
  "description": "Keyboard manager which works in identical way on both iOS and Android",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -40,7 +40,7 @@
40
40
  "test": "jest",
41
41
  "typescript": "tsc --noEmit --project tsconfig.build.json",
42
42
  "lint": "eslint --quiet \"**/*.{js,ts,tsx}\"",
43
- "lint-clang": "find ios/ -iname *.h -o -iname *.m -o -iname *.mm | grep -v -e Pods -e build | xargs clang-format -i --Werror",
43
+ "lint-clang": "find ios/ -iname *.h -o -iname *.m -o -iname *.mm | grep -v -e Pods -e build | xargs clang-format -i -n --Werror",
44
44
  "prepare": "bob build > /dev/null 2>&1",
45
45
  "release": "release-it",
46
46
  "example": "yarn --cwd example",