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 <[email protected]>
This commit is contained in:
1 parent
bfbc14ce3c
commit
e03abb3a61
5 files changed
+46
-21
No files matched your search
@@ -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() {
|
||||
<Stack.Screen
|
||||
name="index"
|
||||
options={{
|
||||
contentStyle: { backgroundColor: "transparent" },
|
||||
contentStyle: { backgroundColor: String(screenColor) },
|
||||
headerShown: true,
|
||||
headerTransparent: true,
|
||||
// Recent iOS betas no longer draw an implicit blur behind
|
||||
// transparent navigation bars, so request one explicitly.
|
||||
headerBlurEffect: "systemChromeMaterial",
|
||||
headerBlurEffect,
|
||||
headerShadowVisible: false,
|
||||
}}
|
||||
/>
|
||||
@@ -115,8 +116,11 @@ function AppNavigatorContent() {
|
||||
<Stack.Screen
|
||||
name="threads/[environmentId]/[threadId]"
|
||||
options={{
|
||||
animation: "slide_from_right",
|
||||
contentStyle: { backgroundColor: "transparent" },
|
||||
// iOS keeps the default push animation: forcing slide_from_right
|
||||
// switches react-native-screens to its custom swipe animator,
|
||||
// which leaves a black void behind the screen during swipe-back.
|
||||
animation: Platform.OS === "ios" ? "default" : "slide_from_right",
|
||||
contentStyle: { backgroundColor: String(screenColor) },
|
||||
gestureEnabled: true,
|
||||
fullScreenGestureEnabled: true,
|
||||
headerShown: false,
|
||||
|
||||
@@ -1,8 +1,16 @@
|
||||
import Stack from "expo-router/stack";
|
||||
import { StyleSheet } from "react-native";
|
||||
import { Platform, StyleSheet } from "react-native";
|
||||
import { useResolveClassNames } from "uniwind";
|
||||
|
||||
import { useHeaderBlurEffect } from "../../../../lib/useHeaderBlurEffect";
|
||||
|
||||
// iOS keeps the default push animation: forcing slide_from_right switches
|
||||
// react-native-screens to its custom swipe animator, which paints a black
|
||||
// void behind the outgoing screen during interactive swipe-back.
|
||||
const pushAnimation = Platform.OS === "ios" ? ("default" as const) : ("slide_from_right" as const);
|
||||
|
||||
export default function ThreadLayout() {
|
||||
const headerBlurEffect = useHeaderBlurEffect();
|
||||
const sheetStyle = StyleSheet.flatten(useResolveClassNames("bg-sheet"));
|
||||
const headerBg = {
|
||||
backgroundColor: (sheetStyle as { backgroundColor?: string })?.backgroundColor,
|
||||
@@ -16,9 +24,7 @@ export default function ThreadLayout() {
|
||||
contentStyle: { backgroundColor: "transparent" },
|
||||
headerShown: true,
|
||||
headerTransparent: true,
|
||||
// Recent iOS betas no longer draw an implicit blur behind
|
||||
// transparent navigation bars, so request one explicitly.
|
||||
headerBlurEffect: "systemChromeMaterial",
|
||||
headerBlurEffect,
|
||||
headerShadowVisible: false,
|
||||
headerTitle: "",
|
||||
}}
|
||||
@@ -48,7 +54,7 @@ export default function ThreadLayout() {
|
||||
<Stack.Screen
|
||||
name="review"
|
||||
options={{
|
||||
animation: "slide_from_right",
|
||||
animation: pushAnimation,
|
||||
contentStyle: sheetStyle,
|
||||
fullScreenGestureEnabled: true,
|
||||
headerBackButtonDisplayMode: "minimal",
|
||||
@@ -62,7 +68,7 @@ export default function ThreadLayout() {
|
||||
<Stack.Screen
|
||||
name="files/index"
|
||||
options={{
|
||||
animation: "slide_from_right",
|
||||
animation: pushAnimation,
|
||||
contentStyle: sheetStyle,
|
||||
fullScreenGestureEnabled: true,
|
||||
headerBackButtonDisplayMode: "minimal",
|
||||
@@ -76,7 +82,7 @@ export default function ThreadLayout() {
|
||||
<Stack.Screen
|
||||
name="files/[...path]"
|
||||
options={{
|
||||
animation: "slide_from_right",
|
||||
animation: pushAnimation,
|
||||
contentStyle: sheetStyle,
|
||||
fullScreenGestureEnabled: true,
|
||||
headerBackButtonDisplayMode: "minimal",
|
||||
@@ -101,7 +107,7 @@ export default function ThreadLayout() {
|
||||
<Stack.Screen
|
||||
name="terminal"
|
||||
options={{
|
||||
animation: "slide_from_right",
|
||||
animation: pushAnimation,
|
||||
contentStyle: { backgroundColor: "#050505" },
|
||||
headerBackButtonDisplayMode: "minimal",
|
||||
headerShown: true,
|
||||
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
import { Stack } from "expo-router";
|
||||
import { Text as RNText, View } from "react-native";
|
||||
|
||||
import { useHeaderBlurEffect } from "../../lib/useHeaderBlurEffect";
|
||||
import { useThemeColor } from "../../lib/useThemeColor";
|
||||
import { MOBILE_TYPOGRAPHY } from "../../lib/typography";
|
||||
import type { HomeProjectSortOrder } from "./homeThreadList";
|
||||
@@ -72,6 +73,7 @@ export function HomeHeader(props: {
|
||||
readonly onOpenSettings: () => 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: "",
|
||||
|
||||
@@ -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: "",
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
Reference in new issue
Block a user