Skip to content

Commit f987980

Browse files
authored
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
1 parent b5bdbc7 commit f987980

File tree

1 file changed

+5
-2
lines changed
  • src/smart-components/Channel/components/MessageInput

1 file changed

+5
-2
lines changed

src/smart-components/Channel/components/MessageInput/index.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ export type MessageInputWrapperProps = {
1616
};
1717

1818

19-
const MessageInputWrapper = (props: MessageInputWrapperProps): JSX.Element => {
19+
const MessageInputWrapper = (
20+
props: MessageInputWrapperProps,
21+
ref: React.MutableRefObject<any>,
22+
): JSX.Element => {
2023
const { value } = props;
2124
const {
2225
currentGroupChannel,
@@ -139,7 +142,7 @@ const MessageInputWrapper = (props: MessageInputWrapperProps): JSX.Element => {
139142
|| (utils.isDisabledBecauseFrozen(channel) && stringSet.MESSAGE_INPUT__PLACE_HOLDER__DISABLED)
140143
|| (utils.isDisabledBecauseMuted(channel) && stringSet.MESSAGE_INPUT__PLACE_HOLDER__MUTED)
141144
}
142-
ref={messageInputRef}
145+
ref={ref || messageInputRef}
143146
disabled={disabled}
144147
onStartTyping={() => {
145148
channel?.startTyping();

0 commit comments

Comments
 (0)