import { HelperText, Subheading } from "react-native-paper"
import * as React from "react"
import { FieldProps } from "formik"
import { FunctionComponent } from "react"

interface IProps extends FieldProps {
  label: string
  error: string
  touched: string
  id: number
}

export const InputRadioGroup: FunctionComponent<IProps> = (props) => {
  const { error, touched, label, children, id } = props
  return (
    <>
      <Subheading>{label}</Subheading>
      {children}

      <HelperText type='error' visible={!!touched[id]}>
        {error[id]}
      </HelperText>
    </>
  )
}
