1import React from 'react'; 2import {SwitchProps} from 'react-native'; 3import useColors from '@/hooks/useColors'; 4import {Switch} from 'react-native-gesture-handler'; 5import Color from 'color'; 6 7interface ISwitchProps extends SwitchProps {} 8export default function ThemeSwitch(props: ISwitchProps) { 9 const colors = useColors(); 10 return ( 11 <Switch 12 {...props} 13 trackColor={{ 14 false: Color(colors.textSecondary).alpha(0.8).toString(), 15 true: 16 Color(colors.textHighlight).alpha(0.8).toString() ?? 17 '#eba0b3', 18 }} 19 thumbColor={ 20 props?.value 21 ? colors.textHighlight ?? '#eba0b3' 22 : colors.textSecondary 23 } 24 onValueChange={props.onValueChange ?? undefined} 25 /> 26 ); 27} 28