index.tsx 794 Bytes

import { Field } from '@formily/react';
import { FormItem, Input } from '@formily/antd-v5';
import cx from 'classnames';
import './index.less';
import { FieldProps } from '../../typings';

const TextAreaInput: React.FC<FieldProps> = (props) => {
  const { name, title, validator = [], decoratorProps, componentProps } = props;

  return (
    <div className={cx('global_textarea')}>
      <Field
        {...props}
        name={name}
        title={title}
        decorator={[FormItem, { ...decoratorProps }]}
        component={[
          Input.TextArea,
          {
            allowClear: true,
            ...componentProps,
            componenttypename: 'Input.TextArea',
          },
        ]}
        validator={validator}
      />
    </div>
  );
};

export default TextAreaInput;