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, 18:15 UTC
fix(mobile): Duo threads no longer open shifted left (#24732)
Julius Marminge committed
Oct 24, 2026 at 21:20 UTC
a0e0f8a80ae4caa6c32d3306a10a284e252c88d3
2 files changed
+57
-33
apps/mobile/modules/t3-native-controls/ios/T3ScrollEdgeBleedView.swift
+52
-30
@@ -1,8 +1,8 @@
1
import ExpoModulesCore
2
import UIKit
3
4
-/// Wraps a screen's header scroll view. Where a column pads its content away from a side safe
5
-/// area (the iPhone Duo's vertical bar), this widens the scroll view under that band. UIKit draws
4
+/// Wraps a screen's header scroll view. Where a column pads its content away from the iPhone Duo's
5
+/// vertical bar, this widens the scroll view under the bar. UIKit draws
6
/// the header's scroll-edge effect inside the scroll view, so the blur reaches the bar like in the
7
/// system apps while the content stays in the safe area. Everything happens in UIKit layout, so
8
/// folds move the blur and the content together.
@@ -11,11 +11,24 @@ final class T3ScrollEdgeBleedView: ExpoView {
11
// the window, which unmounting does before any recycling.
12
private var scrollView: UIScrollView?
13
private var container: UIView?
14
- private var bleed = UIEdgeInsets.zero
14
+ private var bleed: CGFloat = 0
15
+ /// Whether the scroll view currently carries this view's changes.
16
+ private var applied = false
17
/// React Native's clipping, saved while bleeding. React Native only rewrites it when the
18
/// `overflow` style changes, so it stays off while bleeding.
19
private var containerClipped: Bool?
20
21
+ required init(appContext: AppContext? = nil) {
22
+ super.init(appContext: appContext)
23
+ #if canImport(UIKit, _version: 9127.0.85)
24
+ if #available(iOS 27.1, *) {
25
+ registerForTraitChanges(UITraitCollection.systemTraitsAffectingVerticalBarEdge) { (view: T3ScrollEdgeBleedView, _: UITraitCollection) in
26
+ view.setNeedsLayout()
27
+ }
28
+ }
29
+ #endif
30
+ }
31
+
32
deinit {
33
MainActor.assumeIsolated { detach() }
34
}
@@ -43,37 +56,54 @@ final class T3ScrollEdgeBleedView: ExpoView {
56
scrollView = found
57
container = parent
58
}
46
- bleed = flushSafeAreaBand()
59
+ bleed = verticalBarBleed()
60
apply()
61
}
62
50
- /// The side safe areas this view sits flush against: an ancestor padded its content away from
51
- /// them. Only those bands are bled into, so a screen with its own margins is left alone.
52
- private func flushSafeAreaBand() -> UIEdgeInsets {
63
+ /// How far the vertical bar's safe area reaches past this view's right edge, when this view sits
64
+ /// flush against the padding its column added for it. Nothing else is bled into: not a sidebar
65
+ /// column overlapping this one, not a notch, and not a bar on the left, where widening would
66
+ /// move the content and need a horizontal offset React Native keeps rewriting.
67
+ private func verticalBarBleed() -> CGFloat {
68
+ guard verticalBarIsOnTheRight() else { return 0 }
69
var ancestor = superview
70
while let view = ancestor {
55
- let insets = view.safeAreaInsets
56
- if insets.left > 0 || insets.right > 0 {
71
+ let inset = view.safeAreaInsets.right
72
+ if inset > 0 {
73
let frame = convert(bounds, to: view)
58
- let left = insets.left > 0 && abs(frame.minX - insets.left) < 0.5 ? insets.left : 0
59
- let right = insets.right > 0 && abs(view.bounds.maxX - insets.right - frame.maxX) < 0.5
60
- ? insets.right : 0
61
- return UIEdgeInsets(top: 0, left: left, bottom: 0, right: right)
74
+ return abs(view.bounds.maxX - inset - frame.maxX) < 0.5 ? inset : 0
75
}
76
ancestor = view.superview
77
}
65
- return .zero
78
+ return 0
79
+ }
80
+
81
+ private func verticalBarIsOnTheRight() -> Bool {
82
+ // The vertical-bar API ships in the iOS 27.1 SDK (UIKit 9127.0.85); see T3LayoutMetricsView.
83
+ #if canImport(UIKit, _version: 9127.0.85)
84
+ if #available(iOS 27.1, *) {
85
+ let rtl = effectiveUserInterfaceLayoutDirection == .rightToLeft
86
+ switch traitCollection.verticalBarEdge {
87
+ case .leading: return rtl
88
+ case .trailing: return !rtl
89
+ default: return false
90
+ }
91
+ }
92
+ #endif
93
+ return false
94
}
95
68
- /// Widening to the right leaves the content in place. Widening to the left moves it with the
69
- /// frame, so a left inset and offset put it back.
96
+ /// Widening to the right leaves the content where React Native laid it out, so only the frame,
97
+ /// the container's clipping and the scroll indicator change; contentInset and contentOffset are
98
+ /// never touched. Nothing at all is written unless this view is bleeding or undoing its bleed.
99
private func apply() {
100
guard let scrollView, let container else { return }
101
+ guard bleed > 0 || applied else { return }
102
// React Native sizes the scroll view's component view; the UIScrollView inside follows it by
103
// autoresizing, so the widened frame survives React Native's own layout updates.
74
- let frame = container.bounds.inset(by: UIEdgeInsets(top: 0, left: -bleed.left, bottom: 0, right: -bleed.right))
104
+ let frame = container.bounds.inset(by: UIEdgeInsets(top: 0, left: 0, bottom: 0, right: -bleed))
105
if scrollView.frame != frame { scrollView.frame = frame }
76
- if bleed == .zero {
106
+ if bleed == 0 {
107
if let clipped = containerClipped {
108
containerClipped = nil
109
container.layer.masksToBounds = clipped
@@ -84,25 +114,17 @@ final class T3ScrollEdgeBleedView: ExpoView {
114
containerClipped = containerClipped ?? true
115
container.layer.masksToBounds = false
116
}
87
- var inset = scrollView.contentInset
88
- if inset.left != bleed.left {
89
- inset.left = bleed.left
90
- scrollView.contentInset = inset
91
- }
117
var indicators = scrollView.verticalScrollIndicatorInsets
93
- if indicators.right != bleed.right {
94
- indicators.right = bleed.right
118
+ if indicators.right != bleed {
119
+ indicators.right = bleed
120
scrollView.verticalScrollIndicatorInsets = indicators
121
}
97
- let x = -scrollView.adjustedContentInset.left
98
- if scrollView.contentOffset.x != x {
99
- scrollView.contentOffset = CGPoint(x: x, y: scrollView.contentOffset.y)
100
- }
122
+ applied = bleed > 0
123
}
124
125
private func detach() {
126
guard scrollView != nil else { return }
105
- bleed = .zero
127
+ bleed = 0
128
apply()
129
scrollView = nil
130
container = nil
docs/internals/mobile-navigation.md
+5
-3
@@ -27,9 +27,11 @@ preserves behavior that is easy to break when changing native headers:
27
columns pad their content away from the iPhone Duo's vertical bar. Register a
28
header scroll view only through
29
[`NativeScrollViewMarker`](../../apps/mobile/src/native/NativeScrollViewMarker.tsx)
30
- or `NativeScrollView`: their native wrapper widens the scroll view under that
31
- band and insets its content by the same amount, so the blur reaches the bar and
32
- the content does not. Lint rejects `ScrollViewMarker` imported anywhere else.
30
+ or `NativeScrollView`: their native wrapper widens the scroll view to the right
31
+ under that bar, so the blur reaches it while the content keeps its React Native
32
+ frame. It never bleeds left: that would need a horizontal content offset, which
33
+ React Native rewrites on its own layout passes. Lint rejects `ScrollViewMarker`
34
+ imported anywhere else.
35
36
The patch adds native header props that require code generation and a new binary.
37
Patch rebuild guidance lives in the