TypeScript
fix(mobile): round shared Android sheets and Chat settings (#18547)
Alexb84e121226f5
diff --git a/apps/mobile/src/components/ui/Sheet.android.tsx b/apps/mobile/src/components/ui/Sheet.android.tsxindex 08f8b8ad9a4..ac222485cf0 100644--- a/apps/mobile/src/components/ui/Sheet.android.tsx+++ b/apps/mobile/src/components/ui/Sheet.android.tsx@@ -3,25 +3,30 @@ import { View } from "react-native";import { FormSheet } from "react-native-screens";import { useResolveClassNames } from "uniwind";import { AndroidSheetHeader } from "./AndroidScreenHeader";+import { ScreenContent } from "./ScreenContent";import type { SheetProps } from "./Sheet.types";export type { SheetProps } from "./Sheet.types";export function Sheet(props: SheetProps) {- const containerStyle = useResolveClassNames("bg-sheet");+ const containerStyle = useResolveClassNames("bg-header");const [isOpen, setIsOpen] = useState(true);return (<FormSheetisOpen={isOpen}detents={[0.5, 0.9]}- prefersGrabberVisible+ prefersGrabberVisible={false}nativeContainerStyle={containerStyle}onDismiss={props.onClose}onNativeDismiss={props.onClose}>{/* Android FormSheet does not bound flex children. Material drags target the first scroll view, so place content before the header. */}- <View collapsable={false} className="absolute inset-0 flex-col-reverse bg-sheet">- <View className="flex-1">{props.children}</View>- <AndroidSheetHeader title={props.title} onBack={() => setIsOpen(false)} />+ <View collapsable={false} className="absolute inset-0 flex-col-reverse bg-header">+ <ScreenContent>{props.children}</ScreenContent>+ <AndroidSheetHeader title={props.title} onBack={() => setIsOpen(false)} hideBottomBorder />+ <View+ pointerEvents="none"+ className="absolute top-1 h-1 w-8 self-center rounded-full bg-header-foreground/40"+ /></View></FormSheet>);diff --git a/apps/mobile/src/features/settings/SettingsFollowUpRouteScreen.tsx b/apps/mobile/src/features/settings/SettingsFollowUpRouteScreen.tsxindex a86ec0c6d35..f7e1680159c 100644--- a/apps/mobile/src/features/settings/SettingsFollowUpRouteScreen.tsx+++ b/apps/mobile/src/features/settings/SettingsFollowUpRouteScreen.tsx@@ -1,17 +1,15 @@import { ScreenScrollView as ScrollView } from "../../components/ui/ScreenScrollView";import { useAtomSet, useAtomValue } from "@effect/atom-react";-import { useNavigation } from "@react-navigation/native";import { AsyncResult } from "effect/reactivity";import { Platform, View } from "react-native";import { useSafeAreaInsets } from "react-native-safe-area-context";-import { AndroidScreenHeader } from "../../components/ui/AndroidScreenHeader";import { AppText as Text } from "../../components/ui/AppText";-import { NativeStackScreenOptions } from "../../native/StackHeader";import { DEFAULT_FOLLOW_UP_BEHAVIOR, type FollowUpBehavior } from "../../lib/followUpBehavior";import { mobilePreferencesAtom, updateMobilePreferencesAtom } from "../../state/preferences";import { SettingsChoiceRow } from "./components/SettingsChoiceRow";import { SettingsSection } from "./components/SettingsSection";+import { SettingsScreen } from "./components/SettingsScreen";const FOLLOW_UP_OPTIONS: ReadonlyArray<{readonly behavior: FollowUpBehavior;@@ -31,7 +29,6 @@ const FOLLOW_UP_OPTIONS: ReadonlyArray<{];export function SettingsFollowUpRouteScreen() {- const navigation = useNavigation();const insets = useSafeAreaInsets();const preferencesResult = useAtomValue(mobilePreferencesAtom);const savePreferences = useAtomSet(updateMobilePreferencesAtom);@@ -40,39 +37,39 @@ export function SettingsFollowUpRouteScreen() {? (preferencesResult.value.followUpBehavior ?? DEFAULT_FOLLOW_UP_BEHAVIOR): null;- return (+ const content = (+ <ScrollView+ contentInsetAdjustmentBehavior="automatic"+ showsVerticalScrollIndicator={false}+ className="flex-1"+ contentContainerClassName="gap-3 px-5 pt-4"+ contentContainerStyle={{ paddingBottom: Math.max(insets.bottom, 18) + 18 }}+ >+ <SettingsSection title="While the agent is running">+ {FOLLOW_UP_OPTIONS.map((option, index) => (+ <SettingsChoiceRow+ key={option.behavior}+ label={option.label}+ description={option.description}+ selected={selectedBehavior === option.behavior}+ separated={index > 0}+ disabled={!preferencesReady}+ onPress={() => savePreferences({ followUpBehavior: option.behavior })}+ />+ ))}+ </SettingsSection>+ <Text className="px-2 text-sm text-foreground-muted">+ Long-press the send button to use the other option for a single message. With a hardware+ keyboard, hold Command while sending.+ </Text>+ </ScrollView>+ );++ return Platform.OS === "android" ? (+ <SettingsScreen title="Chat">{content}</SettingsScreen>+ ) : (<View collapsable={false} className="flex-1 bg-sheet">- {Platform.OS === "android" ? (- <>- <NativeStackScreenOptions options={{ headerShown: false }} />- <AndroidScreenHeader title="Chat" onBack={() => navigation.goBack()} />- </>- ) : null}- <ScrollView- contentInsetAdjustmentBehavior="automatic"- showsVerticalScrollIndicator={false}- className="flex-1"- contentContainerClassName="gap-3 px-5 pt-4"- contentContainerStyle={{ paddingBottom: Math.max(insets.bottom, 18) + 18 }}- >- <SettingsSection title="While the agent is running">- {FOLLOW_UP_OPTIONS.map((option, index) => (- <SettingsChoiceRow- key={option.behavior}- label={option.label}- description={option.description}- selected={selectedBehavior === option.behavior}- separated={index > 0}- disabled={!preferencesReady}- onPress={() => savePreferences({ followUpBehavior: option.behavior })}- />- ))}- </SettingsSection>- <Text className="px-2 text-sm text-foreground-muted">- Long-press the send button to use the other option for a single message. With a hardware- keyboard, hold Command while sending.- </Text>- </ScrollView>+ {content}</View>);}