mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 04:46:40 +07:00
fixed textarea autosizing on commit
This commit is contained in:
parent
145b601a96
commit
476ce8ba88
1 changed files with 2 additions and 3 deletions
|
@ -11,7 +11,6 @@ import React, {
|
||||||
import autosize from 'autosize';
|
import autosize from 'autosize';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
|
||||||
|
|
||||||
import { InputWrapper } from '~/components/input/InputWrapper';
|
import { InputWrapper } from '~/components/input/InputWrapper';
|
||||||
import { useForwardRef } from '~/hooks/dom/useForwardRef';
|
import { useForwardRef } from '~/hooks/dom/useForwardRef';
|
||||||
|
|
||||||
|
@ -58,14 +57,14 @@ const Textarea = forwardRef<HTMLTextAreaElement, IProps>(
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!ref?.current) return;
|
if (!ref?.current) return;
|
||||||
autosize(ref?.current);
|
autosize(ref.current);
|
||||||
return () => autosize.destroy(ref);
|
return () => autosize.destroy(ref);
|
||||||
}, [ref]);
|
}, [ref]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!ref?.current) return;
|
if (!ref?.current) return;
|
||||||
|
|
||||||
autosize.update(ref);
|
autosize.update(ref.current);
|
||||||
}, [ref, value, forwardRef]);
|
}, [ref, value, forwardRef]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue