mirror of
https://github.com/ConvoyPanel/panel.git
synced 2026-06-22 03:42:47 +08:00
14 lines
588 B
TypeScript
14 lines
588 B
TypeScript
import TextInput, { TextInputProps } from '@/components/elements/inputs/TextInput'
|
|
import { Field as FormikField, FieldProps } from 'formik'
|
|
import { forwardRef } from 'react'
|
|
|
|
const TextInputFormik = forwardRef<HTMLInputElement, Omit<TextInputProps, 'error'>>(({ name, ...props }, ref) => (
|
|
<FormikField innerRef={ref} name={name}>
|
|
{({ field, form: { errors, touched } }: FieldProps) => (
|
|
<TextInput {...field} {...props} error={touched[field.name] ? (errors[field.name] as string) : undefined} />
|
|
)}
|
|
</FormikField>
|
|
))
|
|
|
|
export default TextInputFormik
|