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
16 changes: 16 additions & 0 deletions ios/core/KeyboardControllerConfiguration.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// KeyboardControllerConfiguration.swift
// Pods
//
// Created by Kiryl Ziusko on 25/06/2026.
//

enum KeyboardControllerConfiguration {
static var usesKeyboardLayoutGuideTracking: Bool {
if #available(iOS 26.0, *) {
return true
}

return false
}
}
10 changes: 6 additions & 4 deletions ios/observers/movement/KeyboardTrackingView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import UIKit

/**
* A compatibility view that resolves to `KeyboardView` on iOS < 26
* and uses `keyboardLayoutGuide` on iOS 26+.
* A compatibility view that resolves to `KeyboardView` for the legacy path
* and uses `keyboardLayoutGuide` for configured iOS 26+ behavior.
*/
public final class KeyboardTrackingView: UIView {
private var keyboardView: UIView? {
Expand Down Expand Up @@ -69,6 +69,8 @@ public final class KeyboardTrackingView: UIView {
}

@objc public func attachToTopmostView(toWindow window: UIWindow? = nil) {
guard KeyboardControllerConfiguration.usesKeyboardLayoutGuideTracking else { return }

var topViewController = window?.rootViewController
if let rootVC = topViewController, let topView = rootVC.view, topView.window != nil {
// ok, attach
Expand Down Expand Up @@ -120,7 +122,7 @@ public final class KeyboardTrackingView: UIView {
}

@objc var view: UIView? {
if #available(iOS 26.0, *) {
if KeyboardControllerConfiguration.usesKeyboardLayoutGuideTracking {
return self
} else {
return keyboardView
Expand All @@ -135,7 +137,7 @@ public final class KeyboardTrackingView: UIView {
let keyboardPosition = keyboardWindowH - keyboardFrameY

// for `keyboardLayoutGuide` case we can just read keyboard position directly - no interpolation needed
if #available(iOS 26.0, *) {
if KeyboardControllerConfiguration.usesKeyboardLayoutGuideTracking {
if keyboardPosition > keyboardHeight {
return Self.invalidPosition
}
Expand Down
Loading