import React, {useState} from 'react' import {View} from 'react-native' import {RadioButton} from './RadioButton' import {ButtonType} from './Button' import {s} from 'lib/styles' export interface RadioGroupItem { label: string | JSX.Element key: string } export function RadioGroup({ testID, type, items, initialSelection = '', onSelect, }: { testID?: string type?: ButtonType items: RadioGroupItem[] initialSelection?: string onSelect: (key: string) => void }) { const [selection, setSelection] = useState(initialSelection) const onSelectInner = (key: string) => { setSelection(key) onSelect(key) } return ( {items.map((item, i) => ( onSelectInner(item.key)} /> ))} ) }