From 9006652be53d6ee73455da05f079153a4fc16787 Mon Sep 17 00:00:00 2001 From: Jake Leventhal Date: Wed, 28 Oct 2026 17:50:54 -0400 Subject: [PATCH 1/5] feat(mobile): simplify section tabs with a sliding glass pill --- apps/mobile/src/components/ui/Tabs.tsx | 93 +++++++++++++++++++ .../components/ui/segmentedControlColors.ts | 5 +- .../development/ComponentCatalogScreen.tsx | 6 +- .../pull-requests/PullRequestRouteScreen.tsx | 16 ++-- .../src/features/usage/UsageRouteScreen.tsx | 21 +---- 5 files changed, 112 insertions(+), 29 deletions(-) create mode 100644 apps/mobile/src/components/ui/Tabs.tsx diff --git a/apps/mobile/src/components/ui/Tabs.tsx b/apps/mobile/src/components/ui/Tabs.tsx new file mode 100644 index 0000000000000..72b62a8f833fc --- /dev/null +++ b/apps/mobile/src/components/ui/Tabs.tsx @@ -0,0 +1,93 @@ +import { GlassView } from "expo-glass-effect"; +import { useState } from "react"; +import { Pressable, View } from "react-native"; +import Animated, { useAnimatedStyle, useReducedMotion, withTiming } from "react-native-reanimated"; +import { withUniwind } from "uniwind"; + +import { cn } from "../../lib/cn"; +import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../native/native-glass"; +import { useAppearancePreferences } from "../../features/settings/appearance/AppearancePreferencesProvider"; +import { AppText } from "./AppText"; + +const TabGlass = withUniwind(GlassView, { style: { fromClassName: "className" } }); + +export interface TabsProps { + readonly options: readonly { + readonly value: Value; + readonly label: string; + readonly count?: number; + }[]; + readonly selected: Value; + readonly onSelect: (value: Value) => void; + readonly className?: string; +} + +/** Section navigation. Value pickers use SegmentedControl. */ +export function Tabs(props: TabsProps) { + const { themeAppearance } = useAppearancePreferences(); + const reduceMotion = useReducedMotion(); + const [frames, setFrames] = useState>>({}); + const frame = frames[props.selected]; + const duration = reduceMotion ? 0 : 220; + const indicatorStyle = useAnimatedStyle(() => ({ + width: withTiming(frame?.width ?? 0, { duration }), + transform: [{ translateX: withTiming(frame?.x ?? 0, { duration }) }], + })); + + return ( + + {frame ? ( + + {NATIVE_LIQUID_GLASS_SUPPORTED ? ( + + ) : ( + + )} + + ) : null} + {props.options.map((option) => { + const selected = option.value === props.selected; + return ( + props.onSelect(option.value)} + onLayout={({ nativeEvent: { layout } }) => + setFrames((current) => + current[option.value]?.x === layout.x && + current[option.value]?.width === layout.width + ? current + : { ...current, [option.value]: { x: layout.x, width: layout.width } }, + ) + } + className="min-h-8 flex-row items-center gap-1.5 rounded-full px-3.5 active:opacity-70" + > + + {option.label} + + {option.count ? ( + + {option.count} + + ) : null} + + ); + })} + + ); +} diff --git a/apps/mobile/src/components/ui/segmentedControlColors.ts b/apps/mobile/src/components/ui/segmentedControlColors.ts index 6b58675726e4f..f90d5bc3d41ee 100644 --- a/apps/mobile/src/components/ui/segmentedControlColors.ts +++ b/apps/mobile/src/components/ui/segmentedControlColors.ts @@ -28,10 +28,11 @@ export function segmentedControlColors( colors["--color-grouped-card"], ) : flattenThemeColor(themeColorWithAlpha(accent, dark ? 0.1 : 0.07), colors["--color-screen"]); - let selectedColor = colors["--color-secondary"]; + // The thumb must lift off the track: --color-secondary nearly matches it in light themes. + let selectedColor = colors["--color-card"]; if (card && !dark) selectedColor = colors["--color-screen"]; if (dark && (!card || themeId === "t3-code")) { - selectedColor = flattenThemeColor(themeColorWithAlpha(accent, 0.32), colors["--color-screen"]); + selectedColor = flattenThemeColor(themeColorWithAlpha(accent, 0.2), colors["--color-screen"]); } let selectedTextColor = colors[!card && dark ? "--color-foreground" : "--color-secondary-foreground"]; diff --git a/apps/mobile/src/features/development/ComponentCatalogScreen.tsx b/apps/mobile/src/features/development/ComponentCatalogScreen.tsx index 35cee094a0137..70845a73b1f15 100644 --- a/apps/mobile/src/features/development/ComponentCatalogScreen.tsx +++ b/apps/mobile/src/features/development/ComponentCatalogScreen.tsx @@ -24,6 +24,7 @@ import { NumberField } from "../../components/ui/NumberField"; import { AppBar } from "../../components/ui/AppBar"; import { ScreenScrollView } from "../../components/ui/ScreenScrollView"; import { SegmentedControl } from "../../components/ui/SegmentedControl"; +import { Tabs } from "../../components/ui/Tabs"; import { SliderRow } from "../../components/ui/SliderRow"; import * as Dialog from "../../components/ui/Dialog"; import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider"; @@ -89,15 +90,14 @@ export function ComponentCatalogScreen() { size="compact" /> - {page === "controls" ? ( <> diff --git a/apps/mobile/src/features/pull-requests/PullRequestRouteScreen.tsx b/apps/mobile/src/features/pull-requests/PullRequestRouteScreen.tsx index 9ee271e4ab8e0..60411770e9ef1 100644 --- a/apps/mobile/src/features/pull-requests/PullRequestRouteScreen.tsx +++ b/apps/mobile/src/features/pull-requests/PullRequestRouteScreen.tsx @@ -64,7 +64,7 @@ import { useAndroidControlSizing } from "../../components/ui/useAndroidControlSi import { useAdaptiveWorkspaceLayout } from "../layout/AdaptiveWorkspaceLayout"; import { useAndroidWorkspaceBack } from "../layout/workspace/useAndroidWorkspaceNavigation"; import { EmptyState } from "../../components/ui/EmptyState"; -import { SegmentedControl } from "../../components/ui/SegmentedControl"; +import { Tabs } from "../../components/ui/Tabs"; import { SymbolView } from "../../components/ui/AppSymbol"; import { ScreenContent } from "../../components/ui/ScreenContent"; import { RelativeTime } from "../../components/RelativeTime"; @@ -156,6 +156,7 @@ function usePullRequestActivityRows(params: PullRequestParams, filter: ActivityF })(); return { rows, + count: result.data ? result.data.commentCount + result.data.reviewThreads.length : undefined, hiddenCount: filtered?.hiddenCount ?? 0, pending: result.isPending && !result.data, error: result.error, @@ -771,21 +772,22 @@ export function PullRequestRouteScreen({ route }: StaticScreenProps - {/* UIKit draws the tapped control's glass lens outside the hidden - tab's opacity, so only the visible tab mounts the control. */} {Platform.OS !== "ios" || section === tab ? ( - ) : ( diff --git a/apps/mobile/src/features/usage/UsageRouteScreen.tsx b/apps/mobile/src/features/usage/UsageRouteScreen.tsx index 032ab7e23fb02..ea99dc7031913 100644 --- a/apps/mobile/src/features/usage/UsageRouteScreen.tsx +++ b/apps/mobile/src/features/usage/UsageRouteScreen.tsx @@ -35,6 +35,7 @@ import Animated, { FadeIn, ReduceMotion } from "react-native-reanimated"; import { useSafeAreaInsets } from "react-native-safe-area-context"; import { SegmentedControl } from "../../components/ui/SegmentedControl"; +import { Tabs } from "../../components/ui/Tabs"; import { useReduceMotionEnabled } from "../../lib/appState"; import { AppText as Text } from "../../components/ui/AppText"; import { useWorkspaceSettledContentWidth } from "../layout/workspace-content-width"; @@ -252,9 +253,8 @@ function UsageScreen(props: { {wide ? ( - {showingLimits ? ( - - ) : ( + + {showingLimits ? null : ( )} - ) : ( - + )} Date: Wed, 28 Oct 2026 18:01:47 -0400 Subject: [PATCH 2/5] fix(mobile): remove ambiguous activity tab counts --- apps/mobile/src/components/ui/Tabs.tsx | 8 +------- .../src/features/development/ComponentCatalogScreen.tsx | 2 +- .../src/features/pull-requests/PullRequestRouteScreen.tsx | 7 +------ 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/apps/mobile/src/components/ui/Tabs.tsx b/apps/mobile/src/components/ui/Tabs.tsx index 72b62a8f833fc..4bd6d8dbc08d8 100644 --- a/apps/mobile/src/components/ui/Tabs.tsx +++ b/apps/mobile/src/components/ui/Tabs.tsx @@ -15,7 +15,6 @@ export interface TabsProps { readonly options: readonly { readonly value: Value; readonly label: string; - readonly count?: number; }[]; readonly selected: Value; readonly onSelect: (value: Value) => void; @@ -58,7 +57,7 @@ export function Tabs(props: TabsProps) { props.onSelect(option.value)} onLayout={({ nativeEvent: { layout } }) => @@ -80,11 +79,6 @@ export function Tabs(props: TabsProps) { > {option.label} - {option.count ? ( - - {option.count} - - ) : null} ); })} diff --git a/apps/mobile/src/features/development/ComponentCatalogScreen.tsx b/apps/mobile/src/features/development/ComponentCatalogScreen.tsx index 70845a73b1f15..36c20d30d0afc 100644 --- a/apps/mobile/src/features/development/ComponentCatalogScreen.tsx +++ b/apps/mobile/src/features/development/ComponentCatalogScreen.tsx @@ -94,7 +94,7 @@ export function ComponentCatalogScreen() { options={[ { value: "controls", label: "Controls" }, { value: "forms", label: "Forms" }, - { value: "feedback", label: "Feedback", count: 3 }, + { value: "feedback", label: "Feedback" }, ]} selected={page} onSelect={setPage} diff --git a/apps/mobile/src/features/pull-requests/PullRequestRouteScreen.tsx b/apps/mobile/src/features/pull-requests/PullRequestRouteScreen.tsx index 60411770e9ef1..9e50582238270 100644 --- a/apps/mobile/src/features/pull-requests/PullRequestRouteScreen.tsx +++ b/apps/mobile/src/features/pull-requests/PullRequestRouteScreen.tsx @@ -156,7 +156,6 @@ function usePullRequestActivityRows(params: PullRequestParams, filter: ActivityF })(); return { rows, - count: result.data ? result.data.commentCount + result.data.reviewThreads.length : undefined, hiddenCount: filtered?.hiddenCount ?? 0, pending: result.isPending && !result.data, error: result.error, @@ -779,11 +778,7 @@ export function PullRequestRouteScreen({ route }: StaticScreenProps Date: Wed, 28 Oct 2026 18:08:53 -0400 Subject: [PATCH 3/5] fix(mobile): preserve dark card selection contrast --- apps/mobile/src/components/ui/segmentedControlColors.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/mobile/src/components/ui/segmentedControlColors.ts b/apps/mobile/src/components/ui/segmentedControlColors.ts index f90d5bc3d41ee..b612e9b1f006d 100644 --- a/apps/mobile/src/components/ui/segmentedControlColors.ts +++ b/apps/mobile/src/components/ui/segmentedControlColors.ts @@ -29,7 +29,7 @@ export function segmentedControlColors( ) : flattenThemeColor(themeColorWithAlpha(accent, dark ? 0.1 : 0.07), colors["--color-screen"]); // The thumb must lift off the track: --color-secondary nearly matches it in light themes. - let selectedColor = colors["--color-card"]; + let selectedColor = dark && card ? colors["--color-secondary"] : colors["--color-card"]; if (card && !dark) selectedColor = colors["--color-screen"]; if (dark && (!card || themeId === "t3-code")) { selectedColor = flattenThemeColor(themeColorWithAlpha(accent, 0.2), colors["--color-screen"]); From 860f3d29b22f77f8dc8dc48ab83202c0aa1c0187 Mon Sep 17 00:00:00 2001 From: Jake Leventhal Date: Mon, 2 Nov 2026 10:24:16 -0500 Subject: [PATCH 4/5] fix(mobile): keep section tabs reachable and easier to tap --- apps/mobile/src/components/ui/Tabs.tsx | 102 +++++++++--------- .../pull-requests/PullRequestRouteScreen.tsx | 2 +- 2 files changed, 55 insertions(+), 49 deletions(-) diff --git a/apps/mobile/src/components/ui/Tabs.tsx b/apps/mobile/src/components/ui/Tabs.tsx index 4bd6d8dbc08d8..9a50b6b9813ee 100644 --- a/apps/mobile/src/components/ui/Tabs.tsx +++ b/apps/mobile/src/components/ui/Tabs.tsx @@ -1,6 +1,6 @@ import { GlassView } from "expo-glass-effect"; import { useState } from "react"; -import { Pressable, View } from "react-native"; +import { Pressable, ScrollView, View } from "react-native"; import Animated, { useAnimatedStyle, useReducedMotion, withTiming } from "react-native-reanimated"; import { withUniwind } from "uniwind"; @@ -34,54 +34,60 @@ export function Tabs(props: TabsProps) { })); return ( - - {frame ? ( - - {NATIVE_LIQUID_GLASS_SUPPORTED ? ( - - ) : ( - - )} - - ) : null} - {props.options.map((option) => { - const selected = option.value === props.selected; - return ( - props.onSelect(option.value)} - onLayout={({ nativeEvent: { layout } }) => - setFrames((current) => - current[option.value]?.x === layout.x && - current[option.value]?.width === layout.width - ? current - : { ...current, [option.value]: { x: layout.x, width: layout.width } }, - ) - } - className="min-h-8 flex-row items-center gap-1.5 rounded-full px-3.5 active:opacity-70" + + + {frame ? ( + - + ) : ( + + )} + + ) : null} + {props.options.map((option) => { + const selected = option.value === props.selected; + return ( + props.onSelect(option.value)} + onLayout={({ nativeEvent: { layout } }) => + setFrames((current) => + current[option.value]?.x === layout.x && + current[option.value]?.width === layout.width + ? current + : { ...current, [option.value]: { x: layout.x, width: layout.width } }, + ) + } + className="min-h-11 shrink-0 flex-row items-center gap-1.5 rounded-full px-3.5 active:opacity-70" > - {option.label} - - - ); - })} - + + {option.label} + + + ); + })} + + ); } diff --git a/apps/mobile/src/features/pull-requests/PullRequestRouteScreen.tsx b/apps/mobile/src/features/pull-requests/PullRequestRouteScreen.tsx index 9e50582238270..a20df63a9d94b 100644 --- a/apps/mobile/src/features/pull-requests/PullRequestRouteScreen.tsx +++ b/apps/mobile/src/features/pull-requests/PullRequestRouteScreen.tsx @@ -785,7 +785,7 @@ export function PullRequestRouteScreen({ route }: StaticScreenProps ) : ( - + )} ) : null} From e6a32265a19829aa8a43766c4f7112677f7fd24d Mon Sep 17 00:00:00 2001 From: Jake Leventhal Date: Mon, 2 Nov 2026 10:59:02 -0500 Subject: [PATCH 5/5] fix(mobile): scroll selected section tabs into view --- apps/mobile/src/components/ui/Tabs.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/mobile/src/components/ui/Tabs.tsx b/apps/mobile/src/components/ui/Tabs.tsx index 9a50b6b9813ee..510c4bcaa4b26 100644 --- a/apps/mobile/src/components/ui/Tabs.tsx +++ b/apps/mobile/src/components/ui/Tabs.tsx @@ -1,5 +1,5 @@ import { GlassView } from "expo-glass-effect"; -import { useState } from "react"; +import { useEffect, useRef, useState, type ComponentRef } from "react"; import { Pressable, ScrollView, View } from "react-native"; import Animated, { useAnimatedStyle, useReducedMotion, withTiming } from "react-native-reanimated"; import { withUniwind } from "uniwind"; @@ -25,8 +25,13 @@ export interface TabsProps { export function Tabs(props: TabsProps) { const { themeAppearance } = useAppearancePreferences(); const reduceMotion = useReducedMotion(); + const scrollView = useRef>(null); const [frames, setFrames] = useState>>({}); const frame = frames[props.selected]; + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- keeps the selected tab visible in the native scroll viewport + useEffect(() => { + if (frame) scrollView.current?.scrollTo({ x: frame.x, animated: false }); + }, [frame]); const duration = reduceMotion ? 0 : 220; const indicatorStyle = useAnimatedStyle(() => ({ width: withTiming(frame?.width ?? 0, { duration }), @@ -35,6 +40,7 @@ export function Tabs(props: TabsProps) { return (