import React, { useEffect, useRef } from 'react'; import { TextAreaProps } from './types'; const TextArea = ({ value, isAutoFocused, id, maxLength, name, placeholder, className, children, onChange, onPaste, onKeyDown, }: TextAreaProps) => { const textAreaRef = useRef(null); useEffect(() => { const autoResizeTextArea = () => { if (textAreaRef.current) { textAreaRef.current.style.height = 'auto'; const maxHeight = 96; const currentContentHeight = textAreaRef.current.scrollHeight; const newHeight = Math.min(maxHeight, currentContentHeight); textAreaRef.current.style.height = `${newHeight}px`; } }; autoResizeTextArea(); }, [value]); return ( ); }; export default TextArea;