|
| 1 | +/* eslint-disable react-native/no-inline-styles */ |
| 2 | +import { |
| 3 | + MultiswitchController, |
| 4 | + type ControllerVariant, |
| 5 | +} from 'react-native-multiswitch-controller'; |
| 6 | +import ExampleWrapper from './ExampleWrapper'; |
| 7 | + |
| 8 | +type AlignProps = { |
| 9 | + variant: ControllerVariant; |
| 10 | +}; |
| 11 | + |
| 12 | +export default function Align({ variant }: AlignProps) { |
| 13 | + return ( |
| 14 | + <ExampleWrapper title="Align to left, center or right"> |
| 15 | + <MultiswitchController<'First' | 'Second'> |
| 16 | + options={[ |
| 17 | + { value: 'First', label: 'First' }, |
| 18 | + { value: 'Second', label: 'Second' }, |
| 19 | + ]} |
| 20 | + defaultOption="First" |
| 21 | + variant={variant} |
| 22 | + styleProps={{ |
| 23 | + align: 'left', |
| 24 | + inactiveBackgroundColor: 'rgb(21, 87, 21)', |
| 25 | + activeBackgroundColor: 'rgb(60, 180, 20)', |
| 26 | + inactiveTextColor: 'rgb(208, 249, 205)', |
| 27 | + containerHeight: 52, |
| 28 | + itemHeight: 46, |
| 29 | + }} |
| 30 | + /> |
| 31 | + <MultiswitchController<'First' | 'Second'> |
| 32 | + options={[ |
| 33 | + { value: 'First', label: 'First' }, |
| 34 | + { value: 'Second', label: 'Second' }, |
| 35 | + ]} |
| 36 | + defaultOption="Second" |
| 37 | + variant={variant} |
| 38 | + styleProps={{ |
| 39 | + align: 'center', |
| 40 | + inactiveBackgroundColor: 'rgba(220, 38, 38, 0.08)', |
| 41 | + activeBackgroundColor: 'rgb(185, 28, 28)', |
| 42 | + inactiveTextColor: 'rgb(185, 28, 28)', |
| 43 | + containerHeight: 28, |
| 44 | + itemHeight: 24, |
| 45 | + customTextStyle: { |
| 46 | + fontSize: 10, |
| 47 | + }, |
| 48 | + customItemStyle: { |
| 49 | + paddingHorizontal: 8, |
| 50 | + paddingVertical: 2, |
| 51 | + borderRadius: 0, |
| 52 | + }, |
| 53 | + customActiveOptionStyle: { |
| 54 | + borderRadius: 0, |
| 55 | + }, |
| 56 | + customContainerStyle: { |
| 57 | + borderRadius: 0, |
| 58 | + }, |
| 59 | + }} |
| 60 | + /> |
| 61 | + <MultiswitchController<'First' | 'Second' | 'Third'> |
| 62 | + options={[ |
| 63 | + { value: 'First', label: 'First' }, |
| 64 | + { value: 'Second', label: 'Second' }, |
| 65 | + { value: 'Third', label: 'Third' }, |
| 66 | + ]} |
| 67 | + defaultOption="First" |
| 68 | + variant={variant} |
| 69 | + styleProps={{ |
| 70 | + align: 'right', |
| 71 | + inactiveBackgroundColor: 'rgba(205, 197, 40, 0.08)', |
| 72 | + activeBackgroundColor: 'rgb(180, 170, 20)', |
| 73 | + inactiveTextColor: 'rgb(180, 170, 20)', |
| 74 | + containerHeight: 28, |
| 75 | + itemHeight: 24, |
| 76 | + customTextStyle: { |
| 77 | + fontSize: 10, |
| 78 | + }, |
| 79 | + customItemStyle: { |
| 80 | + paddingHorizontal: 8, |
| 81 | + paddingVertical: 2, |
| 82 | + }, |
| 83 | + }} |
| 84 | + /> |
| 85 | + </ExampleWrapper> |
| 86 | + ); |
| 87 | +} |
0 commit comments