Skip to content

Commit e0d068c

Browse files
fix(mobile): restore Android chat content corners (#23989)
Co-authored-by: maria-rcks <maria@kuuro.net>
1 parent 5d91ab1 commit e0d068c

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
@@ -1067,18 +1067,21 @@ export function NewTaskDraftScreen(props: {
10671067

10681068
if (!flow.selectedModel) {
10691069
return (
1070-
<ThreadScreenFallback>
1071-
<AppBar
1072-
title="New thread"
1073-
sidebar={false}
1074-
onBack={goBack}
1075-
options={{
1076-
...threadHeaderAppearance(NATIVE_LIQUID_GLASS_SUPPORTED),
1077-
unstable_headerSubtitle: undefined,
1078-
unstable_headerRightItems: () => [],
1079-
unstable_headerToolbarItems: () => [],
1080-
}}
1081-
/>
1070+
<ThreadScreenFallback
1071+
header={
1072+
<AppBar
1073+
title="New thread"
1074+
sidebar={false}
1075+
onBack={goBack}
1076+
options={{
1077+
...threadHeaderAppearance(NATIVE_LIQUID_GLASS_SUPPORTED),
1078+
unstable_headerSubtitle: undefined,
1079+
unstable_headerRightItems: () => [],
1080+
unstable_headerToolbarItems: () => [],
1081+
}}
1082+
/>
1083+
}
1084+
>
10821085
<View className="flex-1 justify-end gap-3 p-4">
10831086
{environmentControl}
10841087
<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)