ChatTextarea: pass ref to child

Fixes https://gitlab.com/soapbox-pub/soapbox/-/issues/1390
environments/review-emoji-floa-3ldg6x/deployments/2906
Alex Gleason 2 years ago
parent 47561e5c01
commit 67ffe9609f
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7

@ -14,13 +14,13 @@ interface IChatTextarea extends React.ComponentProps<typeof Textarea> {
}
/** Custom textarea for chats. */
const ChatTextarea: React.FC<IChatTextarea> = ({
const ChatTextarea: React.FC<IChatTextarea> = React.forwardRef(({
attachments,
onDeleteAttachment,
uploadCount = 0,
uploadProgress = 0,
...rest
}) => {
}, ref) => {
const isUploading = uploadCount > 0;
const handleDeleteAttachment = (i: number) => {
@ -64,9 +64,9 @@ const ChatTextarea: React.FC<IChatTextarea> = ({
</HStack>
)}
<Textarea theme='transparent' {...rest} />
<Textarea ref={ref} theme='transparent' {...rest} />
</div>
);
};
});
export default ChatTextarea;

Loading…
Cancel
Save