- {
- currentGroupChannel?.isFrozen && (
- renderFrozenNotification
- ? renderFrozenNotification()
- :
- )
- }
+ {currentGroupChannel?.isFrozen && renderFrozenNotification()}
{
/**
* Show unread count IFF scroll is not bottom or is bottom but hasNext is true.
@@ -309,12 +280,7 @@ export const MessageList = ({
tabIndex={0}
role="button"
>
-
+
)
}
diff --git a/src/modules/GroupChannel/components/GroupChannelUI/GroupChannelUIView.tsx b/src/modules/GroupChannel/components/GroupChannelUI/GroupChannelUIView.tsx
index e5bb4ab51..721e4c377 100644
--- a/src/modules/GroupChannel/components/GroupChannelUI/GroupChannelUIView.tsx
+++ b/src/modules/GroupChannel/components/GroupChannelUI/GroupChannelUIView.tsx
@@ -15,24 +15,66 @@ import type { MessageContentProps } from '../../../../ui/MessageContent';
export interface GroupChannelUIBasicProps {
// Components
+ /**
+ * A function that customizes the rendering of a loading placeholder component.
+ */
renderPlaceholderLoader?: () => React.ReactElement;
+ /**
+ * A function that customizes the rendering of a invalid placeholder component.
+ */
renderPlaceholderInvalid?: () => React.ReactElement;
+ /**
+ * A function that customizes the rendering of an empty placeholder component when there are no messages in the channel.
+ */
renderPlaceholderEmpty?: () => React.ReactElement;
+ /**
+ * A function that customizes the rendering of a header component.
+ */
renderChannelHeader?: (props: GroupChannelHeaderProps) => React.ReactElement;
+ /**
+ * A function that customizes the rendering of a message list component.
+ */
renderMessageList?: (props: GroupChannelMessageListProps) => React.ReactElement;
+ /**
+ * A function that customizes the rendering of a message input component.
+ */
renderMessageInput?: () => React.ReactElement;
// Sub components
// MessageList
+ /**
+ * A function that customizes the rendering of each message component in the message list component.
+ */
renderMessage?: (props: RenderMessageParamsType) => React.ReactElement;
+ /**
+ * A function that customizes the rendering of the content portion of each message component.
+ */
renderMessageContent?: (props: MessageContentProps) => React.ReactElement;
+ /**
+ * A function that customizes the rendering of a separator component between messages.
+ */
renderCustomSeparator?: (props: RenderCustomSeparatorProps) => React.ReactElement;
+ /**
+ * A function that customizes the rendering of a frozen notification component when the channel is frozen.
+ */
renderFrozenNotification?: () => React.ReactElement;
- // MessageInput
+ // MessageInput
+ /**
+ * A function that customizes the rendering of the file upload icon in the message input component.
+ */
renderFileUploadIcon?: () => React.ReactElement;
+ /**
+ * A function that customizes the rendering of the voice message icon in the message input component.
+ */
renderVoiceMessageIcon?: () => React.ReactElement;
+ /**
+ * A function that customizes the rendering of the send message icon in the message input component.
+ */
renderSendMessageIcon?: () => React.ReactElement;
+ /**
+ * A function that customizes the rendering of the typing indicator component.
+ */
renderTypingIndicator?: () => React.ReactElement;
}
diff --git a/src/modules/GroupChannel/components/Message/MessageView.tsx b/src/modules/GroupChannel/components/Message/MessageView.tsx
index 8f798aff1..7fc012ce7 100644
--- a/src/modules/GroupChannel/components/Message/MessageView.tsx
+++ b/src/modules/GroupChannel/components/Message/MessageView.tsx
@@ -28,11 +28,27 @@ export interface MessageProps {
chainBottom?: boolean;
handleScroll?: (isBottomMessageAffected?: boolean) => void;
- // for extending
- renderMessage?: (props: RenderMessageParamsType) => React.ReactElement;
+ /**
+ * Customizes all child components of the message.
+ * */
+ children?: React.ReactNode;
+ /**
+ * A function that customizes the rendering of the content portion of message component.
+ */
renderMessageContent?: (props: MessageContentProps) => React.ReactElement;
+ /**
+ * A function that customizes the rendering of a separator between messages.
+ */
renderCustomSeparator?: (props: RenderCustomSeparatorProps) => React.ReactElement;
+ /**
+ * A function that customizes the rendering of the edit input portion of the message component.
+ * */
renderEditInput?: () => React.ReactElement;
+ /**
+ * @deprecated Please use `children` instead
+ * @description Customizes all child components of the message.
+ * */
+ renderMessage?: (props: RenderMessageParamsType) => React.ReactElement;
}
export interface MessageViewProps extends MessageProps {
@@ -78,6 +94,7 @@ const MessageView = (props: MessageViewProps) => {
// MessageProps
message,
renderMessage,
+ children,
renderMessageContent = (props) => ,
renderCustomSeparator,
renderEditInput,
@@ -227,40 +244,55 @@ const MessageView = (props: MessageViewProps) => {
}, [animatedMessageId, messageScrollRef.current, message.messageId]);
const renderedCustomSeparator = useMemo(() => renderCustomSeparator?.({ message }) ?? null, [message, renderCustomSeparator]);
- const renderedMessage = useMemo(() => renderMessage?.(props), [message, renderMessage]);
- if (renderedMessage) {
+ const renderChildren = () => {
+ if (children) {
+ return children;
+ }
+
+ if (renderMessage) {
+ const messageProps = { ...props, renderMessage: undefined };
+ return renderMessage(messageProps);
+ }
+
return (
-