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 23, 18:00 UTC
fix(mobile): align diff scrolling with glass headers (#17085)
Julius Marminge committed
Oct 7, 2026 at 23:15 UTC
97a65a3121c11801a877897928efc51ef40fa49f
3 files changed
+32
-25
apps/mobile/modules/t3-review-diff/ios/T3ReviewDiffView.swift
+18
-11
@@ -563,7 +563,7 @@ public final class T3ReviewDiffView: ExpoView, UIScrollViewDelegate {
563
])
564
}
565
566
- // Source files fill the screen so UIKit can sample content below the glass bar.
566
+ // Code surfaces fill the screen so UIKit can sample content below the glass bar.
567
// Keep the same visible row when header or safe-area reservations change.
568
func setContentInsetTop(_ inset: CGFloat) {
569
scrollView.automaticallyAdjustsScrollIndicatorInsets = false
@@ -571,6 +571,7 @@ public final class T3ReviewDiffView: ExpoView, UIScrollViewDelegate {
571
let delta = inset - scrollView.contentInset.top
572
guard delta != 0 else { return }
573
scrollView.contentInset.top = inset
574
+ contentView.topContentInset = inset
575
scrollView.verticalScrollIndicatorInsets.top = inset
576
scrollView.contentOffset.y -= delta
577
updateViewportFrame()
@@ -618,8 +619,12 @@ public final class T3ReviewDiffView: ExpoView, UIScrollViewDelegate {
619
if let scrollAnchor,
620
let headerOffset = contentView.fileHeaderOffset(forFileId: scrollAnchor.fileId) {
621
let targetOffset = headerOffset - scrollAnchor.screenY
621
- let maxOffset = max(scrollView.contentSize.height - scrollView.bounds.height, 0)
622
- let clampedOffset = min(max(targetOffset, 0), maxOffset)
622
+ let minOffset = -scrollView.contentInset.top
623
+ let maxOffset = max(
624
+ scrollView.contentSize.height - scrollView.bounds.height + scrollView.contentInset.bottom,
625
+ minOffset
626
+ )
627
+ let clampedOffset = min(max(targetOffset, minOffset), maxOffset)
628
scrollView.setContentOffset(CGPoint(x: 0, y: clampedOffset), animated: false)
629
updateViewportFrame()
630
}
@@ -735,7 +740,8 @@ public final class T3ReviewDiffView: ExpoView, UIScrollViewDelegate {
740
// The top of the combined diff is the explicit "All files" destination.
741
// Treat it as a first-class selection instead of immediately resolving the
742
// first file header and undoing the navigator's optimistic selection.
738
- if scrollView.contentOffset.y <= 0.5 {
743
+ let visibleTop = scrollView.contentOffset.y + scrollView.contentInset.top
744
+ if visibleTop <= 0.5 {
745
guard lastVisibleFileId != nil else {
746
return
747
}
@@ -744,7 +750,7 @@ public final class T3ReviewDiffView: ExpoView, UIScrollViewDelegate {
750
return
751
}
752
747
- guard let fileId = contentView.visibleFileId(atVerticalOffset: scrollView.contentOffset.y),
753
+ guard let fileId = contentView.visibleFileId(atVerticalOffset: visibleTop),
754
fileId != lastVisibleFileId else {
755
return
756
}
@@ -1025,6 +1031,7 @@ private final class ReviewDiffContentView: UIView, UIGestureRecognizerDelegate {
1031
}
1032
}
1033
var verticalOffset: CGFloat = 0
1034
+ var topContentInset: CGFloat = 0
1035
var theme = ReviewDiffNativeTheme.resolve("light") {
1036
didSet {
1037
tokenColorsByHex.removeAll()
@@ -1495,7 +1502,7 @@ private final class ReviewDiffContentView: UIView, UIGestureRecognizerDelegate {
1502
1503
let rowIndex = stickyHeader.rowIndex
1504
let headerTop = rowOffsets[rowIndex]
1498
- guard headerTop < verticalOffset else {
1505
+ guard headerTop < verticalOffset + topContentInset else {
1506
return nil
1507
}
1508
@@ -1505,12 +1512,12 @@ private final class ReviewDiffContentView: UIView, UIGestureRecognizerDelegate {
1512
: nil
1513
let pushedY: CGFloat
1514
if let nextHeaderRowIndex {
1508
- pushedY = min(0, rowOffsets[nextHeaderRowIndex] - verticalOffset - style.fileHeaderHeight)
1515
+ pushedY = min(topContentInset, rowOffsets[nextHeaderRowIndex] - verticalOffset - style.fileHeaderHeight)
1516
} else {
1510
- pushedY = 0
1517
+ pushedY = topContentInset
1518
}
1519
1513
- guard pushedY > -style.fileHeaderHeight else {
1520
+ guard pushedY > topContentInset - style.fileHeaderHeight else {
1521
return nil
1522
}
1523
@@ -1533,7 +1540,7 @@ private final class ReviewDiffContentView: UIView, UIGestureRecognizerDelegate {
1540
while lowerBound < upperBound {
1541
let midpoint = (lowerBound + upperBound) / 2
1542
let rowIndex = fileHeaderRowIndices[midpoint]
1536
- if rowOffsets[rowIndex] <= verticalOffset {
1543
+ if rowOffsets[rowIndex] <= verticalOffset + topContentInset {
1544
lowerBound = midpoint + 1
1545
} else {
1546
upperBound = midpoint
@@ -1550,7 +1557,7 @@ private final class ReviewDiffContentView: UIView, UIGestureRecognizerDelegate {
1557
func scrollAnchor(forFileId fileId: String) -> ReviewDiffScrollAnchor? {
1558
if let stickyHeader = stickyFileHeaderTarget(),
1559
resolvedFileId(for: stickyHeader.row) == fileId {
1553
- return ReviewDiffScrollAnchor(fileId: fileId, screenY: 0)
1560
+ return ReviewDiffScrollAnchor(fileId: fileId, screenY: topContentInset)
1561
}
1562
1563
guard let headerOffset = fileHeaderOffset(forFileId: fileId) else {
apps/mobile/src/Stack.tsx
+2
-3
@@ -158,8 +158,7 @@ const GLASS_HEADER_OPTIONS: AppScreenOptions = {
158
unstable_navigationItemStyle: NATIVE_LIQUID_GLASS_SUPPORTED ? "editor" : undefined,
159
};
160
161
-// SOLID: opaque sheet-colored header for surfaces whose content scrolls internally
162
-// (terminal, review) — there is nothing for glass to sample there.
161
+// SOLID: opaque sheet-colored header for surfaces that manage their own viewport.
162
const SOLID_HEADER_OPTIONS: AppScreenOptions = {
163
headerBackButtonDisplayMode: "minimal",
164
headerBackTitle: "",
@@ -724,7 +723,7 @@ const RootStackConfig = createWorkspaceStackNavigator({
723
ThreadReview: createNativeStackScreen({
724
screen: ReviewSheet,
725
linking: `${THREAD_LINKING_PREFIX}/review`,
727
- options: SOLID_HEADER_OPTIONS,
726
+ options: GLASS_HEADER_OPTIONS,
727
}),
728
ThreadReviewComment: createNativeStackScreen({
729
screen: ReviewCommentComposerSheet,
apps/mobile/src/features/review/ReviewSheet.tsx
+12
-11
@@ -29,6 +29,7 @@ import {
29
View,
30
} from "react-native";
31
import { useSafeAreaInsets } from "react-native-safe-area-context";
32
+import { useNativeColumnLayoutMetrics } from "../../native/native-layout-metrics";
33
34
import { AppText as Text } from "../../components/AppText";
35
import { SymbolView } from "../../components/AppSymbol";
@@ -156,7 +157,6 @@ function ReviewHeader(
157
);
158
}
159
159
-const REVIEW_HEADER_SPACING = 0;
160
const SHOWCASE_ENABLED = process.env.EXPO_PUBLIC_SHOWCASE === "1";
161
162
const ReviewNotice = memo(function ReviewNotice(props: { readonly notice: string }) {
@@ -461,10 +461,11 @@ export function ReviewSheet(props: ReviewSheetProps) {
461
const { draftMessage } = useThreadDraftForThread({ environmentId, threadId });
462
const reviewCache = useReviewCacheForThread({ environmentId, threadId });
463
const { selectedThreadCwd } = useSelectedThreadWorktree();
464
- // With a solid (non-overlay) header the content lays out below the header
465
- // natively, so no manual top inset is needed. (Android renders its own
466
- // in-flow AndroidScreenHeader, so it needs no inset either.)
467
- const topContentInset = 0;
464
+ const columnMetrics = useNativeColumnLayoutMetrics();
465
+ const safeArea = columnMetrics?.safeArea ?? insets;
466
+ const topContentInset = Platform.OS === "ios" ? safeArea.top : 0;
467
+ const bottomContentInset =
468
+ Platform.OS === "ios" ? safeArea.bottom + 8 : Math.max(insets.bottom, 18) + 18;
469
470
useEffect(() => {
471
showAuxiliaryPane("inspector");
@@ -760,7 +761,7 @@ export function ReviewSheet(props: ReviewSheetProps) {
761
>
762
<View
763
className="min-w-0 flex-1"
763
- style={{ paddingTop: topContentInset + REVIEW_HEADER_SPACING }}
764
+ style={listHeader ? { paddingTop: topContentInset } : undefined}
765
>
766
{listHeader}
767
<View className="min-w-0 flex-1" collapsable={false}>
@@ -777,6 +778,8 @@ export function ReviewSheet(props: ReviewSheetProps) {
778
collapsedCommentIdsJson={nativeBridge.collapsedCommentIdsJson}
779
contentResetKey={`${reviewCache.threadKey}:${selectedSection.id}`}
780
contentWidth={NATIVE_REVIEW_DIFF_CONTENT_WIDTH}
781
+ contentInsetTop={listHeader ? 0 : topContentInset}
782
+ contentInsetBottom={bottomContentInset}
783
nativeViewRef={nativeReviewDiffViewRef}
784
rowHeight={nativeReviewDiffStyle.rowHeight}
785
rowsJson={nativeBridge.rowsJson}
@@ -804,12 +807,10 @@ export function ReviewSheet(props: ReviewSheetProps) {
807
: undefined
808
}
809
contentInsetAdjustmentBehavior="never"
807
- contentInset={{ top: topContentInset, bottom: Math.max(insets.bottom, 18) + 18 }}
810
+ contentInset={{ top: topContentInset, bottom: bottomContentInset }}
811
contentOffset={{ x: 0, y: -topContentInset }}
809
- scrollIndicatorInsets={{
810
- top: topContentInset,
811
- bottom: Math.max(insets.bottom, 18) + 18,
812
- }}
812
+ automaticallyAdjustsScrollIndicatorInsets={false}
813
+ scrollIndicatorInsets={{ top: topContentInset, bottom: bottomContentInset }}
814
showsVerticalScrollIndicator={false}
815
className="flex-1"
816
refreshControl={