import React, { useState, useRef } from "react"; // commons import { classNames } from "constants/common"; // hooks import useAutosizeTextArea from "lib/hooks/useAutosizeTextArea"; // types import { Props } from "./types"; const TextArea: React.FC = ({ id, label, className, value, placeholder, name, register, mode = "primary", rows, cols, disabled, error, validations, onChange, ...rest }) => { const [textareaValue, setTextareaValue] = useState(value ?? ""); const textAreaRef = useRef(null); useAutosizeTextArea(textAreaRef.current, textareaValue); return ( <> {label && ( )} {error?.message &&
{error.message}
} ); }; export default TextArea;