Files
native-app/apps/expo/src/components/ui/Switch.tsx
2024-04-02 17:38:16 +02:00

28 lines
629 B
TypeScript

import type { SwitchProps, SwitchThumbProps } from "tamagui";
import { Switch, useTheme } from "tamagui";
const MWSwitch = (props: SwitchProps) => {
const theme = useTheme();
return (
<Switch
native
nativeProps={{
trackColor: {
true: theme.switchActiveTrackColor.val,
false: theme.switchInactiveTrackColor.val,
},
thumbColor: theme.switchThumbColor.val,
}}
{...props}
/>
);
};
const MWSwitchThumb = (props: SwitchThumbProps) => {
return <Switch.Thumb animation="bounce" {...props} />;
};
MWSwitch.Thumb = MWSwitchThumb;
export { MWSwitch };