From affc1140dfc304ce0f1ed28008397fcc9b6da323 Mon Sep 17 00:00:00 2001 From: KaustubhKumar05 Date: Mon, 20 May 2024 15:38:29 +0530 Subject: [PATCH] fix: use usecallback --- .../src/Prebuilt/components/Chat/ChatFooter.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/roomkit-react/src/Prebuilt/components/Chat/ChatFooter.tsx b/packages/roomkit-react/src/Prebuilt/components/Chat/ChatFooter.tsx index ce708c0351..a5b6865219 100644 --- a/packages/roomkit-react/src/Prebuilt/components/Chat/ChatFooter.tsx +++ b/packages/roomkit-react/src/Prebuilt/components/Chat/ChatFooter.tsx @@ -103,17 +103,17 @@ export const ChatFooter = ({ onSend, children }: { onSend: (count: number) => vo } }, [defaultSelection, selectedPeer, selectedRole, setRoleSelector, isMobile, isLandscapeHLSStream, elements?.chat]); - const resetInputHeight = () => { + const resetInputHeight = useCallback(() => { if (inputRef.current) { inputRef.current.style.height = `${Math.max(32, inputRef.current.value ? inputRef.current.scrollHeight : 0)}px`; } - }; + }, []); - const updateInputHeight = () => { + const updateInputHeight = useCallback(() => { if (inputRef.current) { inputRef.current.style.height = `${Math.max(32, Math.min(inputRef.current.scrollHeight, 24 * 4))}px`; } - }; + }, []); const sendMessage = useCallback(async () => { const message = inputRef?.current?.value;