react-native-keyboard-controller 1.19.2 → 1.19.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/build.gradle +5 -0
- package/android/src/main/java/com/reactnativekeyboardcontroller/modules/statusbar/StatusBarManagerCompatModuleImpl.kt +12 -0
- package/ios/extensions/NSObject.swift +12 -0
- package/ios/extensions/UIResponder.swift +1 -5
- package/ios/extensions/UITextInput.swift +7 -4
- package/ios/objc/NSObject+SafeKVC.h +12 -0
- package/ios/objc/NSObject+SafeKVC.m +19 -0
- package/ios/observers/movement/KeyboardTrackingView.swift +6 -1
- package/package.json +1 -1
package/android/build.gradle
CHANGED
|
@@ -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
|
}
|
|
@@ -30,11 +30,7 @@ public extension Optional where Wrapped == UIResponder {
|
|
|
30
30
|
guard let superview = (self as? UIView)?.superview else { return nil }
|
|
31
31
|
|
|
32
32
|
#if KEYBOARD_CONTROLLER_NEW_ARCH_ENABLED
|
|
33
|
-
|
|
34
|
-
return (superview as NSObject).value(forKey: "nativeId") as? String
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return nil
|
|
33
|
+
return superview.safeValue(forKey: "nativeId") as? String
|
|
38
34
|
#else
|
|
39
35
|
return superview.nativeID
|
|
40
36
|
#endif
|
|
@@ -11,10 +11,13 @@ import UIKit
|
|
|
11
11
|
|
|
12
12
|
public extension UITextInput {
|
|
13
13
|
var canSelectionFitIntoLayout: Bool {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
if let selfObj = self as? NSObject,
|
|
15
|
+
let delegate = selfObj.safeValue(forKey: "textInputDelegate") as? NSObject,
|
|
16
|
+
let comingFromJS = delegate.safeValue(forKey: "_comingFromJS") as? Bool,
|
|
17
|
+
comingFromJS
|
|
18
|
+
{
|
|
19
|
+
return false
|
|
20
|
+
}
|
|
18
21
|
|
|
19
22
|
guard let selectedRange = selectedTextRange else { return false }
|
|
20
23
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//
|
|
2
|
+
// NSObject+SafeKVC.m
|
|
3
|
+
// KeyboardController
|
|
4
|
+
//
|
|
5
|
+
// Created by Kiryl Ziusko on 26/10/2025.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#import "NSObject+SafeKVC.h"
|
|
9
|
+
|
|
10
|
+
@implementation NSObject (SafeKVC)
|
|
11
|
+
- (id)_safeValueForKey:(NSString *)key
|
|
12
|
+
{
|
|
13
|
+
@try {
|
|
14
|
+
return [self valueForKey:key];
|
|
15
|
+
} @catch (NSException *exception) {
|
|
16
|
+
return nil;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
@end
|
|
@@ -56,7 +56,12 @@ final class KeyboardTrackingView: UIView {
|
|
|
56
56
|
name: UIResponder.keyboardDidShowNotification,
|
|
57
57
|
object: nil
|
|
58
58
|
)
|
|
59
|
-
|
|
59
|
+
NotificationCenter.default.addObserver(
|
|
60
|
+
self,
|
|
61
|
+
selector: #selector(attachToTopmostView),
|
|
62
|
+
name: UIApplication.didBecomeActiveNotification,
|
|
63
|
+
object: nil
|
|
64
|
+
)
|
|
60
65
|
}
|
|
61
66
|
|
|
62
67
|
override func willMove(toWindow newWindow: UIWindow?) {
|
package/package.json
CHANGED