Skip to content

Commit 4546fb7

Browse files
Initial commit
1 parent 7032fb0 commit 4546fb7

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

src/components/Message/Message.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,11 @@ const MessageWithContext = (props: MessageWithContextProps) => {
7272

7373
const { client, isMessageAIGenerated } = useChatContext('Message');
7474
const { channelConfig, read } = useChannelStateContext('Message');
75-
const { Message: contextMessage } = useComponentContext('Message');
75+
const {
76+
Message: contextMessage = DefaultMessageUI,
77+
// TODO: remove this passthrough once we drop Message from the ComponentContext
78+
MessageUI: contextMessageUI = contextMessage,
79+
} = useComponentContext('Message');
7680
const { getTranslationView, setTranslationView: setTranslationViewInContext } =
7781
useMessageTranslationViewContext();
7882

@@ -83,7 +87,7 @@ const MessageWithContext = (props: MessageWithContextProps) => {
8387
);
8488

8589
const actionsEnabled = message.type === 'regular' && message.status === 'received';
86-
const MessageUIComponent = propMessage ?? contextMessage ?? DefaultMessageUI;
90+
const MessageUIComponent = propMessage ?? contextMessageUI;
8791

8892
const { onUserClick, onUserHover } = useUserHandler(message, {
8993
onUserClickHandler: propOnUserClick,

src/context/ComponentContext.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,10 @@ export type ComponentContextValue = {
158158
/** Custom UI component for determinate progress (0–100), defaults to and accepts same props as: [ProgressIndicator](https://github.com/GetStream/stream-chat-react/blob/master/src/components/Loading/progress-indicators.tsx) */
159159
ProgressIndicator?: React.ComponentType<ProgressIndicatorProps>;
160160
/** Custom UI component to display a message in the standard `MessageList`, defaults to and accepts the same props as: [MessageUI](https://github.com/GetStream/stream-chat-react/blob/master/src/components/Message/MessageUI.tsx) */
161+
MessageUI?: React.ComponentType<MessageUIComponentProps>;
162+
/** Custom UI component to display a message in the standard `MessageList`, defaults to and accepts the same props as: [MessageUI](https://github.com/GetStream/stream-chat-react/blob/master/src/components/Message/MessageUI.tsx)
163+
* @deprecated use `MessageUI` instead
164+
*/
161165
Message?: React.ComponentType<MessageUIComponentProps>;
162166
/** Custom UI component for message actions popup, accepts no props, all the defaults are set within [MessageActions (unstable)](https://github.com/GetStream/stream-chat-react/blob/master/src/experimental/MessageActions/MessageActions.tsx) */
163167
MessageActions?: React.ComponentType;

0 commit comments

Comments
 (0)