Skip to content

Commit abe10de

Browse files
committed
fix: add overrides for StreamingMessageView
1 parent a32686f commit abe10de

File tree

5 files changed

+16
-3
lines changed

5 files changed

+16
-3
lines changed

package/src/components/Channel/Channel.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ import { MessageStatus as MessageStatusDefault } from '../Message/MessageSimple/
142142
import { MessageTimestamp as MessageTimestampDefault } from '../Message/MessageSimple/MessageTimestamp';
143143
import { ReactionListBottom as ReactionListBottomDefault } from '../Message/MessageSimple/ReactionList/ReactionListBottom';
144144
import { ReactionListTop as ReactionListTopDefault } from '../Message/MessageSimple/ReactionList/ReactionListTop';
145+
import { StreamingMessageView as DefaultStreamingMessageView } from '../Message/MessageSimple/StreamingMessageView';
145146
import { AttachButton as AttachButtonDefault } from '../MessageInput/AttachButton';
146147
import { CommandsButton as CommandsButtonDefault } from '../MessageInput/CommandsButton';
147148
import { AudioRecorder as AudioRecorderDefault } from '../MessageInput/components/AudioRecorder/AudioRecorder';
@@ -354,6 +355,7 @@ export type ChannelPropsWithContext<
354355
| 'VideoThumbnail'
355356
| 'PollContent'
356357
| 'hasCreatePoll'
358+
| 'StreamingMessageView'
357359
>
358360
> &
359361
Partial<Pick<ThreadContextValue<StreamChatGenerics>, 'allowThreadMessagesInChannel'>> & {
@@ -633,6 +635,7 @@ const ChannelWithContext = <
633635
StartAudioRecordingButton = AudioRecordingButtonDefault,
634636
stateUpdateThrottleInterval = defaultThrottleInterval,
635637
StickyHeader = StickyHeaderDefault,
638+
StreamingMessageView = DefaultStreamingMessageView,
636639
supportedReactions = reactionData,
637640
t,
638641
thread: threadFromProps,
@@ -2360,6 +2363,7 @@ const ChannelWithContext = <
23602363
setEditingState,
23612364
setQuotedMessageState,
23622365
shouldShowUnreadUnderlay,
2366+
StreamingMessageView,
23632367
supportedReactions,
23642368
targetedMessage,
23652369
TypingIndicator,

package/src/components/Channel/hooks/useCreateMessagesContext.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ export const useCreateMessagesContext = <
9696
setEditingState,
9797
setQuotedMessageState,
9898
shouldShowUnreadUnderlay,
99+
StreamingMessageView,
99100
supportedReactions,
100101
targetedMessage,
101102
TypingIndicator,
@@ -205,6 +206,7 @@ export const useCreateMessagesContext = <
205206
setEditingState,
206207
setQuotedMessageState,
207208
shouldShowUnreadUnderlay,
209+
StreamingMessageView,
208210
supportedReactions,
209211
targetedMessage,
210212
TypingIndicator,

package/src/components/Message/MessageSimple/MessageContent.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ import {
1010

1111
import { MessageTextContainer } from './MessageTextContainer';
1212

13-
import { StreamingMessageView } from './StreamingMessageView';
14-
1513
import { useChatContext } from '../../../contexts';
1614
import {
1715
MessageContextValue,
@@ -93,6 +91,7 @@ export type MessageContentPropsWithContext<
9391
| 'MessageError'
9492
| 'myMessageTheme'
9593
| 'Reply'
94+
| 'StreamingMessageView'
9695
> &
9796
Pick<TranslationContextValue, 't'> & {
9897
setMessageContentWidth: React.Dispatch<React.SetStateAction<number>>;
@@ -134,6 +133,7 @@ const MessageContentWithContext = <
134133
preventPress,
135134
Reply,
136135
setMessageContentWidth,
136+
StreamingMessageView,
137137
threadList,
138138
} = props;
139139
const { client } = useChatContext();
@@ -493,6 +493,7 @@ export const MessageContent = <
493493
MessageError,
494494
myMessageTheme,
495495
Reply,
496+
StreamingMessageView,
496497
} = useMessagesContext<StreamChatGenerics>();
497498
const { t } = useTranslationContext();
498499

@@ -520,6 +521,7 @@ export const MessageContent = <
520521
otherAttachments,
521522
preventPress,
522523
Reply,
524+
StreamingMessageView,
523525
t,
524526
threadList,
525527
}}

package/src/components/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ export * from './KeyboardCompatibleView/KeyboardCompatibleView';
9797
export * from './Message/hooks/useCreateMessageContext';
9898
export * from './Message/hooks/useMessageActions';
9999
export * from './Message/hooks/useMessageActionHandlers';
100+
export * from './Message/hooks/useStreamingMessage';
100101
export * from './Message/Message';
101102
export * from './Message/MessageSimple/MessageAvatar';
102103
export * from './Message/MessageSimple/MessageBounce';

package/src/contexts/messagesContext/MessagesContext.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { PressableProps } from 'react-native';
44

55
import type { Attachment, ChannelState, MessageResponse } from 'stream-chat';
66

7-
import { PollContentProps } from '../../components';
7+
import type { PollContentProps, StreamingMessageViewProps } from '../../components';
88
import type { AttachmentProps } from '../../components/Attachment/Attachment';
99
import type { AttachmentActionsProps } from '../../components/Attachment/AttachmentActions';
1010
import type { AudioAttachmentProps } from '../../components/Attachment/AudioAttachment';
@@ -295,6 +295,10 @@ export type MessagesContextValue<
295295
sendReaction: (type: string, messageId: string) => Promise<void>;
296296
setEditingState: (message?: MessageType<StreamChatGenerics>) => void;
297297
setQuotedMessageState: (message?: MessageType<StreamChatGenerics>) => void;
298+
/**
299+
* UI component for StreamingMessageView. Displays the text of a message with a typewriter animation.
300+
*/
301+
StreamingMessageView: React.ComponentType<StreamingMessageViewProps<StreamChatGenerics>>;
298302
/**
299303
* UI component for TypingIndicator
300304
* Defaults to: [TypingIndicator](https://getstream.io/chat/docs/sdk/reactnative/ui-components/typing-indicator/)

0 commit comments

Comments
 (0)