import React, { useEffect, useState } from 'react' import { Control, Controller, FieldError } from 'react-hook-form' import { Text } from 'react-native' import { Container, Label, RadioContainer, RadioButtonLabel, RadioFill, RadioButton, Content, ErrorMessage, } from './styles' interface DataProps { label: string value: string } interface RadioProps { label?: string control: Control name: string data: DataProps[] } const Radio: React.FC = ({ control, name, label, data }) => { useEffect(() => {}, []) return ( {label && } ( <> {data.map(item => ( onChange(item.value)} > {item.label} {value && value === item.value && } ))} {errors[name] && ( {errors[name].message} )} )} /> ) } export default Radio