From ae84d6ea0fde304431488e8d7ba354469c7a79f1 Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Wed, 17 Jun 2026 16:08:49 -0700 Subject: [PATCH] fix(input-accessory): ensure scroll edge is used on ios 26+ --- .../ios/src/KeyboardTrackingView.swift | 29 ++++++++++++++----- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/packages/input-accessory/platforms/ios/src/KeyboardTrackingView.swift b/packages/input-accessory/platforms/ios/src/KeyboardTrackingView.swift index 940f1045..b53336f0 100644 --- a/packages/input-accessory/platforms/ios/src/KeyboardTrackingView.swift +++ b/packages/input-accessory/platforms/ios/src/KeyboardTrackingView.swift @@ -141,14 +141,7 @@ public class KeyboardTrackingView: UIView { self._keyboardAccessoryView = accessoryContainer - // On iOS 26+, add scroll edge blending so the bottom of the ScrollView - // fades into the glass accessory (like Apple Notes / iMessage). - if #available(iOS 26.0, *) { - let edgeInteraction = UIScrollEdgeElementContainerInteraction() - edgeInteraction.scrollView = scrollView - edgeInteraction.edge = .bottom - accessoryContainer.addInteraction(edgeInteraction) - } + addScrollEdgeElementContainerInteractionIfAvailable(to: accessoryContainer, scrollView: scrollView) // Set up scroll view for interactive dismiss scrollView.keyboardDismissMode = .interactive @@ -176,6 +169,26 @@ public class KeyboardTrackingView: UIView { self?.becomeFirstResponder() } } + + private func addScrollEdgeElementContainerInteractionIfAvailable(to containerView: UIView, scrollView: UIScrollView) { + guard #available(iOS 26.0, *) else { return } + + // UIScrollEdgeElementContainerInteraction is an iOS 26 SDK symbol. Resolve + // it dynamically so the plugin still compiles with Xcode 16.x / iOS 18.x SDKs. + let interactionClass = ( + NSClassFromString("UIScrollEdgeElementContainerInteraction") + ?? NSClassFromString("UIKit.UIScrollEdgeElementContainerInteraction") + ) as? NSObject.Type + + guard let interactionClass = interactionClass else { return } + + let interaction = interactionClass.init() + interaction.setValue(scrollView, forKey: "scrollView") + interaction.setValue(NSNumber(value: UIRectEdge.bottom.rawValue), forKey: "edge") + + guard let edgeInteraction = interaction as? UIInteraction else { return } + containerView.addInteraction(edgeInteraction) + } /** * Set the callback for relayouting ScrollView content