1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 12:56:41 +07:00

#34 made local comment form uploads

This commit is contained in:
Fedor Katurov 2021-02-27 17:51:12 +07:00
parent f45e34f330
commit 051b199d5d
14 changed files with 422 additions and 189 deletions

View file

@ -6,7 +6,7 @@ import React, {
useCallback,
useEffect,
useRef,
useState,
useState
} from 'react';
import classNames from 'classnames';
import autosize from 'autosize';
@ -59,14 +59,21 @@ const Textarea = memo<IProps>(
const onFocus = useCallback(() => setFocused(true), [setFocused]);
const onBlur = useCallback(() => setFocused(false), [setFocused]);
useEffect(() => {
const target = ref?.current;
if (!target) return;
autosize(target);
setRef(target);
return () => autosize.destroy(target);
}, [ref, setRef]);
useEffect(() => {
if (!ref.current) return;
autosize(ref.current);
setRef(ref.current);
return () => autosize.destroy(ref.current);
}, [ref.current]);
autosize.update(ref.current);
}, [value]);
return (
<div
@ -89,7 +96,7 @@ const Textarea = memo<IProps>(
onFocus={onFocus}
onBlur={onBlur}
style={{
maxHeight: maxRows * 20,
// maxHeight: maxRows * 20,
minHeight: minRows * 20,
}}
{...props}