import { RadioOption } from "../types"; import ViewAtom from "../atoms/ViewAtom"; import Typography, { TypographyProps } from "../Typography"; import ZSPressable from "../ZSPressable"; import { ViewProps } from "react-native/types"; const RadioGroup = ({ options, value, onSelect, containerStyle, valueStyle, normalColor = '#E7EDF0', selectedColor = '#FFA900', minWidth, disabled = false, fullWidth = false, selectStyle }: { options: RadioOption[]; value?: RadioOption; onSelect: (value: RadioOption) => void; containerStyle?: ViewProps; valueStyle?: TypographyProps; selectStyle?: TypographyProps; normalColor?: string; selectedColor?: string; minWidth?: number; disabled?: boolean; fullWidth?: boolean; }) => { return ( { options.map((option, _) => { const isSelected = value?.index === option.index; const setColor = isSelected ? selectedColor : normalColor; return ( { if (disabled) return; onSelect(option); }} pressedBackgroundColor='transparent' flex={!minWidth ? 1 : undefined} minWidth={minWidth} > { !fullWidth && ( ) } {option.value} { fullWidth && ( 선택 ) } ) }) } ) } export default RadioGroup;