import { useNavigation } from "@react-navigation/native"; import type { ComponentProps } from "react"; import { Pressable, View } from "react-native"; import { SymbolView } from "../../../components/AppSymbol"; import { AppText as Text } from "../../../components/AppText"; import { useThemeColor } from "../../../lib/useThemeColor"; import type { SettingsLegalDocumentTarget, SettingsSheetTarget } from "./settings-sheet-targets"; type SymbolName = ComponentProps["name"]; export function SettingsRow(props: { readonly disabled?: boolean; readonly icon: SymbolName; readonly label: string; readonly value?: string; readonly target?: SettingsSheetTarget; readonly fullScreenTarget?: SettingsLegalDocumentTarget; readonly onPress?: () => void; }) { const navigation = useNavigation(); const icon = useThemeColor("--color-icon"); const chevron = useThemeColor("--color-chevron"); const content = ( {props.label} {props.value ? ( {props.value} ) : null} ); const target = props.target; if (target) { return ( navigation.navigate("SettingsSheet", { screen: target, }) } > {content} ); } const fullScreenTarget = props.fullScreenTarget; if (fullScreenTarget) { return ( navigation.navigate(fullScreenTarget)} > {content} ); } return ( {content} ); }