import type {StyleProp, TextStyle, ViewStyle} from 'react-native'; import {View} from 'react-native'; import styled from '@emotion/native'; import {Heading3} from '../Typography/Typography'; import type {RadioButtonProps, RadioButtonStyles} from './RadioButton'; import RadioButtonComp from './RadioButton'; type Styles = { container?: StyleProp; title?: StyleProp; radio?: StyleProp; radioStyles?: RadioButtonStyles; }; export type RadioButtonType = | 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'light'; type Props = { title?: string; data: T[]; selectedValue: T; selectValue?: (item: T) => void; type?: RadioButtonType; style?: StyleProp; styles?: Styles; labels?: string[]; radioType?: Omit; labelPosition?: 'left' | 'right'; }; const Container = styled.View` flex-direction: column; justify-content: center; `; const Content = styled.View` flex-direction: row; `; function RadioGroupContainer({ title, data, selectedValue, selectValue, style, styles, type, labels, labelPosition, radioType, }: Omit, 'selected'>): JSX.Element { return ( {title} {title ? : null} {data.map((datum, i) => { return ( selectValue?.(datum)} selected={selectedValue === datum} style={styles?.radio} styles={styles?.radioStyles} type={type} /> ); })} ); } export const RadioGroup = RadioGroupContainer; export const RadioButton = RadioButtonComp;