From e03abb3a61a7ff7f03f35f565464a1b2ec022d43 Mon Sep 17 00:00:00 2001 From: Ben Davis Date: Thu, 2 Jul 2026 03:33:17 -0700 Subject: [PATCH] fix(mobile): dark header blur and remove black void on swipe-back The trait-adaptive systemChromeMaterial blur resolves to its light variant on the new iOS beta even while the app renders dark, washing the header out white. Pick systemChromeMaterialLight/Dark explicitly from the app color scheme via a shared useHeaderBlurEffect hook. The black void revealed behind the outgoing screen during swipe-back came from the custom slide_from_right animator combined with transparent screen content. Keep the native default push animation on iOS (identical look, proper parallax with the previous screen visible underneath) and give stack screens an opaque themed background. Co-Authored-By: Claude Fable 5 --- apps/mobile/src/app/_layout.tsx | 18 +++++++++------ .../[environmentId]/[threadId]/_layout.tsx | 22 ++++++++++++------- apps/mobile/src/features/home/HomeHeader.tsx | 6 ++--- .../features/threads/ThreadRouteScreen.tsx | 6 ++--- apps/mobile/src/lib/useHeaderBlurEffect.ts | 15 +++++++++++++ 5 files changed, 46 insertions(+), 21 deletions(-) create mode 100644 apps/mobile/src/lib/useHeaderBlurEffect.ts diff --git a/apps/mobile/src/app/_layout.tsx b/apps/mobile/src/app/_layout.tsx index 045489e389..7a19cecff1 100644 --- a/apps/mobile/src/app/_layout.tsx +++ b/apps/mobile/src/app/_layout.tsx @@ -8,7 +8,7 @@ import { import { usePathname } from "expo-router"; import Stack from "expo-router/stack"; import { useCallback } from "react"; -import { StatusBar, useColorScheme } from "react-native"; +import { Platform, StatusBar, useColorScheme } from "react-native"; import { GestureHandlerRootView } from "react-native-gesture-handler"; import { KeyboardProvider } from "react-native-keyboard-controller"; import { SafeAreaProvider } from "react-native-safe-area-context"; @@ -26,6 +26,7 @@ import { useClerkSettingsSheetDetent, } from "../features/cloud/ClerkSettingsSheetDetent"; import { useAgentNotificationNavigation } from "../features/agent-awareness/notificationNavigation"; +import { useHeaderBlurEffect } from "../lib/useHeaderBlurEffect"; import { useThemeColor } from "../lib/useThemeColor"; function AppNavigator() { @@ -45,7 +46,9 @@ function AppNavigatorContent() { const { collapse, isExpanded } = useClerkSettingsSheetDetent(); const colorScheme = useColorScheme(); const statusBarBg = useThemeColor("--color-status-bar"); + const screenColor = useThemeColor("--color-screen"); const sheetStyle = useResolveClassNames("bg-sheet"); + const headerBlurEffect = useHeaderBlurEffect(); useAgentNotificationNavigation(); useThreadOutboxDrain(); @@ -96,12 +99,10 @@ function AppNavigatorContent() { @@ -115,8 +116,11 @@ function AppNavigatorContent() { void; readonly onStartNewTask: () => void; }) { + const headerBlurEffect = useHeaderBlurEffect(); const iconColor = useThemeColor("--color-icon"); const mutedColor = useThemeColor("--color-foreground-muted"); const subtleColor = useThemeColor("--color-subtle"); @@ -88,9 +90,7 @@ export function HomeHeader(props: { headerShown: true, headerTransparent: true, headerStyle: { backgroundColor: "transparent" }, - // Recent iOS betas no longer draw an implicit blur behind - // transparent navigation bars, so request one explicitly. - headerBlurEffect: "systemChromeMaterial", + headerBlurEffect, headerShadowVisible: false, headerTintColor: iconColor, headerTitle: "", diff --git a/apps/mobile/src/features/threads/ThreadRouteScreen.tsx b/apps/mobile/src/features/threads/ThreadRouteScreen.tsx index 390fa9bef3..c16460731b 100644 --- a/apps/mobile/src/features/threads/ThreadRouteScreen.tsx +++ b/apps/mobile/src/features/threads/ThreadRouteScreen.tsx @@ -5,6 +5,7 @@ import { EnvironmentId, type ProjectScript } from "@t3tools/contracts"; import { projectScriptCwd, projectScriptRuntimeEnv } from "@t3tools/shared/projectScripts"; import { Pressable, ScrollView, Text as RNText, View } from "react-native"; import { useWorkspaceState } from "../../state/workspace"; +import { useHeaderBlurEffect } from "../../lib/useHeaderBlurEffect"; import { useThemeColor } from "../../lib/useThemeColor"; import { useEnvironmentQuery } from "../../state/query"; import { dismissGitActionResult, useGitActionProgress } from "../../state/use-vcs-action-state"; @@ -104,6 +105,7 @@ export function ThreadRouteScreen() { const iconColor = String(useThemeColor("--color-icon")); const foregroundColor = String(useThemeColor("--color-foreground")); const secondaryFg = String(useThemeColor("--color-foreground-secondary")); + const headerBlurEffect = useHeaderBlurEffect(); /* ─── Git status for native header trigger ───────────────────────── */ const gitStatus = useEnvironmentQuery( @@ -326,9 +328,7 @@ export function ThreadRouteScreen() { headerShown: true, headerTransparent: true, headerStyle: { backgroundColor: "transparent" }, - // Recent iOS betas no longer draw an implicit blur behind - // transparent navigation bars, so request one explicitly. - headerBlurEffect: "systemChromeMaterial", + headerBlurEffect, headerShadowVisible: false, headerTintColor: iconColor, headerBackTitle: "", diff --git a/apps/mobile/src/lib/useHeaderBlurEffect.ts b/apps/mobile/src/lib/useHeaderBlurEffect.ts new file mode 100644 index 0000000000..94d091479d --- /dev/null +++ b/apps/mobile/src/lib/useHeaderBlurEffect.ts @@ -0,0 +1,15 @@ +import { useColorScheme } from "react-native"; + +/** + * Blur effect for transparent navigation headers. + * + * Recent iOS betas stopped drawing the implicit material behind transparent + * navigation bars, and the trait-adaptive `systemChromeMaterial` resolves to + * its light variant there even while the app renders in dark mode — so pick + * the light/dark variant explicitly from the app color scheme. + */ +export function useHeaderBlurEffect() { + return useColorScheme() === "dark" + ? ("systemChromeMaterialDark" as const) + : ("systemChromeMaterialLight" as const); +}