Skip to content

Commit d054868

Browse files
committed
fix(mobile): restore Android chat content corners
1 parent 807319c commit d054868

2 files changed

Lines changed: 34 additions & 22 deletions

File tree

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

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,18 +1123,21 @@ export function NewTaskDraftScreen(props: {
11231123

11241124
if (!flow.selectedModel) {
11251125
return (
1126-
<ThreadScreenFallback>
1127-
<AppBar
1128-
title="New thread"
1129-
sidebar={false}
1130-
onBack={goBack}
1131-
options={{
1132-
...threadHeaderAppearance(NATIVE_LIQUID_GLASS_SUPPORTED),
1133-
unstable_headerSubtitle: undefined,
1134-
unstable_headerRightItems: () => [],
1135-
unstable_headerToolbarItems: () => [],
1136-
}}
1137-
/>
1126+
<ThreadScreenFallback
1127+
header={
1128+
<AppBar
1129+
title="New thread"
1130+
sidebar={false}
1131+
onBack={goBack}
1132+
options={{
1133+
...threadHeaderAppearance(NATIVE_LIQUID_GLASS_SUPPORTED),
1134+
unstable_headerSubtitle: undefined,
1135+
unstable_headerRightItems: () => [],
1136+
unstable_headerToolbarItems: () => [],
1137+
}}
1138+
/>
1139+
}
1140+
>
11381141
<View className="flex-1 justify-end gap-3 p-4">
11391142
{environmentControl}
11401143
<Text className="text-foreground-muted">

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

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ import {
66
useSyncExternalStore,
77
type ReactNode,
88
} from "react";
9-
import { View } from "react-native";
9+
import { Platform, View } from "react-native";
1010
import { ThreadDetailScreen, type ThreadDetailScreenProps } from "./ThreadDetailScreen";
1111

1212
type ThreadScreenContent =
1313
| { readonly props: ThreadDetailScreenProps }
14-
| { readonly fallback: ReactNode };
14+
| { readonly fallback: ReactNode; readonly header?: ReactNode };
1515

1616
function createThreadScreenStore() {
1717
let current: ThreadScreenContent | null = null;
@@ -36,13 +36,16 @@ function ThreadScreenOutlet() {
3636
const store = useContext(ThreadScreenContext)!;
3737
const content = useSyncExternalStore(store.subscribe, store.getSnapshot);
3838
if (content === null) return null;
39-
return "props" in content ? (
39+
const body = "props" in content ? <ThreadDetailScreen {...content.props} /> : content.fallback;
40+
return (
4041
<>
41-
{content.props.header}
42-
<ThreadDetailScreen {...content.props} />
42+
{"props" in content ? content.props.header : content.header}
43+
{Platform.OS === "android" ? (
44+
<View className="flex-1 overflow-hidden rounded-t-[28px] bg-thread-canvas">{body}</View>
45+
) : (
46+
body
47+
)}
4348
</>
44-
) : (
45-
content.fallback
4649
);
4750
}
4851

@@ -53,7 +56,7 @@ export function ThreadScreenHost({ children }: { readonly children: ReactNode })
5356
return (
5457
<ThreadScreenContext.Provider value={store}>
5558
{children}
56-
<View className="flex-1 bg-screen android:overflow-hidden android:rounded-t-[28px] android:bg-thread-canvas">
59+
<View className="flex-1 bg-screen android:bg-header">
5760
<ThreadScreenOutlet />
5861
</View>
5962
</ThreadScreenContext.Provider>
@@ -68,10 +71,16 @@ export function ThreadScreenBinding(props: ThreadDetailScreenProps) {
6871
return null;
6972
}
7073

71-
export function ThreadScreenFallback({ children }: { readonly children: ReactNode }) {
74+
export function ThreadScreenFallback({
75+
children,
76+
header,
77+
}: {
78+
readonly children: ReactNode;
79+
readonly header?: ReactNode;
80+
}) {
7281
const store = useContext(ThreadScreenContext)!;
7382
useLayoutEffect(() => {
74-
store.publish({ fallback: children });
83+
store.publish({ fallback: children, header });
7584
});
7685
return null;
7786
}

0 commit comments

Comments
 (0)