import React from 'react';
import { Switch, SwitchProps } from 'react-native';
import { Colors } from '@/constants/Colors';
import { useColorScheme } from '@/hooks/useColorScheme';

type ThemedSwitchProps = SwitchProps;

const ThemedSwitch: React.FC<ThemedSwitchProps> = ({ ...props }) => {
  const scheme = useColorScheme() ?? 'dark';

  return (
    <Switch
      trackColor={{
        false: Colors[scheme].border,
        true: Colors[scheme].tint + '80',
      }}
      thumbColor={props.value ? Colors[scheme].tint : Colors[scheme].card}
      ios_backgroundColor={Colors[scheme].border}
      {...props}
    />
  );
};

export default ThemedSwitch;
