Skip to content

Commit

Permalink
fix: resize textarea on input changes
Browse files Browse the repository at this point in the history
Closes #1011
  • Loading branch information
Skaiir authored and vsgoulart committed Feb 1, 2024
1 parent 06b00f1 commit 0ff522b
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function Textarea(props) {
const { required } = validate;
const textareaRef = useRef();

const [ onInputChange, flushOnChange ] = useFlushDebounce(({ target }) => {
const [ onChange, flushOnChange ] = useFlushDebounce(({ target }) => {
props.onChange({
field,
value: target.value
Expand All @@ -49,6 +49,11 @@ export function Textarea(props) {
onFocus && onFocus();
};

const onInputChange = (event) => {
onChange({ target: event.target });
autoSizeTextarea(textareaRef.current);
};

useLayoutEffect(() => {
autoSizeTextarea(textareaRef.current);
}, [ value ]);
Expand Down

0 comments on commit 0ff522b

Please sign in to comment.