@devries-cameron20 / t3code-1 / commits / 90c455ff8f
Fork 0

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

fix(mobile): every Duo header blurs under the vertical bar, from one place (#24671)

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

Julius Marminge committed Oct 24, 2026 at 20:32 UTC 90c455ff8fceef426bafc64c0b755ef864a353ab
10 files changed +172 -7
apps/mobile/modules/t3-native-controls/ios/T3NativeControlsModule.swift
+4
@@ -46,6 +46,10 @@ public final class T3NativeControlsModule: Module {
46 Events("onMetricsChange")
47 }
48
49 + View(T3ScrollEdgeBleedView.self) {
50 + ViewName("ScrollEdgeBleed")
51 + }
52 +
53 AsyncFunction("presentVideo") { (url: URL, title: String, sourceIdentifier: String, identifier: String, promise: Promise) in
54 try self.presentVideo(
55 url: url,
apps/mobile/modules/t3-native-controls/ios/T3ScrollEdgeBleedView.swift new
+125
@@ -0,0 +1,125 @@
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
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.
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 = UIEdgeInsets.zero
15 + /// React Native's clipping, saved while bleeding. React Native only rewrites it when the
16 + /// `overflow` style changes, so it stays off while bleeding.
17 + private var containerClipped: Bool?
18 +
19 + deinit {
20 + MainActor.assumeIsolated { detach() }
21 + }
22 +
23 + override func didMoveToWindow() {
24 + super.didMoveToWindow()
25 + if window == nil { detach() } else { setNeedsLayout() }
26 + }
27 +
28 + override func didAddSubview(_ subview: UIView) {
29 + super.didAddSubview(subview)
30 + setNeedsLayout()
31 + }
32 +
33 + override func willRemoveSubview(_ subview: UIView) {
34 + if let scrollView, scrollView.isDescendant(of: subview) { detach() }
35 + super.willRemoveSubview(subview)
36 + }
37 +
38 + override func layoutSubviews() {
39 + super.layoutSubviews()
40 + guard window != nil, let found = findScrollView(), let parent = found.superview else { return }
41 + if found !== scrollView {
42 + detach()
43 + scrollView = found
44 + container = parent
45 + }
46 + bleed = flushSafeAreaBand()
47 + apply()
48 + }
49 +
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 {
53 + var ancestor = superview
54 + while let view = ancestor {
55 + let insets = view.safeAreaInsets
56 + if insets.left > 0 || insets.right > 0 {
57 + 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)
62 + }
63 + ancestor = view.superview
64 + }
65 + return .zero
66 + }
67 +
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.
70 + private func apply() {
71 + guard let scrollView, let container else { return }
72 + // React Native sizes the scroll view's component view; the UIScrollView inside follows it by
73 + // 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))
75 + if scrollView.frame != frame { scrollView.frame = frame }
76 + if bleed == .zero {
77 + if let clipped = containerClipped {
78 + containerClipped = nil
79 + container.layer.masksToBounds = clipped
80 + }
81 + } else if container.layer.masksToBounds {
82 + // The component view clips to its own bounds, which would cut the widened scroll view back.
83 + // The scroll view itself still clips its content.
84 + containerClipped = containerClipped ?? true
85 + container.layer.masksToBounds = false
86 + }
87 + var inset = scrollView.contentInset
88 + if inset.left != bleed.left {
89 + inset.left = bleed.left
90 + scrollView.contentInset = inset
91 + }
92 + var indicators = scrollView.verticalScrollIndicatorInsets
93 + if indicators.right != bleed.right {
94 + indicators.right = bleed.right
95 + scrollView.verticalScrollIndicatorInsets = indicators
96 + }
97 + let x = -scrollView.adjustedContentInset.left
98 + if scrollView.contentOffset.x != x {
99 + scrollView.contentOffset = CGPoint(x: x, y: scrollView.contentOffset.y)
100 + }
101 + }
102 +
103 + private func detach() {
104 + guard scrollView != nil else { return }
105 + bleed = .zero
106 + apply()
107 + scrollView = nil
108 + container = nil
109 + }
110 +
111 + /// The scroll view sits a fixed few levels down (marker, React Native's scroll view component);
112 + /// never walk into a scroll view's content.
113 + private func findScrollView() -> UIScrollView? {
114 + var level: [UIView] = subviews
115 + for _ in 0..<4 {
116 + var next: [UIView] = []
117 + for view in level {
118 + if let scrollView = view as? UIScrollView { return scrollView }
119 + next.append(contentsOf: view.subviews)
120 + }
121 + level = next
122 + }
123 + return nil
124 + }
125 +}
apps/mobile/src/features/home/HomeScreen.tsx
+1 -1
@@ -27,7 +27,7 @@ import {
27 type NativeScrollEvent,
28 type NativeSyntheticEvent,
29 } from "react-native";
30 -import { ScrollViewMarker } from "react-native-screens";
30 +import { NativeScrollViewMarker as ScrollViewMarker } from "../../native/NativeScrollViewMarker";
31 import { GestureDetector, useNativeGesture } from "react-native-gesture-handler";
32 import type { SwipeableMethods } from "react-native-gesture-handler/ReanimatedSwipeable";
33 import { useSafeAreaInsets } from "react-native-safe-area-context";
apps/mobile/src/features/pull-requests/PullRequestReviewersScreen.tsx
+1 -1
@@ -17,7 +17,7 @@ import {
17 type ScrollViewProps,
18 } from "react-native";
19 import { useSafeAreaInsets } from "react-native-safe-area-context";
20 -import { ScrollViewMarker } from "react-native-screens";
20 +import { NativeScrollViewMarker as ScrollViewMarker } from "../../native/NativeScrollViewMarker";
21 import { AppText as Text, AppTextInput as TextInput } from "../../components/ui/AppText";
22 import { EmptyState } from "../../components/ui/EmptyState";
23 import { Button } from "../../components/ui/Button";
apps/mobile/src/features/pull-requests/PullRequestsScreen.tsx
+1 -1
@@ -16,7 +16,7 @@ import {
16 View,
17 type ScrollViewProps,
18 } from "react-native";
19 -import { ScrollViewMarker } from "react-native-screens";
19 +import { NativeScrollViewMarker as ScrollViewMarker } from "../../native/NativeScrollViewMarker";
20 import { useSafeAreaInsets } from "react-native-safe-area-context";
21
22 import { AppText as Text } from "../../components/ui/AppText";
apps/mobile/src/features/threads/ThreadRouteScreen.tsx
+2 -1
@@ -28,7 +28,8 @@ import {
28 projectScriptTerminalInput,
29 resolveProjectScripts,
30 } from "@t3tools/shared/projectScripts";
31 -import { Platform, ScrollView } from "react-native";
31 +import { Platform } from "react-native";
32 +import { ScreenScrollView as ScrollView } from "../../components/ui/ScreenScrollView";
33 import { useSafeAreaInsets } from "react-native-safe-area-context";
34 import { useConnectionsReady } from "../../state/workspace";
35 import { useEnvironmentShellReadiness } from "../../state/shell";
apps/mobile/src/features/usage/UsageLimitsPooled.tsx
+2 -1
@@ -15,7 +15,8 @@ import {
15 type LimitPoolWindow,
16 } from "@t3tools/shared/usageLimits";
17 import { Fragment, type ReactNode, useId, useState } from "react";
18 -import { Linking, Pressable, ScrollView, View } from "react-native";
18 +import { Linking, Pressable, View } from "react-native";
19 +import { ScreenScrollView as ScrollView } from "../../components/ui/ScreenScrollView";
20 import { Defs, Path, Pattern, Rect, Svg } from "react-native-svg";
21 import { useSafeAreaInsets } from "react-native-safe-area-context";
22
apps/mobile/src/native/NativeScrollViewMarker.tsx
+23 -2
@@ -1,5 +1,7 @@
1 +import { requireNativeView, requireOptionalNativeModule } from "expo";
2 import { createContext, use, type ComponentProps } from "react";
2 -import { Platform, ScrollView } from "react-native";
3 +import { Platform, ScrollView, type ViewProps } from "react-native";
4 +// oxlint-disable-next-line eslint/no-restricted-imports -- The wrapper every screen must use.
5 import { ScrollViewMarker } from "react-native-screens";
6 import { nativeHeaderScrollEdgeEffects } from "./scrollEdgeEffects";
7
@@ -9,14 +11,33 @@ const DEFAULT_SCROLL_EDGE_EFFECTS = nativeHeaderScrollEdgeEffects(Platform.OS, P
11
12 export const NativeScrollEdgeEffectsContext = createContext<ScrollEdgeEffects>(undefined);
13
14 +function resolveScrollEdgeBleed() {
15 + try {
16 + const module = requireOptionalNativeModule<{
17 + readonly ViewPrototypes?: { readonly T3NativeControls_ScrollEdgeBleed?: unknown };
18 + }>("T3NativeControls");
19 + if (!module?.ViewPrototypes?.T3NativeControls_ScrollEdgeBleed) return null;
20 + return requireNativeView<ViewProps>("T3NativeControls", "ScrollEdgeBleed");
21 + } catch {
22 + return null;
23 + }
24 +}
25 +// Widens the scroll view under the side safe areas its column pads away (the Duo's vertical bar),
26 +// so the header's scroll-edge blur, which UIKit draws inside the scroll view, reaches the bar
27 +// while the content stays in the safe area. Every header scroll view comes through here.
28 +const ScrollEdgeBleed = Platform.OS === "ios" ? resolveScrollEdgeBleed() : null;
29 +
30 +/** Registers a screen's scroll view with its header. The only way to do so: see the lint rule. */
31 export function NativeScrollViewMarker(props: ComponentProps<typeof ScrollViewMarker>) {
32 const effects = use(NativeScrollEdgeEffectsContext);
14 - return (
33 + const marker = (
34 <ScrollViewMarker
35 {...props}
36 + {...(ScrollEdgeBleed ? { style: { flex: 1 } } : {})}
37 scrollEdgeEffects={props.scrollEdgeEffects ?? effects ?? DEFAULT_SCROLL_EDGE_EFFECTS}
38 />
39 );
40 + return ScrollEdgeBleed ? <ScrollEdgeBleed style={props.style}>{marker}</ScrollEdgeBleed> : marker;
41 }
42
43 export function NativeScrollView(props: ComponentProps<typeof ScrollView>) {
docs/internals/mobile-navigation.md
+7
@@ -23,6 +23,13 @@ preserves behavior that is easy to break when changing native headers:
23 - A horizontal ScrollView at its leading edge must yield to the full-screen back
24 gesture. Upstream gives every horizontal ScrollView priority, so swiping back
25 on a code block or table can only bounce its content.
26 +- UIKit draws the header's scroll-edge blur inside the scroll view, and workspace
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.
33
34 The patch adds native header props that require code generation and a new binary.
35 Patch rebuild guidance lives in the
vite.config.ts
+6
@@ -39,6 +39,12 @@ const RESTRICTED_IMPORT_PATHS = [
39 importNames: ["CodeView"],
40 message: "Use StyledDiffCodeView so web diff surfaces share styling and virtualized geometry.",
41 },
42 + {
43 + name: "react-native-screens",
44 + importNames: ["ScrollViewMarker"],
45 + message:
46 + "Use NativeScrollViewMarker or NativeScrollView (src/native/NativeScrollViewMarker.tsx): they carry the header's scroll-edge blur under the Duo's vertical bar.",
47 + },
48 ];
49
50 const RESTRICTED_UI_VARIANT_PATTERNS = [