ChatTextarea: pass ref to child
Fixes https://gitlab.com/soapbox-pub/soapbox/-/issues/1390
This commit is contained in:
parent
47561e5c01
commit
67ffe9609f
1 changed files with 4 additions and 4 deletions
|
@ -14,13 +14,13 @@ interface IChatTextarea extends React.ComponentProps<typeof Textarea> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Custom textarea for chats. */
|
/** Custom textarea for chats. */
|
||||||
const ChatTextarea: React.FC<IChatTextarea> = ({
|
const ChatTextarea: React.FC<IChatTextarea> = React.forwardRef(({
|
||||||
attachments,
|
attachments,
|
||||||
onDeleteAttachment,
|
onDeleteAttachment,
|
||||||
uploadCount = 0,
|
uploadCount = 0,
|
||||||
uploadProgress = 0,
|
uploadProgress = 0,
|
||||||
...rest
|
...rest
|
||||||
}) => {
|
}, ref) => {
|
||||||
const isUploading = uploadCount > 0;
|
const isUploading = uploadCount > 0;
|
||||||
|
|
||||||
const handleDeleteAttachment = (i: number) => {
|
const handleDeleteAttachment = (i: number) => {
|
||||||
|
@ -64,9 +64,9 @@ const ChatTextarea: React.FC<IChatTextarea> = ({
|
||||||
</HStack>
|
</HStack>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<Textarea theme='transparent' {...rest} />
|
<Textarea ref={ref} theme='transparent' {...rest} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
});
|
||||||
|
|
||||||
export default ChatTextarea;
|
export default ChatTextarea;
|
||||||
|
|
Loading…
Reference in a new issue