1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-24 20:36:40 +07:00

fixed textarea autosizing on commit

This commit is contained in:
Fedor Katurov 2022-01-27 18:59:16 +07:00
parent 145b601a96
commit 476ce8ba88

View file

@ -11,7 +11,6 @@ import React, {
import autosize from 'autosize';
import classNames from 'classnames';
import { InputWrapper } from '~/components/input/InputWrapper';
import { useForwardRef } from '~/hooks/dom/useForwardRef';
@ -58,14 +57,14 @@ const Textarea = forwardRef<HTMLTextAreaElement, IProps>(
useEffect(() => {
if (!ref?.current) return;
autosize(ref?.current);
autosize(ref.current);
return () => autosize.destroy(ref);
}, [ref]);
useEffect(() => {
if (!ref?.current) return;
autosize.update(ref);
autosize.update(ref.current);
}, [ref, value, forwardRef]);
return (