zucchetti-sa5/themes/onepirate/modules/form/RFTextField.tsx

34 lines
740 B
TypeScript
Raw Normal View History

2022-10-28 11:41:58 +02:00
import * as React from 'react';
import { FieldRenderProps } from 'react-final-form';
import TextField, { OnePirateTextFieldProps } from '../components/TextField';
function RFTextField(
props: OnePirateTextFieldProps & FieldRenderProps<string, HTMLElement>,
) {
const {
autoComplete,
input,
InputProps,
meta: { touched, error, submitError },
...other
} = props;
return (
<TextField
error={Boolean(!!touched && (error || submitError))}
{...input}
{...other}
InputProps={{
inputProps: {
autoComplete,
},
...InputProps,
}}
helperText={touched ? error || submitError : ''}
variant="standard"
/>
);
}
export default RFTextField;