TypeScript
refactor(mobile): Git and Agents sheet headers take theme colours from classes (#20409)
olivere1f33e023c80
diff --git a/apps/mobile/src/features/threads/ThreadAgentsSheet.tsx b/apps/mobile/src/features/threads/ThreadAgentsSheet.tsxindex 9c4e599b2b8..2fbf4349ab9 100644--- a/apps/mobile/src/features/threads/ThreadAgentsSheet.tsx+++ b/apps/mobile/src/features/threads/ThreadAgentsSheet.tsx@@ -13,14 +13,14 @@ import { Atom } from "effect/reactivity";import * as Haptics from "expo-haptics";import { useEffect, useState } from "react";import { Platform, Pressable, ScrollView, View } from "react-native";-import { Screen, ScreenStack, ScreenStackHeaderConfig } from "react-native-screens";+import { ScreenStack } from "react-native-screens";import { useSafeAreaInsets } from "react-native-safe-area-context";import { AndroidSheetHeader } from "../../components/ui/AndroidScreenHeader";import { AppText as Text } from "../../components/ui/AppText";-import { useUniwindTheme } from "../../lib/useUniwindTheme";import { environmentThreadDetails } from "../../state/threads";import { NativeStackScreenOptions, nativeHeaderScrollEdgeEffects } from "../../native/StackHeader";+import { NativeHeader, NativeScreen } from "../../native/ThemedScreenStack";import { SubagentRow } from "./SubagentRow";import { ScreenContent } from "../../components/ui/ScreenContent";import { useAdaptiveWorkspaceLayout } from "../layout/AdaptiveWorkspaceLayout";@@ -46,7 +46,6 @@ export function ThreadAgentsSheet({ route }: StaticScreenProps<AgentsTarget>) {const target = route.params;const navigation = useNavigation();const insets = useSafeAreaInsets();- const theme = useUniwindTheme();const turn = useThreadTurnSubagents(target);const subagents = turn?.subagents ?? [];const hasLiveAgent = (turn?.liveCount ?? 0) > 0;@@ -97,27 +96,27 @@ export function ThreadAgentsSheet({ route }: StaticScreenProps<AgentsTarget>) {return (<View collapsable={false} className="flex-1 bg-sheet"><ScreenStack style={{ flex: 1 }}>- <Screen+ <NativeScreenactivityState={2}enabledisNativeStackscreenId="thread-agents-sheet-native"scrollEdgeEffects={HEADER_SCROLL_EDGE_EFFECTS}- style={{ backgroundColor: theme["--color-sheet"], flex: 1 }}+ className="flex-1 bg-sheet">{content}- <ScreenStackHeaderConfig+ <NativeHeaderbackgroundColor="rgba(0,0,0,0)"- color={theme["--color-foreground"]}+ tintColorClassName="accent-foreground"hideBackButtonhideShadow={false}title="Agents"- titleColor={theme["--color-foreground"]}+ titleColorClassName="accent-foreground"titleFontSize={18}titleFontWeight="800"translucent/>- </Screen>+ </NativeScreen></ScreenStack></View>);diff --git a/apps/mobile/src/features/threads/git/GitOverviewSheet.tsx b/apps/mobile/src/features/threads/git/GitOverviewSheet.tsxindex 17d3e0ef256..ba590576cf3 100644--- a/apps/mobile/src/features/threads/git/GitOverviewSheet.tsx+++ b/apps/mobile/src/features/threads/git/GitOverviewSheet.tsx@@ -17,10 +17,10 @@ import { SymbolView } from "../../../components/ui/AppSymbol";import { useCallback, useEffect, useMemo, useState } from "react";import { Platform, Pressable, RefreshControl, ScrollView, View } from "react-native";-import { Screen, ScreenStack, ScreenStackHeaderConfig } from "react-native-screens";+import { ScreenStack } from "react-native-screens";import { useSafeAreaInsets } from "react-native-safe-area-context";import { NativeSheetContent } from "../../../native/NativeSheetContent";-import { useUniwindTheme } from "../../../lib/useUniwindTheme";+import { NativeHeader, NativeScreen } from "../../../native/ThemedScreenStack";import {AndroidHeaderIconButton,AndroidSheetHeader,@@ -93,9 +93,6 @@ function GitOverviewSheetContent(props: GitOverviewSheetProps) {const gitState = useSelectedThreadGitState();const gitActions = useSelectedThreadGitActions();const { canWriteSourceControl, canChangeThreadBranch } = gitActions;- const theme = useUniwindTheme();- const foregroundColor = theme["--color-foreground"];- const sheetColor = theme["--color-sheet"];const gitStatus = useEnvironmentQuery(selectedThread !== null && selectedThreadCwd !== null@@ -393,28 +390,28 @@ function GitOverviewSheetContent(props: GitOverviewSheetProps) {return (<View collapsable={false} className="flex-1 border-l border-border bg-sheet"><ScreenStack style={{ flex: 1 }}>- <Screen+ <NativeScreenactivityState={2}enabledisNativeStackscreenId="thread-git-inspector-native"scrollEdgeEffects={HEADER_SCROLL_EDGE_EFFECTS}- style={{ backgroundColor: sheetColor, flex: 1 }}+ className="flex-1 bg-sheet"><NativeSheetContent>{content}</NativeSheetContent>- <ScreenStackHeaderConfig+ <NativeHeaderbackgroundColor="rgba(0,0,0,0)"- color={foregroundColor}+ tintColorClassName="accent-foreground"hideBackButtonhideShadow={false}navigationItemStyle="editor"title={currentBranchLabel}- titleColor={foregroundColor}+ titleColorClassName="accent-foreground"titleFontSize={17}titleFontWeight="700"translucent/>- </Screen>+ </NativeScreen></ScreenStack></View>);@@ -427,28 +424,28 @@ function GitOverviewSheetContent(props: GitOverviewSheetProps) {return (<View collapsable={false} className="flex-1 bg-sheet"><ScreenStack style={{ flex: 1 }}>- <Screen+ <NativeScreenactivityState={2}enabledisNativeStackscreenId="thread-git-sheet-native"scrollEdgeEffects={HEADER_SCROLL_EDGE_EFFECTS}- style={{ backgroundColor: sheetColor, flex: 1 }}+ className="flex-1 bg-sheet"><NativeSheetContent>{content}</NativeSheetContent>- <ScreenStackHeaderConfig+ <NativeHeaderbackgroundColor="rgba(0,0,0,0)"- color={foregroundColor}+ tintColorClassName="accent-foreground"hideBackButtonhideShadow={false}navigationItemStyle="editor"title={currentBranchLabel}- titleColor={foregroundColor}+ titleColorClassName="accent-foreground"titleFontSize={18}titleFontWeight="800"translucent/>- </Screen>+ </NativeScreen></ScreenStack></View>);diff --git a/vite.config.ts b/vite.config.tsindex 2635b4b2a91..29c6816d526 100644--- a/vite.config.ts+++ b/vite.config.ts@@ -397,10 +397,8 @@ export default defineConfig({"apps/mobile/src/features/settings/appearance/components/FontSizeSliderRow.tsx","apps/mobile/src/features/threads/NewTaskContextPickerScreens.tsx","apps/mobile/src/features/threads/ThreadQueueControl.tsx",- "apps/mobile/src/features/threads/ThreadAgentsSheet.tsx","apps/mobile/src/features/review/ReviewCommentCard.tsx","apps/mobile/src/features/threads/ThreadSettingsSheet.tsx",- "apps/mobile/src/features/threads/git/GitOverviewSheet.tsx","apps/mobile/src/features/threads/thread-list-items.tsx","apps/mobile/src/features/threads/thread-list-v2-items.tsx","apps/mobile/src/lib/useMobileNavigationTheme.ts",