import { MaterialCommunityIcons } from "@expo/vector-icons"; import { Switch, Text, TouchableOpacity, View } from "react-native"; import { useTheme } from "@/lib/theme"; type IconName = React.ComponentProps["name"]; type RightKind = "chevron" | "switch" | "value" | "none"; type SettingsRowProps = { icon: IconName; title: string; subtitle?: string; right?: RightKind; /** For `right: "value"` — the string shown on the trailing side. */ value?: string; /** For `right: "switch"`. */ switchValue?: boolean; onSwitchChange?: (value: boolean) => void; onPress?: () => void; /** Red accent — used for the emergency-call row. */ danger?: boolean; }; /** A single row in the Settings screen. Born dark-aware. */ export const SettingsRow = ({ icon, title, subtitle, right = "none", value, switchValue, onSwitchChange, onPress, danger = false, }: SettingsRowProps) => { const { isDark } = useTheme(); const interactive = right === "chevron" || right === "value"; const content = ( {title} {subtitle ? ( {subtitle} ) : null} {right === "switch" ? ( ) : null} {right === "value" ? ( {value} ) : null} {right === "chevron" ? ( ) : null} ); if (right === "switch" || !interactive || !onPress) { return {content}; } return ( {content} ); };