fix(android): Match thread fallback layouts to the loaded pane (#14669)

This commit is contained in:
Alex authored and GitHub committed 2026-10-11 11:30:03 -07:00
1 parent 80cd57585d
commit a1f81a44e5
2 files changed
+71 -21

No files matched your search

+6 -1
View File
@@ -7,6 +7,8 @@ import { BrandMark } from "./BrandMark";
export function LoadingScreen(props: {
readonly message: string;
/** Let the enclosing pane supply the background and top inset. */
readonly embedded?: boolean;
readonly messagePlacement?: "above-spinner" | "below-spinner";
}) {
const { themeAppearance: colorScheme } = useAppearancePreferences();
@@ -14,7 +16,10 @@ export function LoadingScreen(props: {
const messagePlacement = props.messagePlacement ?? "below-spinner";
return (
<View className="flex-1 bg-screen" style={{ paddingTop: insets.top }}>
<View
className={props.embedded ? "flex-1" : "flex-1 bg-screen"}
style={{ paddingTop: props.embedded ? 0 : insets.top }}
>
<StatusBar barStyle={colorScheme === "dark" ? "light-content" : "dark-content"} />
<View className="flex-1 items-center justify-center gap-5 px-6">
<BrandMark compact />
@@ -2,6 +2,7 @@ import { makeTurnCommandMetadata } from "../../lib/commandMetadata";
import { buildProjectThreadStartTurnInput } from "../../lib/projectThreadStartTurn";
import { useWorktreeSetup } from "./use-worktree-setup";
import { worktreeSetupAgentStarted } from "@t3tools/client-runtime/worktree-setup";
import { ScreenHeader } from "../../components/ScreenHeader";
import {
StackActions,
useFocusEffect,
@@ -103,8 +104,50 @@ function firstRouteParam(value: string | string[] | undefined): string | null {
return first === undefined || first.trim().length === 0 ? null : first;
}
function ThreadPane(props: { readonly children: ReactNode }) {
return (
<View className="flex-1 bg-screen android:overflow-hidden android:rounded-t-[28px] android:bg-thread-canvas">
{props.children}
</View>
);
}
function ThreadRouteFallbackLayout(props: { readonly children: ReactNode }) {
const navigation = useNavigation();
const { layout } = useAdaptiveWorkspaceLayout();
const { themeVariables } = useAppearancePreferences();
if (Platform.OS !== "android") return props.children;
return (
<>
<ScreenHeader
title="Thread"
options={{ contentStyle: { backgroundColor: themeVariables["--color-header"] } }}
onBack={
layout.usesSplitView
? undefined
: () => {
if (navigation.canGoBack()) navigation.goBack();
else navigation.dispatch(StackActions.replace("Home"));
}
}
hideBottomBorder
/>
<ThreadPane>{props.children}</ThreadPane>
</>
);
}
function OpeningThreadLoadingScreen() {
return <LoadingScreen message="Opening thread…" messagePlacement="above-spinner" />;
return (
<ThreadRouteFallbackLayout>
<LoadingScreen
message="Opening thread…"
messagePlacement="above-spinner"
embedded={Platform.OS === "android"}
/>
</ThreadRouteFallbackLayout>
);
}
type ThreadRouteScreenRouteProps = StaticScreenProps<{
@@ -123,23 +166,25 @@ function ThreadUnavailableScreen(props: {
readonly onAction: () => void;
}) {
return (
<ScrollView
contentInsetAdjustmentBehavior="automatic"
contentContainerStyle={{
flexGrow: 1,
justifyContent: "center",
paddingHorizontal: 24,
paddingVertical: 32,
}}
className="bg-screen flex-1"
>
<EmptyState
title="Thread unavailable"
detail="This thread is not available in the current mobile snapshot."
actionLabel={props.actionLabel}
onAction={props.onAction}
/>
</ScrollView>
<ThreadRouteFallbackLayout>
<ScrollView
contentInsetAdjustmentBehavior="automatic"
contentContainerStyle={{
flexGrow: 1,
justifyContent: "center",
paddingHorizontal: 24,
paddingVertical: 32,
}}
className="bg-screen flex-1 android:bg-transparent"
>
<EmptyState
title="Thread unavailable"
detail="This thread is not available in the current mobile snapshot."
actionLabel={props.actionLabel}
onAction={props.onAction}
/>
</ScrollView>
</ThreadRouteFallbackLayout>
);
}
@@ -931,7 +976,7 @@ function ThreadRouteContent(
<>
<GitActionProgressOverlay progress={gitActionProgress} onDismiss={dismissGitActionResult} />
<View className="flex-1 bg-screen android:overflow-hidden android:rounded-t-[28px] android:bg-thread-canvas">
<ThreadPane>
<ThreadDetailScreen
canOperateThread={canOperateThread}
selectedThread={selectedThreadWithDraftSettings ?? selectedThread}
@@ -1023,7 +1068,7 @@ function ThreadRouteContent(
onSubmitUserInput={requests.onSubmitUserInput}
onDismissUserInput={requests.onDismissUserInput}
/>
</View>
</ThreadPane>
</>
);