@devries-cameron20 / t3code-1 / commits / d0b9e9d3c7
Fork 0

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

fix(mobile): the Duo header blur reaches a vertical bar on the left too (#24807)

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

Julius Marminge committed Oct 25, 2026 at 10:41 UTC d0b9e9d3c72b83bb92670fc1fa3afac5bf60e4e8
2 files changed +55 -34
apps/mobile/modules/t3-native-controls/ios/T3ScrollEdgeBleedView.swift
+49 -29
@@ -2,16 +2,18 @@ import ExpoModulesCore
2 import UIKit
3
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.
5 +/// vertical bar, this widens the scroll view under the bar, like the system apps' lists. UIKit
6 +/// draws the header's scroll-edge effect inside the scroll view, so the blur reaches the bar while
7 +/// the content stays in the safe area. Everything happens in UIKit layout, so folds move the blur
8 +/// and the content together.
9 final class T3ScrollEdgeBleedView: ExpoView {
10 // Fabric recycles scroll views, so everything changed here is put back before this view leaves
11 // the window, which unmounting does before any recycling.
12 private var scrollView: UIScrollView?
13 private var container: UIView?
14 - private var bleed: CGFloat = 0
14 + /// React Native's content view, which every row lives in.
15 + private var content: UIView?
16 + private var bleed = UIEdgeInsets.zero
17 /// Whether the scroll view currently carries this view's changes.
18 private var applied = false
19 /// React Native's clipping, saved while bleeding. React Native only rewrites it when the
@@ -55,55 +57,72 @@ final class T3ScrollEdgeBleedView: ExpoView {
57 detach()
58 scrollView = found
59 container = parent
60 + // React Native adds one plain UIView to its scroll view and mounts every child into it.
61 + content = found.subviews.first { type(of: $0) == UIView.self }
62 }
63 bleed = verticalBarBleed()
64 + // Without the content view to shift back, bleeding left would move the rows under the bar.
65 + if content == nil { bleed.left = 0 }
66 apply()
67 }
68
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 + /// How far the vertical bar's safe area reaches past this view's edge, when this view sits flush
70 + /// against the padding its column added for it. Nothing else is bled into: not a sidebar column
71 + /// overlapping this one, and not a notch.
72 + private func verticalBarBleed() -> UIEdgeInsets {
73 + guard let side = verticalBarSide() else { return .zero }
74 var ancestor = superview
75 while let view = ancestor {
71 - let inset = view.safeAreaInsets.right
76 + let inset = side == .left ? view.safeAreaInsets.left : view.safeAreaInsets.right
77 if inset > 0 {
78 let frame = convert(bounds, to: view)
74 - return abs(view.bounds.maxX - inset - frame.maxX) < 0.5 ? inset : 0
79 + let flush = side == .left
80 + ? abs(frame.minX - (view.bounds.minX + inset)) < 0.5
81 + : abs(view.bounds.maxX - inset - frame.maxX) < 0.5
82 + guard flush else { return .zero }
83 + return side == .left
84 + ? UIEdgeInsets(top: 0, left: inset, bottom: 0, right: 0)
85 + : UIEdgeInsets(top: 0, left: 0, bottom: 0, right: inset)
86 }
87 ancestor = view.superview
88 }
78 - return 0
89 + return .zero
90 }
91
81 - private func verticalBarIsOnTheRight() -> Bool {
92 + private enum Side { case left, right }
93 +
94 + private func verticalBarSide() -> Side? {
95 // The vertical-bar API ships in the iOS 27.1 SDK (UIKit 9127.0.85); see T3LayoutMetricsView.
96 #if canImport(UIKit, _version: 9127.0.85)
97 if #available(iOS 27.1, *) {
98 let rtl = effectiveUserInterfaceLayoutDirection == .rightToLeft
99 switch traitCollection.verticalBarEdge {
87 - case .leading: return rtl
88 - case .trailing: return !rtl
89 - default: return false
100 + case .leading: return rtl ? .right : .left
101 + case .trailing: return rtl ? .left : .right
102 + default: return nil
103 }
104 }
105 #endif
93 - return false
106 + return nil
107 }
108
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.
109 + /// Widening to the left would move the rows with it. Instead of a horizontal content offset,
110 + /// which React Native rewrites on its own layout passes, the content view's bounds origin shifts
111 + /// them back: React Native only ever sets that view's frame, which leaves its bounds origin.
112 + /// Nothing at all is written unless this view is bleeding or undoing its bleed.
113 private func apply() {
114 guard let scrollView, let container else { return }
101 - guard bleed > 0 || applied else { return }
115 + let bleeding = bleed != .zero
116 + guard bleeding || applied else { return }
117 // React Native sizes the scroll view's component view; the UIScrollView inside follows it by
118 // autoresizing, so the widened frame survives React Native's own layout updates.
104 - let frame = container.bounds.inset(by: UIEdgeInsets(top: 0, left: 0, bottom: 0, right: -bleed))
119 + let frame = container.bounds.inset(
120 + by: UIEdgeInsets(top: 0, left: -bleed.left, bottom: 0, right: -bleed.right))
121 if scrollView.frame != frame { scrollView.frame = frame }
106 - if bleed == 0 {
122 + if let content, content.bounds.origin.x != -bleed.left {
123 + content.bounds.origin.x = -bleed.left
124 + }
125 + if !bleeding {
126 if let clipped = containerClipped {
127 containerClipped = nil
128 container.layer.masksToBounds = clipped
@@ -115,19 +134,20 @@ final class T3ScrollEdgeBleedView: ExpoView {
134 container.layer.masksToBounds = false
135 }
136 var indicators = scrollView.verticalScrollIndicatorInsets
118 - if indicators.right != bleed {
119 - indicators.right = bleed
137 + if indicators.right != bleed.right {
138 + indicators.right = bleed.right
139 scrollView.verticalScrollIndicatorInsets = indicators
140 }
122 - applied = bleed > 0
141 + applied = bleeding
142 }
143
144 private func detach() {
145 guard scrollView != nil else { return }
127 - bleed = 0
146 + bleed = .zero
147 apply()
148 scrollView = nil
149 container = nil
150 + content = nil
151 }
152
153 /// The scroll view sits a fixed few levels down (marker, React Native's scroll view component);
docs/internals/mobile-navigation.md
+6 -5
@@ -53,11 +53,12 @@ preserves behavior that is easy to break when changing native headers:
53 columns pad their content away from the iPhone Duo's vertical bar. Register a
54 header scroll view only through
55 [`NativeScrollViewMarker`](../../apps/mobile/src/native/NativeScrollViewMarker.tsx)
56 - or `NativeScrollView`: their native wrapper widens the scroll view to the right
57 - under that bar, so the blur reaches it while the content keeps its React Native
58 - frame. It never bleeds left: that would need a horizontal content offset, which
59 - React Native rewrites on its own layout passes. Lint rejects `ScrollViewMarker`
60 - imported anywhere else.
56 + or `NativeScrollView`: their native wrapper widens the scroll view under that
57 + bar, so the blur reaches it while the content stays in the safe area. On the
58 + left it shifts React Native's content view back through its bounds origin,
59 + never with a content offset: React Native rewrites offsets on its own layout
60 + passes, which left threads shifted under the bar. Lint rejects
61 + `ScrollViewMarker` imported anywhere else.
62
63 The patch adds native header props that require code generation and a new binary.
64 Patch rebuild guidance lives in the