Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually a bug spotted by e2e tests that was introduced in 1.19.4. The onMove handler wasn't working, so KeyboardAwareScrollView wasn't functioning properly πŸ˜“

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified e2e/kit/assets/ios/iPhone 17 Pro/InteractiveKeyboardIsShown.png
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is wrong, but we know that interactive keyboard doesn't work as expected. See #1140

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 4 additions & 10 deletions ios/observers/movement/KeyboardTrackingView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import UIKit
* A compatibility view that resolves to `KeyboardView` on iOS < 26
* and uses `keyboardLayoutGuide` on iOS 26+.
*/
final class KeyboardTrackingView: UIView {
public final class KeyboardTrackingView: UIView {
private var keyboardView: UIView? { KeyboardViewLocator.shared.resolve() }
private var keyboardHeight = 0.0
private weak var currentAttachedView: UIView?
Expand Down Expand Up @@ -56,23 +56,17 @@ final class KeyboardTrackingView: UIView {
name: UIResponder.keyboardDidShowNotification,
object: nil
)
NotificationCenter.default.addObserver(
self,
selector: #selector(attachToTopmostView),
name: UIApplication.didBecomeActiveNotification,
object: nil
)
}

override func willMove(toWindow newWindow: UIWindow?) {
override public func willMove(toWindow newWindow: UIWindow?) {
// When the view is being removed from the window, we need to re-attach it
if newWindow == nil, !isAttaching {
attachToTopmostView()
}
}

@objc private func attachToTopmostView() {
guard let topView = UIApplication.topViewController()?.view else { return }
@objc public func attachToTopmostView(toWindow window: UIWindow? = nil) {
guard let topView = (window?.rootViewController ?? UIApplication.topViewController())?.view else { return }

if currentAttachedView === topView { return }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class KeyboardMovementObserver: NSObject {
var onRequestAnimation: () -> Void
var onCancelAnimation: () -> Void
// progress tracker
var keyboardTrackingView = KeyboardTrackingView()
@objc public var keyboardTrackingView = KeyboardTrackingView()
var animation: KeyboardAnimation?

var prevKeyboardPosition = 0.0
Expand Down
8 changes: 8 additions & 0 deletions ios/views/KeyboardControllerView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,14 @@ - (void)willMoveToSuperview:(UIView *)newSuperview
}
}

- (void)didMoveToWindow
{
[super didMoveToWindow];
if (self.window) {
[keyboardObserver.keyboardTrackingView attachToTopmostViewToWindow:self.window];
}
}

- (void)mount
{
[inputObserver mount];
Expand Down
7 changes: 7 additions & 0 deletions ios/views/KeyboardControllerViewManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ class KeyboardControllerView: UIView {
}
}

override func didMoveToWindow() {
super.didMoveToWindow()
if window != nil {
keyboardObserver?.keyboardTrackingView.attachToTopmostView(toWindow: window)
}
}

override func layoutSubviews() {
super.layoutSubviews()

Expand Down
Loading