@devries-cameron20 / t3code Mirror · read-only / commits / 3478e56b0b
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 22, 03:15 UTC

fix(mobile): iPad composer drops when the keyboard floats or minimizes (#31251)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Julius Marminge committed Nov 5, 2026 at 16:30 UTC 3478e56b0bd1f9daa49fdb6c6666107dcefcc64c
2 files changed +90 -3
patches/react-native-keyboard-controller@1.22.8.patch
+87
@@ -1,3 +1,90 @@
1 +diff --git a/ios/observers/movement/observer/KeyboardMovementObserver+Lifecycle.swift b/ios/observers/movement/observer/KeyboardMovementObserver+Lifecycle.swift
2 +index cdbd633..41a72bc 100644
3 +--- a/ios/observers/movement/observer/KeyboardMovementObserver+Lifecycle.swift
4 ++++ b/ios/observers/movement/observer/KeyboardMovementObserver+Lifecycle.swift
5 +@@ -25,6 +25,12 @@ public extension KeyboardMovementObserver {
6 + name: UIResponder.keyboardWillShowNotification,
7 + object: nil
8 + )
9 ++ NotificationCenter.default.addObserver(
10 ++ self,
11 ++ selector: #selector(keyboardWillChangeFrame),
12 ++ name: UIResponder.keyboardWillChangeFrameNotification,
13 ++ object: nil
14 ++ )
15 + }
16 +
17 + @objc func unmount() {
18 +diff --git a/ios/observers/movement/observer/KeyboardMovementObserver+Listeners.swift b/ios/observers/movement/observer/KeyboardMovementObserver+Listeners.swift
19 +index 545a5b2..fbdc984 100644
20 +--- a/ios/observers/movement/observer/KeyboardMovementObserver+Listeners.swift
21 ++++ b/ios/observers/movement/observer/KeyboardMovementObserver+Listeners.swift
22 +@@ -8,6 +8,12 @@
23 + extension KeyboardMovementObserver {
24 + @objc func keyboardWillAppear(_ notification: Notification) {
25 + guard !UIResponder.isKeyboardPreloading else { return }
26 ++ floatingHideTask?.cancel()
27 ++
28 ++ if isFloatingKeyboard(notification) {
29 ++ hideIfKeyboardShown(notification)
30 ++ return
31 ++ }
32 +
33 + let (duration, frame) = notification.keyboardMetaData()
34 + if let keyboardFrame = frame {
35 +@@ -36,8 +42,40 @@ extension KeyboardMovementObserver {
36 + }
37 + }
38 +
39 ++ @objc func keyboardWillChangeFrame(_ notification: Notification) {
40 ++ guard !UIResponder.isKeyboardPreloading, isFloatingKeyboard(notification) else { return }
41 ++ // runs after a willShow/willHide posted with this notification, which cancel it, so hide events fire once
42 ++ floatingHideTask?.cancel()
43 ++ let task = DispatchWorkItem { [weak self] in
44 ++ self?.hideIfKeyboardShown(notification)
45 ++ }
46 ++ floatingHideTask = task
47 ++ DispatchQueue.main.async(execute: task)
48 ++ }
49 ++
50 ++ // iPadOS floating and minimized keyboards are narrower than the screen or end above the app's bottom, so
51 ++ // they cover no app content; UIKit switches to them without willHide, so they must count as hidden.
52 ++ private func isFloatingKeyboard(_ notification: Notification) -> Bool {
53 ++ guard let frame = notification.keyboardMetaData().1?.cgRectValue, !frame.isEmpty else { return false }
54 ++ let screen = (notification.object as? UIScreen ?? UIScreen.main).bounds
55 ++ // in Slide Over a docked keyboard ends at the app window's bottom, above the screen's
56 ++ let windowBottom = UIApplication.shared.activeWindow.map {
57 ++ $0.convert($0.bounds, to: $0.screen.coordinateSpace).maxY
58 ++ } ?? screen.height
59 ++ let dockedBottom = min(screen.height, windowBottom)
60 ++ return frame.width.rounded() < screen.width.rounded() || frame.maxY.rounded() < dockedBottom.rounded()
61 ++ }
62 ++
63 ++ private func hideIfKeyboardShown(_ notification: Notification) {
64 ++ let targetHeight = self.notification?.keyboardMetaData().1?.cgRectValue.height ?? 0
65 ++ if targetHeight > 0 {
66 ++ keyboardWillDisappear(notification)
67 ++ }
68 ++ }
69 ++
70 + @objc func keyboardWillDisappear(_ notification: Notification) {
71 + guard !UIResponder.isKeyboardPreloading else { return }
72 ++ floatingHideTask?.cancel()
73 + let (duration, _) = notification.keyboardMetaData()
74 + tag = UIResponder.current.reactViewTag
75 + self.notification = notification
76 +diff --git a/ios/observers/movement/observer/KeyboardMovementObserver.swift b/ios/observers/movement/observer/KeyboardMovementObserver.swift
77 +index ae97d61..2ea1d2d 100644
78 +--- a/ios/observers/movement/observer/KeyboardMovementObserver.swift
79 ++++ b/ios/observers/movement/observer/KeyboardMovementObserver.swift
80 +@@ -37,6 +37,7 @@ public class KeyboardMovementObserver: NSObject {
81 + // manual did events
82 + var notification: Notification?
83 + var keyboardDidTask: DispatchWorkItem?
84 ++ var floatingHideTask: DispatchWorkItem?
85 +
86 + @objc public init(
87 + handler: @escaping (NSString, NSNumber, NSNumber, NSNumber, NSNumber) -> Void,
88 diff --git a/lib/commonjs/components/KeyboardChatScrollView/index.js b/lib/commonjs/components/KeyboardChatScrollView/index.js
89 index 0b78ff3..98b3b6c 100644
90 --- a/lib/commonjs/components/KeyboardChatScrollView/index.js
pnpm-lock.yaml
+3 -3
@@ -384,7 +384,7 @@ patchedDependencies:
384 node-pty@1.2.0-beta.15: f1e680afec85f650699ea756f91f469844ec4c976f4f168492a45c6b3f67d651
385 react-native-gesture-handler@3.3.0: abe20e1d1c23549297cbbc818e14fe479b41455930d9663135d6b40fe359b626
386 react-native-image-viewing@0.2.2: 4aa038d541c7ddcc8f1437eb3e7b4f769f61de78e7f91b53f9805dfca608474d
387 - react-native-keyboard-controller@1.22.8: 6eb6c847ac693b636ec97c83575acd44b77e92ad0d2c776de0cb4e78e8fb9d4f
387 + react-native-keyboard-controller@1.22.8: 3fa3d03e203a23165a439c4cddf5372ccd53acf337389793211be64dcdafccef
388 react-native-pdf-jsi@5.0.0: 6f52854210f61bef499850ebd498229a111bc34ec5b2a4925e644f2f48f42760
389 react-native-reanimated@4.7.1: 95ee26e5fcab5f50bc4b4c47b3f7e6278a0b20850205efb9f6ee7e70a22d2b59
390 react-native-webview@14.0.1: 81caa279ec3dc1f81209062133b66e8f824e13f106cca57f1fa732a72c2ab378
@@ -745,7 +745,7 @@ importers:
745 version: 0.2.2(patch_hash=4aa038d541c7ddcc8f1437eb3e7b4f769f61de78e7f91b53f9805dfca608474d)(react-native@0.88.0(@babel/core@7.29.7(supports-color@8.1.1))(@react-native/metro-config@0.88.0(@babel/core@7.29.7(supports-color@8.1.1))(bufferutil@4.1.0)(supports-color@8.1.1)(utf-8-validate@6.0.6))(@types/react@19.3.0)(bufferutil@4.1.0)(react@19.3.0)(supports-color@8.1.1)(utf-8-validate@6.0.6))(react@19.3.0)
746 react-native-keyboard-controller:
747 specifier: 1.22.8
748 - version: 1.22.8(patch_hash=6eb6c847ac693b636ec97c83575acd44b77e92ad0d2c776de0cb4e78e8fb9d4f)(e2a826d844fe10cdcbda558127861778)
748 + version: 1.22.8(patch_hash=3fa3d03e203a23165a439c4cddf5372ccd53acf337389793211be64dcdafccef)(e2a826d844fe10cdcbda558127861778)
749 react-native-nitro-modules:
750 specifier: 0.37.1
751 version: 0.37.1(react-native@0.88.0(@babel/core@7.29.7(supports-color@8.1.1))(@react-native/metro-config@0.88.0(@babel/core@7.29.7(supports-color@8.1.1))(bufferutil@4.1.0)(supports-color@8.1.1)(utf-8-validate@6.0.6))(@types/react@19.3.0)(bufferutil@4.1.0)(react@19.3.0)(supports-color@8.1.1)(utf-8-validate@6.0.6))(react@19.3.0)
@@ -21272,7 +21272,7 @@ snapshots:
21272 react: 19.3.0
21273 react-native: 0.88.0(@babel/core@7.29.7(supports-color@8.1.1))(@react-native/metro-config@0.88.0(@babel/core@7.29.7(supports-color@8.1.1))(bufferutil@4.1.0)(supports-color@8.1.1)(utf-8-validate@6.0.6))(@types/react@19.3.0)(bufferutil@4.1.0)(react@19.3.0)(supports-color@8.1.1)(utf-8-validate@6.0.6)
21274
21275 - react-native-keyboard-controller@1.22.8(patch_hash=6eb6c847ac693b636ec97c83575acd44b77e92ad0d2c776de0cb4e78e8fb9d4f)(e2a826d844fe10cdcbda558127861778):
21275 + react-native-keyboard-controller@1.22.8(patch_hash=3fa3d03e203a23165a439c4cddf5372ccd53acf337389793211be64dcdafccef)(e2a826d844fe10cdcbda558127861778):
21276 dependencies:
21277 react: 19.3.0
21278 react-native: 0.88.0(@babel/core@7.29.7(supports-color@8.1.1))(@react-native/metro-config@0.88.0(@babel/core@7.29.7(supports-color@8.1.1))(bufferutil@4.1.0)(supports-color@8.1.1)(utf-8-validate@6.0.6))(@types/react@19.3.0)(bufferutil@4.1.0)(react@19.3.0)(supports-color@8.1.1)(utf-8-validate@6.0.6)