Skip to content

Commit ad3ef0f

Browse files
authored
Merge pull request #349 from GetStream/thread-message-hotfix
Use Message prop for Thread
2 parents 5f4f491 + f4d9117 commit ad3ef0f

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/components/Thread/Thread.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const Thread = (props) => {
4545
const { t } = translationContext;
4646
const channelContext = useContext(ChannelContext);
4747
const { channel } = channelContext;
48-
const { Message } = useContext(MessagesContext);
48+
const { Message: MessageFromContext } = useContext(MessagesContext);
4949
const {
5050
loadMoreThread,
5151
thread,
@@ -56,6 +56,7 @@ const Thread = (props) => {
5656
const chatContext = useContext(ChatContext);
5757
const {
5858
autoFocus = true,
59+
Message: MessageFromProps,
5960
MessageList = DefaultMessageList,
6061
MessageInput = DefaultMessageInput,
6162
additionalParentMessageProps,
@@ -64,6 +65,8 @@ const Thread = (props) => {
6465
additionalMessageInputProps,
6566
} = props;
6667

68+
const Message = MessageFromProps || MessageFromContext;
69+
6770
/**
6871
* TODO: This should be removed when possible along with the spread into Message
6972
*/
@@ -164,6 +167,11 @@ Thread.propTypes = {
164167
* */
165168
/** Disables the thread UI. So MessageInput and MessageList will be disabled. */
166169
disabled: PropTypes.bool,
170+
/**
171+
* Custom UI component to display a message in MessageList component
172+
* Default component (accepts the same props): [MessageSimple](https://getstream.github.io/stream-chat-react-native/#messagesimple)
173+
* */
174+
Message: PropTypes.oneOfType([PropTypes.node, PropTypes.elementType]),
167175
MessageInput: PropTypes.oneOfType([PropTypes.node, PropTypes.elementType]),
168176
/**
169177
* **Customized MessageList component to used within Thread instead of default MessageList

0 commit comments

Comments
 (0)