Created
July 24, 2025 16:33
-
-
Save matinzd/17a81fe4c4284d8dc986d00597e0e709 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { useAppTheme } from '@kreddy-frontend/shared-ui'; | |
| import { Platform } from 'react-native'; | |
| import { Switch } from 'react-native-gesture-handler'; | |
| interface ToggleProps { | |
| value: boolean; | |
| onValueChange: (value: boolean) => void; | |
| disabled?: boolean; | |
| } | |
| export const Toggle = ({ value, onValueChange, disabled }: ToggleProps) => { | |
| const { colors } = useAppTheme(); | |
| return ( | |
| <Switch | |
| hitSlop={12} | |
| trackColor={Platform.select({ | |
| ios: { | |
| false: colors.white, | |
| true: colors.black_10, | |
| }, | |
| android: { | |
| false: colors.black_60, | |
| true: colors.black_40, | |
| }, | |
| })} | |
| thumbColor={Platform.select({ | |
| ios: value ? colors.white : colors.black_10, | |
| android: value ? colors.black_10 : colors.gray_80, | |
| })} | |
| onValueChange={onValueChange} | |
| value={value} | |
| disabled={disabled} | |
| style={{ backgroundColor: 'red' }} | |
| // style={Platform.select({ ios: { minWidth: 68 } })} | |
| /> | |
| ); | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment