From f9879808e311dac6b9858f631ed0d24c609fd248 Mon Sep 17 00:00:00 2001 From: Sravan S Date: Mon, 26 Sep 2022 19:09:47 +0900 Subject: [PATCH] fix: Use ref from MessageInputWrapper props if present (#318) Fixes warning in which ref wasn't provided to forwardRef if present, use the ref from component(MessageInputWrapper) else use the one from context --- .../Channel/components/MessageInput/index.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/smart-components/Channel/components/MessageInput/index.tsx b/src/smart-components/Channel/components/MessageInput/index.tsx index 2a0a033ee..447ba89a0 100644 --- a/src/smart-components/Channel/components/MessageInput/index.tsx +++ b/src/smart-components/Channel/components/MessageInput/index.tsx @@ -16,7 +16,10 @@ export type MessageInputWrapperProps = { }; -const MessageInputWrapper = (props: MessageInputWrapperProps): JSX.Element => { +const MessageInputWrapper = ( + props: MessageInputWrapperProps, + ref: React.MutableRefObject, +): JSX.Element => { const { value } = props; const { currentGroupChannel, @@ -139,7 +142,7 @@ const MessageInputWrapper = (props: MessageInputWrapperProps): JSX.Element => { || (utils.isDisabledBecauseFrozen(channel) && stringSet.MESSAGE_INPUT__PLACE_HOLDER__DISABLED) || (utils.isDisabledBecauseMuted(channel) && stringSet.MESSAGE_INPUT__PLACE_HOLDER__MUTED) } - ref={messageInputRef} + ref={ref || messageInputRef} disabled={disabled} onStartTyping={() => { channel?.startTyping();