Skip to content

Commit 169192e

Browse files
committed
fix(mobile): round shared Android sheets and Chat settings
1 parent 5522180 commit 169192e

2 files changed

Lines changed: 36 additions & 38 deletions

File tree

‎apps/mobile/src/components/ui/Sheet.android.tsx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { View } from "react-native";
33
import { FormSheet } from "react-native-screens";
44
import { useResolveClassNames } from "uniwind";
55
import { AndroidSheetHeader } from "./AndroidScreenHeader";
6+
import { ScreenContent } from "./ScreenContent";
67
import type { SheetProps } from "./Sheet.types";
78
export type { SheetProps } from "./Sheet.types";
89

@@ -20,8 +21,8 @@ export function Sheet(props: SheetProps) {
2021
>
2122
{/* Android FormSheet does not bound flex children. Material drags target the first scroll view, so place content before the header. */}
2223
<View collapsable={false} className="absolute inset-0 flex-col-reverse bg-sheet">
23-
<View className="flex-1">{props.children}</View>
24-
<AndroidSheetHeader title={props.title} onBack={() => setIsOpen(false)} />
24+
<ScreenContent>{props.children}</ScreenContent>
25+
<AndroidSheetHeader title={props.title} onBack={() => setIsOpen(false)} hideBottomBorder />
2526
</View>
2627
</FormSheet>
2728
);
Lines changed: 33 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
import { ScreenScrollView as ScrollView } from "../../components/ui/ScreenScrollView";
22
import { useAtomSet, useAtomValue } from "@effect/atom-react";
3-
import { useNavigation } from "@react-navigation/native";
43
import { AsyncResult } from "effect/reactivity";
54
import { Platform, View } from "react-native";
65
import { useSafeAreaInsets } from "react-native-safe-area-context";
76

8-
import { AndroidScreenHeader } from "../../components/ui/AndroidScreenHeader";
97
import { AppText as Text } from "../../components/ui/AppText";
10-
import { NativeStackScreenOptions } from "../../native/StackHeader";
118
import { DEFAULT_FOLLOW_UP_BEHAVIOR, type FollowUpBehavior } from "../../lib/followUpBehavior";
129
import { mobilePreferencesAtom, updateMobilePreferencesAtom } from "../../state/preferences";
1310
import { SettingsChoiceRow } from "./components/SettingsChoiceRow";
1411
import { SettingsSection } from "./components/SettingsSection";
12+
import { SettingsScreen } from "./components/SettingsScreen";
1513

1614
const FOLLOW_UP_OPTIONS: ReadonlyArray<{
1715
readonly behavior: FollowUpBehavior;
@@ -31,7 +29,6 @@ const FOLLOW_UP_OPTIONS: ReadonlyArray<{
3129
];
3230

3331
export function SettingsFollowUpRouteScreen() {
34-
const navigation = useNavigation();
3532
const insets = useSafeAreaInsets();
3633
const preferencesResult = useAtomValue(mobilePreferencesAtom);
3734
const savePreferences = useAtomSet(updateMobilePreferencesAtom);
@@ -40,39 +37,39 @@ export function SettingsFollowUpRouteScreen() {
4037
? (preferencesResult.value.followUpBehavior ?? DEFAULT_FOLLOW_UP_BEHAVIOR)
4138
: null;
4239

43-
return (
40+
const content = (
41+
<ScrollView
42+
contentInsetAdjustmentBehavior="automatic"
43+
showsVerticalScrollIndicator={false}
44+
className="flex-1"
45+
contentContainerClassName="gap-3 px-5 pt-4"
46+
contentContainerStyle={{ paddingBottom: Math.max(insets.bottom, 18) + 18 }}
47+
>
48+
<SettingsSection title="While the agent is running">
49+
{FOLLOW_UP_OPTIONS.map((option, index) => (
50+
<SettingsChoiceRow
51+
key={option.behavior}
52+
label={option.label}
53+
description={option.description}
54+
selected={selectedBehavior === option.behavior}
55+
separated={index > 0}
56+
disabled={!preferencesReady}
57+
onPress={() => savePreferences({ followUpBehavior: option.behavior })}
58+
/>
59+
))}
60+
</SettingsSection>
61+
<Text className="px-2 text-sm text-foreground-muted">
62+
Long-press the send button to use the other option for a single message. With a hardware
63+
keyboard, hold Command while sending.
64+
</Text>
65+
</ScrollView>
66+
);
67+
68+
return Platform.OS === "android" ? (
69+
<SettingsScreen title="Chat">{content}</SettingsScreen>
70+
) : (
4471
<View collapsable={false} className="flex-1 bg-sheet">
45-
{Platform.OS === "android" ? (
46-
<>
47-
<NativeStackScreenOptions options={{ headerShown: false }} />
48-
<AndroidScreenHeader title="Chat" onBack={() => navigation.goBack()} />
49-
</>
50-
) : null}
51-
<ScrollView
52-
contentInsetAdjustmentBehavior="automatic"
53-
showsVerticalScrollIndicator={false}
54-
className="flex-1"
55-
contentContainerClassName="gap-3 px-5 pt-4"
56-
contentContainerStyle={{ paddingBottom: Math.max(insets.bottom, 18) + 18 }}
57-
>
58-
<SettingsSection title="While the agent is running">
59-
{FOLLOW_UP_OPTIONS.map((option, index) => (
60-
<SettingsChoiceRow
61-
key={option.behavior}
62-
label={option.label}
63-
description={option.description}
64-
selected={selectedBehavior === option.behavior}
65-
separated={index > 0}
66-
disabled={!preferencesReady}
67-
onPress={() => savePreferences({ followUpBehavior: option.behavior })}
68-
/>
69-
))}
70-
</SettingsSection>
71-
<Text className="px-2 text-sm text-foreground-muted">
72-
Long-press the send button to use the other option for a single message. With a hardware
73-
keyboard, hold Command while sending.
74-
</Text>
75-
</ScrollView>
72+
{content}
7673
</View>
7774
);
7875
}

0 commit comments

Comments
 (0)