Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

SettingsChoiceRow.tsx

41 lines1.3 KB

1import { Pressable, View } from "react-native";
2​
3import { AppText as Text } from "../../../components/AppText";
4import { SymbolView } from "../../../components/AppSymbol";
5​
6export function SettingsChoiceRow(props: {
7 readonly label: string;
8 readonly description: string;
9 readonly selected: boolean;
10 readonly separated: boolean;
11 readonly disabled: boolean;
12 readonly onPress: () => void;
13}) {
14 return (
15 <Pressable
16 accessibilityRole="radio"
17 accessibilityState={{ checked: props.selected, disabled: props.disabled }}
18 className={
19 props.separated
20 ? "flex-row items-center gap-4 border-t border-border-subtle p-4 active:opacity-70"
21 : "flex-row items-center gap-4 p-4 active:opacity-70"
22 }
23 disabled={props.disabled}
24 onPress={props.onPress}
25 >
26 <View className="min-w-0 flex-1 gap-1">
27 <Text className="text-lg text-foreground android:text-base">{props.label}</Text>
28 <Text className="text-sm leading-normal text-foreground-muted">{props.description}</Text>
29 </View>
30 {props.selected ? (
31 <SymbolView
32 name="checkmark"
33 size={18}
34 tintColorClassName="accent-icon"
35 type="monochrome"
36 weight="semibold"
37 />
38 ) : null}
39 </Pressable>
40 );