Skip to content

Commit 862b349

Browse files
committed
fix(android): Share thread layout with the unavailable state
1 parent ff27e20 commit 862b349

1 file changed

Lines changed: 19 additions & 19 deletions

File tree

‎apps/mobile/src/features/threads/ThreadRouteScreen.tsx‎

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { makeTurnCommandMetadata } from "../../lib/commandMetadata";
22
import { buildProjectThreadStartTurnInput } from "../../lib/projectThreadStartTurn";
33
import { useWorktreeSetup } from "./use-worktree-setup";
44
import { worktreeSetupAgentStarted } from "@t3tools/client-runtime/worktree-setup";
5+
import { ScreenHeader } from "../../components/ScreenHeader";
56
import {
67
StackActions,
78
useFocusEffect,
@@ -111,19 +112,11 @@ function ThreadPane(props: { readonly children: ReactNode }) {
111112
);
112113
}
113114

114-
function OpeningThreadLoadingScreen() {
115+
function ThreadRouteFallbackLayout(props: { readonly children: ReactNode }) {
115116
const navigation = useNavigation();
116117
const { layout } = useAdaptiveWorkspaceLayout();
117118
const { themeVariables } = useAppearancePreferences();
118-
const content = (
119-
<LoadingScreen
120-
message="Opening thread…"
121-
messagePlacement="above-spinner"
122-
embedded={Platform.OS === "android"}
123-
/>
124-
);
125-
126-
if (Platform.OS !== "android") return content;
119+
if (Platform.OS !== "android") return props.children;
127120

128121
return (
129122
<>
@@ -140,11 +133,23 @@ function OpeningThreadLoadingScreen() {
140133
}
141134
hideBottomBorder
142135
/>
143-
<ThreadPane>{content}</ThreadPane>
136+
<ThreadPane>{props.children}</ThreadPane>
144137
</>
145138
);
146139
}
147140

141+
function OpeningThreadLoadingScreen() {
142+
return (
143+
<ThreadRouteFallbackLayout>
144+
<LoadingScreen
145+
message="Opening thread…"
146+
messagePlacement="above-spinner"
147+
embedded={Platform.OS === "android"}
148+
/>
149+
</ThreadRouteFallbackLayout>
150+
);
151+
}
152+
148153
type ThreadRouteScreenRouteProps = StaticScreenProps<{
149154
readonly environmentId: string;
150155
readonly threadId: string;
@@ -161,12 +166,7 @@ function ThreadUnavailableScreen(props: {
161166
readonly onAction: () => void;
162167
}) {
163168
return (
164-
<>
165-
{Platform.OS === "android" ? (
166-
<NativeStackScreenOptions
167-
options={{ headerShown: true, title: undefined, contentStyle: undefined }}
168-
/>
169-
) : null}
169+
<ThreadRouteFallbackLayout>
170170
<ScrollView
171171
contentInsetAdjustmentBehavior="automatic"
172172
contentContainerStyle={{
@@ -175,7 +175,7 @@ function ThreadUnavailableScreen(props: {
175175
paddingHorizontal: 24,
176176
paddingVertical: 32,
177177
}}
178-
className="bg-screen flex-1"
178+
className="bg-screen flex-1 android:bg-transparent"
179179
>
180180
<EmptyState
181181
title="Thread unavailable"
@@ -184,7 +184,7 @@ function ThreadUnavailableScreen(props: {
184184
onAction={props.onAction}
185185
/>
186186
</ScrollView>
187-
</>
187+
</ThreadRouteFallbackLayout>
188188
);
189189
}
190190

0 commit comments

Comments
 (0)