react-native-keyboard-controller 1.19.1 → 1.19.2
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.
|
@@ -15,6 +15,7 @@ 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?
|
|
18
|
+
private var isAttaching = false
|
|
18
19
|
|
|
19
20
|
static let invalidPosition: CGFloat = -.greatestFiniteMagnitude
|
|
20
21
|
|
|
@@ -55,12 +56,14 @@ final class KeyboardTrackingView: UIView {
|
|
|
55
56
|
name: UIResponder.keyboardDidShowNotification,
|
|
56
57
|
object: nil
|
|
57
58
|
)
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
59
|
+
attachToTopmostView()
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
override func willMove(toWindow newWindow: UIWindow?) {
|
|
63
|
+
// When the view is being removed from the window, we need to re-attach it
|
|
64
|
+
if newWindow == nil, !isAttaching {
|
|
65
|
+
attachToTopmostView()
|
|
66
|
+
}
|
|
64
67
|
}
|
|
65
68
|
|
|
66
69
|
@objc private func attachToTopmostView() {
|
|
@@ -68,6 +71,7 @@ final class KeyboardTrackingView: UIView {
|
|
|
68
71
|
|
|
69
72
|
if currentAttachedView === topView { return }
|
|
70
73
|
|
|
74
|
+
isAttaching = true
|
|
71
75
|
removeFromSuperview()
|
|
72
76
|
|
|
73
77
|
topView.addSubview(self)
|
|
@@ -87,6 +91,7 @@ final class KeyboardTrackingView: UIView {
|
|
|
87
91
|
heightAnchor.constraint(equalToConstant: 0),
|
|
88
92
|
])
|
|
89
93
|
}
|
|
94
|
+
isAttaching = false
|
|
90
95
|
}
|
|
91
96
|
|
|
92
97
|
@objc private func keyboardWillAppear(_ notification: Notification) {
|
package/package.json
CHANGED