Skip to content

Commit

Permalink
fix: Use ref from MessageInputWrapper props if present (#318)
Browse files Browse the repository at this point in the history
Fixes warning in which ref wasn't provided to forwardRef
if present, use the ref from component(MessageInputWrapper)
else use the one from context
  • Loading branch information
sravan-s authored Sep 26, 2022
1 parent b5bdbc7 commit f987980
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ export type MessageInputWrapperProps = {
};


const MessageInputWrapper = (props: MessageInputWrapperProps): JSX.Element => {
const MessageInputWrapper = (
props: MessageInputWrapperProps,
ref: React.MutableRefObject<any>,
): JSX.Element => {
const { value } = props;
const {
currentGroupChannel,
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit f987980

Please sign in to comment.