Open History to see the last commit
1import type { ComponentProps } from "react";
2import { View } from "react-native";
3
4import { SymbolView } from "../../../components/AppSymbol";
5import { AppText as Text } from "../../../components/AppText";
6import { ThemedSwitch } from "../../../components/ThemedSwitch";
7
8type SymbolName = ComponentProps<typeof SymbolView>["name"];
9
10export function SettingsSwitchRow(props: {
11 readonly disabled?: boolean;
12 readonly icon: SymbolName;
13 readonly label: string;
14 readonly subtitle?: string;
15 readonly value: boolean;
16 readonly onValueChange: (value: boolean) => void;
17}) {
18 return (
19 <View
20 className={
21 props.disabled
22 ? "flex-row items-center gap-4 p-4 opacity-[0.45]"
23 : "flex-row items-center gap-4 p-4"
24 }
25 >
26 <SymbolView
27 name={props.icon}
28 size={22}
29 tintColorClassName={"accent-icon"}
30 type="monochrome"
31 weight="regular"
32 />
33 <View className="min-w-0 flex-1">
34 <Text className="text-lg text-foreground">{props.label}</Text>
35 {props.subtitle ? (
36 <Text className="text-sm text-foreground-muted">{props.subtitle}</Text>
37 ) : null}
38 </View>
39 <ThemedSwitch
40 disabled={props.disabled}
41 onValueChange={props.onValueChange}
42 value={props.value}
43 />
44 </View>
45 );
46}