react-native-keyboard-controller 1.19.0 → 1.19.1
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.
|
@@ -221,4 +221,17 @@ class KCTextInputCompositeDelegate: NSObject, UITextViewDelegate, UITextFieldDel
|
|
|
221
221
|
}
|
|
222
222
|
return super.forwardingTarget(for: aSelector)
|
|
223
223
|
}
|
|
224
|
+
|
|
225
|
+
override func doesNotRecognizeSelector(_ aSelector: Selector!) {
|
|
226
|
+
let className = NSStringFromClass(type(of: self))
|
|
227
|
+
let selectorName = NSStringFromSelector(aSelector)
|
|
228
|
+
|
|
229
|
+
print("⚠️ [\(className)] does not recognize selector: \(selectorName)")
|
|
230
|
+
|
|
231
|
+
if let delegate = activeDelegate {
|
|
232
|
+
print("ℹ️ activeDelegate: \(type(of: delegate)) (responds: \(delegate.responds(to: aSelector)))")
|
|
233
|
+
} else {
|
|
234
|
+
print("ℹ️ activeDelegate is nil")
|
|
235
|
+
}
|
|
236
|
+
}
|
|
224
237
|
}
|
|
@@ -11,6 +11,11 @@ import UIKit
|
|
|
11
11
|
|
|
12
12
|
public extension UITextInput {
|
|
13
13
|
var canSelectionFitIntoLayout: Bool {
|
|
14
|
+
guard let textView = self as? UITextView else { return true }
|
|
15
|
+
|
|
16
|
+
// Force layout to ensure accurate rect calculation
|
|
17
|
+
textView.layoutManager.ensureLayout(for: textView.textContainer)
|
|
18
|
+
|
|
14
19
|
guard let selectedRange = selectedTextRange else { return false }
|
|
15
20
|
|
|
16
21
|
guard let range = textRange(from: selectedRange.start, to: selectedRange.end) else { return false }
|
|
@@ -14,6 +14,7 @@ import UIKit
|
|
|
14
14
|
final class KeyboardTrackingView: UIView {
|
|
15
15
|
private var keyboardView: UIView? { KeyboardViewLocator.shared.resolve() }
|
|
16
16
|
private var keyboardHeight = 0.0
|
|
17
|
+
private weak var currentAttachedView: UIView?
|
|
17
18
|
|
|
18
19
|
static let invalidPosition: CGFloat = -.greatestFiniteMagnitude
|
|
19
20
|
|
|
@@ -54,27 +55,35 @@ final class KeyboardTrackingView: UIView {
|
|
|
54
55
|
name: UIResponder.keyboardDidShowNotification,
|
|
55
56
|
object: nil
|
|
56
57
|
)
|
|
58
|
+
NotificationCenter.default.addObserver(
|
|
59
|
+
self,
|
|
60
|
+
selector: #selector(attachToTopmostView),
|
|
61
|
+
name: UIWindow.didBecomeVisibleNotification,
|
|
62
|
+
object: nil
|
|
63
|
+
)
|
|
64
|
+
}
|
|
57
65
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
return
|
|
63
|
-
}
|
|
66
|
+
@objc private func attachToTopmostView() {
|
|
67
|
+
guard let topView = UIApplication.topViewController()?.view else { return }
|
|
68
|
+
|
|
69
|
+
if currentAttachedView === topView { return }
|
|
64
70
|
|
|
65
|
-
|
|
71
|
+
removeFromSuperview()
|
|
72
|
+
|
|
73
|
+
topView.addSubview(self)
|
|
74
|
+
currentAttachedView = topView
|
|
66
75
|
|
|
67
76
|
translatesAutoresizingMaskIntoConstraints = false
|
|
68
77
|
|
|
69
78
|
if #available(iOS 15.0, *) {
|
|
70
79
|
if #available(iOS 17.0, *) {
|
|
71
|
-
|
|
80
|
+
topView.keyboardLayoutGuide.usesBottomSafeArea = false
|
|
72
81
|
}
|
|
73
82
|
|
|
74
83
|
NSLayoutConstraint.activate([
|
|
75
|
-
leadingAnchor.constraint(equalTo:
|
|
76
|
-
trailingAnchor.constraint(equalTo:
|
|
77
|
-
bottomAnchor.constraint(equalTo:
|
|
84
|
+
leadingAnchor.constraint(equalTo: topView.leadingAnchor, constant: 0),
|
|
85
|
+
trailingAnchor.constraint(equalTo: topView.trailingAnchor, constant: 0),
|
|
86
|
+
bottomAnchor.constraint(equalTo: topView.keyboardLayoutGuide.topAnchor, constant: 0),
|
|
78
87
|
heightAnchor.constraint(equalToConstant: 0),
|
|
79
88
|
])
|
|
80
89
|
}
|
|
@@ -113,6 +122,9 @@ final class KeyboardTrackingView: UIView {
|
|
|
113
122
|
|
|
114
123
|
// for `keyboardLayoutGuide` case we can just read keyboard position directly - no interpolation needed
|
|
115
124
|
if #available(iOS 26.0, *) {
|
|
125
|
+
if keyboardPosition > keyboardHeight {
|
|
126
|
+
return Self.invalidPosition
|
|
127
|
+
}
|
|
116
128
|
// when we are the top position KVO takes `inputAccessoryView` into consideration,
|
|
117
129
|
// so we handle it here
|
|
118
130
|
if keyboardPosition == keyboardHeight {
|
|
@@ -70,7 +70,7 @@ private class BaseContainerView: UIInputView {
|
|
|
70
70
|
// Override in subclasses
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
override
|
|
73
|
+
override var intrinsicContentSize: CGSize {
|
|
74
74
|
return CGSize(width: UIView.noIntrinsicMetric, height: frame.height)
|
|
75
75
|
}
|
|
76
76
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-keyboard-controller",
|
|
3
|
-
"version": "1.19.
|
|
3
|
+
"version": "1.19.1",
|
|
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",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"typescript": "tsc --noEmit --project tsconfig.build.json",
|
|
42
42
|
"lint": "eslint --quiet \"**/*.{js,ts,tsx}\"",
|
|
43
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
|
-
"prepare": "bob build",
|
|
44
|
+
"prepare": "bob build > /dev/null 2>&1",
|
|
45
45
|
"release": "release-it",
|
|
46
46
|
"example": "yarn --cwd example",
|
|
47
47
|
"pods": "cd example && pod-install --quiet",
|
|
@@ -85,8 +85,8 @@
|
|
|
85
85
|
},
|
|
86
86
|
"devDependencies": {
|
|
87
87
|
"@commitlint/config-conventional": "^11.0.0",
|
|
88
|
-
"@react-native/babel-preset": "0.
|
|
89
|
-
"@react-native/eslint-config": "0.
|
|
88
|
+
"@react-native/babel-preset": "0.81.4",
|
|
89
|
+
"@react-native/eslint-config": "0.81.4",
|
|
90
90
|
"@release-it/conventional-changelog": "^2.0.0",
|
|
91
91
|
"@testing-library/react-hooks": "^8.0.1",
|
|
92
92
|
"@types/jest": "^29.5.13",
|
|
@@ -112,12 +112,12 @@
|
|
|
112
112
|
"pod-install": "^0.1.0",
|
|
113
113
|
"prettier": "^2.8.8",
|
|
114
114
|
"react": "19.1.0",
|
|
115
|
-
"react-native": "0.
|
|
115
|
+
"react-native": "0.81.4",
|
|
116
116
|
"react-native-builder-bob": "^0.18.0",
|
|
117
|
-
"react-native-reanimated": "3.
|
|
117
|
+
"react-native-reanimated": "3.19.2",
|
|
118
118
|
"react-test-renderer": "19.0.0",
|
|
119
119
|
"release-it": "^14.2.2",
|
|
120
|
-
"typescript": "5.
|
|
120
|
+
"typescript": "5.8.3"
|
|
121
121
|
},
|
|
122
122
|
"peerDependencies": {
|
|
123
123
|
"react": "*",
|