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:
parent
145b601a96
commit
476ce8ba88
1 changed files with 2 additions and 3 deletions
|
@ -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 (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue