import { Controller, useFormContext } from 'react-hook-form'; import { StyleProp, View, ViewStyle } from 'react-native'; import { Text } from '../../components/form/Text'; import { tw } from '../../core/tailwind'; import { Select } from '../form/Select'; // "onSelect" is omitted here because this uses it's own handler type FormSelectProps = Omit, 'onSelect'> & { name: string; label?: string; required?: boolean; labelStyle?: StyleProp; }; export function FormSelect({ name, label, required, labelStyle, ...restOfProps }: FormSelectProps) { const form = useFormContext(); const errors = form?.formState?.errors || ''; const errorMessage = errors[name]?.message?.toString(); return ( {label ? ( {label} * ) : null} (