import { StyleProp, View, ViewStyle } from 'react-native'; import ToggleSwitch from 'toggle-switch-react-native'; import { tw } from '../../core/tailwind'; import { Text } from './Text'; // "isOn" is omitted here because we handle it ourselves (using value) type SwitchProps = Omit, 'isOn'> & { onChange: (active: boolean) => boolean | Promise | Promise; value: boolean; label?: string; containerStyle?: StyleProp; labelStyle?: StyleProp; activeText?: string; inActiveText?: string; }; export function Switch({ onChange, value, label, containerStyle, labelStyle, ...restProps }: SwitchProps) { return ( {label ? {label} : null} ); }