@@ -170,87 +170,86 @@ const isUserResponseArray = (
170
170
output : string [ ] | UserResponse [ ] ,
171
171
) : output is UserResponse [ ] => ( output as UserResponse [ ] ) [ 0 ] ?. id != null ;
172
172
173
- export type ChannelProps =
174
- ChannelPropsForwardedToComponentContext & {
175
- // todo: move to MessageComposer configuration
176
- /** List of accepted file types */
177
- acceptedFiles ?: string [ ] ;
178
- /** Custom handler function that runs when the active channel has unread messages and the app is running on a separate browser tab */
179
- activeUnreadHandler ?: ( unread : number , documentTitle : string ) => void ;
180
- /** The connected and active channel */
181
- channel ?: StreamChannel ;
182
- /**
183
- * Optional configuration parameters used for the initial channel query.
184
- * Applied only if the value of channel.initialized is false.
185
- * If the channel instance has already been initialized (channel has been queried),
186
- * then the channel query will be skipped and channelQueryOptions will not be applied.
187
- */
188
- channelQueryOptions ?: ChannelQueryOptions ;
189
- /** Custom action handler to override the default `client.deleteMessage(message.id)` function */
190
- doDeleteMessageRequest ?: ( message : StreamMessage ) => Promise < MessageResponse > ;
191
- /** Custom action handler to override the default `channel.markRead` request function (advanced usage only) */
192
- doMarkReadRequest ?: (
193
- channel : StreamChannel ,
194
- setChannelUnreadUiState ?: ( state : ChannelUnreadUiState ) => void ,
195
- ) => Promise < EventAPIResponse > | void ;
196
- /** Custom action handler to override the default `channel.sendMessage` request function (advanced usage only) */
197
- doSendMessageRequest ?: (
198
- channel : StreamChannel ,
199
- message : Message ,
200
- options ?: SendMessageOptions ,
201
- ) => ReturnType < StreamChannel [ 'sendMessage' ] > | void ;
202
- /** Custom action handler to override the default `client.updateMessage` request function (advanced usage only) */
203
- doUpdateMessageRequest ?: (
204
- cid : string ,
205
- updatedMessage : UpdatedMessage ,
206
- options ?: UpdateMessageOptions ,
207
- ) => ReturnType < StreamChat [ 'updateMessage' ] > ;
208
- /** If true, chat users will be able to drag and drop file uploads to the entire channel window */
209
- dragAndDropWindow ?: boolean ;
210
- /** Custom UI component to be shown if no active channel is set, defaults to null and skips rendering the Channel component */
211
- EmptyPlaceholder ?: React . ReactElement ;
212
- /**
213
- * A global flag to toggle the URL enrichment and link previews in `MessageInput` components.
214
- * By default, the feature is disabled. Can be overridden on Thread, MessageList level through additionalMessageInputProps
215
- * or directly on MessageInput level through urlEnrichmentConfig.
216
- */
217
- enrichURLForPreview ?: URLEnrichmentConfig [ 'enrichURLForPreview' ] ;
218
- /** Global configuration for link preview generation in all the MessageInput components */
219
- enrichURLForPreviewConfig ?: Omit < URLEnrichmentConfig , 'enrichURLForPreview' > ;
220
- /** The giphy version to render - check the keys of the [Image Object](https://developers.giphy.com/docs/api/schema#image-object) for possible values. Uses 'fixed_height' by default */
221
- giphyVersion ?: GiphyVersions ;
222
- /** A custom function to provide size configuration for image attachments */
223
- imageAttachmentSizeHandler ?: ImageAttachmentSizeHandler ;
224
- /**
225
- * Allows to prevent triggering the channel.watch() call when mounting the component.
226
- * That means that no channel data from the back-end will be received neither channel WS events will be delivered to the client.
227
- * Preventing to initialize the channel on mount allows us to postpone the channel creation to a later point in time.
228
- */
229
- initializeOnMount ?: boolean ;
230
- /** Custom UI component to be shown if the channel query fails, defaults to and accepts same props as: [LoadingErrorIndicator](https://github.com/GetStream/stream-chat-react/blob/master/src/components/Loading/LoadingErrorIndicator.tsx) */
231
- LoadingErrorIndicator ?: React . ComponentType < LoadingErrorIndicatorProps > ;
232
- /** Configuration parameter to mark the active channel as read when mounted (opened). By default, the channel is marked read on mount. */
233
- markReadOnMount ?: boolean ;
234
- /** Maximum number of attachments allowed per message */
235
- maxNumberOfFiles ?: number ;
236
- /** Enables storing message drafts on the server. */
237
- messageDraftsEnabled ?: boolean ;
238
- // todo: document that multipleUploads is redundant and ignored with message composer
239
- /** Whether to allow multiple attachment uploads */
240
- multipleUploads ?: boolean ;
241
- /** Custom action handler function to run on click of an @mention in a message */
242
- onMentionsClick ?: OnMentionAction ;
243
- /** Custom action handler function to run on hover of an @mention in a message */
244
- onMentionsHover ?: OnMentionAction ;
245
- /** If `dragAndDropWindow` prop is true, the props to pass to the MessageInput component (overrides props placed directly on MessageInput) */
246
- optionalMessageInputProps ?: MessageInputProps ;
247
- /** You can turn on/off thumbnail generation for video attachments */
248
- shouldGenerateVideoThumbnail ?: boolean ;
249
- /** If true, skips the message data string comparison used to memoize the current channel messages (helpful for channels with 1000s of messages) */
250
- skipMessageDataMemoization ?: boolean ;
251
- /** A custom function to provide size configuration for video attachments */
252
- videoAttachmentSizeHandler ?: VideoAttachmentSizeHandler ;
253
- } ;
173
+ export type ChannelProps = ChannelPropsForwardedToComponentContext & {
174
+ // todo: move to MessageComposer configuration
175
+ /** List of accepted file types */
176
+ acceptedFiles ?: string [ ] ;
177
+ /** Custom handler function that runs when the active channel has unread messages and the app is running on a separate browser tab */
178
+ activeUnreadHandler ?: ( unread : number , documentTitle : string ) => void ;
179
+ /** The connected and active channel */
180
+ channel ?: StreamChannel ;
181
+ /**
182
+ * Optional configuration parameters used for the initial channel query.
183
+ * Applied only if the value of channel.initialized is false.
184
+ * If the channel instance has already been initialized (channel has been queried),
185
+ * then the channel query will be skipped and channelQueryOptions will not be applied.
186
+ */
187
+ channelQueryOptions ?: ChannelQueryOptions ;
188
+ /** Custom action handler to override the default `client.deleteMessage(message.id)` function */
189
+ doDeleteMessageRequest ?: ( message : StreamMessage ) => Promise < MessageResponse > ;
190
+ /** Custom action handler to override the default `channel.markRead` request function (advanced usage only) */
191
+ doMarkReadRequest ?: (
192
+ channel : StreamChannel ,
193
+ setChannelUnreadUiState ?: ( state : ChannelUnreadUiState ) => void ,
194
+ ) => Promise < EventAPIResponse > | void ;
195
+ /** Custom action handler to override the default `channel.sendMessage` request function (advanced usage only) */
196
+ doSendMessageRequest ?: (
197
+ channel : StreamChannel ,
198
+ message : Message ,
199
+ options ?: SendMessageOptions ,
200
+ ) => ReturnType < StreamChannel [ 'sendMessage' ] > | void ;
201
+ /** Custom action handler to override the default `client.updateMessage` request function (advanced usage only) */
202
+ doUpdateMessageRequest ?: (
203
+ cid : string ,
204
+ updatedMessage : UpdatedMessage ,
205
+ options ?: UpdateMessageOptions ,
206
+ ) => ReturnType < StreamChat [ 'updateMessage' ] > ;
207
+ /** If true, chat users will be able to drag and drop file uploads to the entire channel window */
208
+ dragAndDropWindow ?: boolean ;
209
+ /** Custom UI component to be shown if no active channel is set, defaults to null and skips rendering the Channel component */
210
+ EmptyPlaceholder ?: React . ReactElement ;
211
+ /**
212
+ * A global flag to toggle the URL enrichment and link previews in `MessageInput` components.
213
+ * By default, the feature is disabled. Can be overridden on Thread, MessageList level through additionalMessageInputProps
214
+ * or directly on MessageInput level through urlEnrichmentConfig.
215
+ */
216
+ enrichURLForPreview ?: URLEnrichmentConfig [ 'enrichURLForPreview' ] ;
217
+ /** Global configuration for link preview generation in all the MessageInput components */
218
+ enrichURLForPreviewConfig ?: Omit < URLEnrichmentConfig , 'enrichURLForPreview' > ;
219
+ /** The giphy version to render - check the keys of the [Image Object](https://developers.giphy.com/docs/api/schema#image-object) for possible values. Uses 'fixed_height' by default */
220
+ giphyVersion ?: GiphyVersions ;
221
+ /** A custom function to provide size configuration for image attachments */
222
+ imageAttachmentSizeHandler ?: ImageAttachmentSizeHandler ;
223
+ /**
224
+ * Allows to prevent triggering the channel.watch() call when mounting the component.
225
+ * That means that no channel data from the back-end will be received neither channel WS events will be delivered to the client.
226
+ * Preventing to initialize the channel on mount allows us to postpone the channel creation to a later point in time.
227
+ */
228
+ initializeOnMount ?: boolean ;
229
+ /** Custom UI component to be shown if the channel query fails, defaults to and accepts same props as: [LoadingErrorIndicator](https://github.com/GetStream/stream-chat-react/blob/master/src/components/Loading/LoadingErrorIndicator.tsx) */
230
+ LoadingErrorIndicator ?: React . ComponentType < LoadingErrorIndicatorProps > ;
231
+ /** Configuration parameter to mark the active channel as read when mounted (opened). By default, the channel is marked read on mount. */
232
+ markReadOnMount ?: boolean ;
233
+ /** Maximum number of attachments allowed per message */
234
+ maxNumberOfFiles ?: number ;
235
+ /** Enables storing message drafts on the server. */
236
+ messageDraftsEnabled ?: boolean ;
237
+ // todo: document that multipleUploads is redundant and ignored with message composer
238
+ /** Whether to allow multiple attachment uploads */
239
+ multipleUploads ?: boolean ;
240
+ /** Custom action handler function to run on click of an @mention in a message */
241
+ onMentionsClick ?: OnMentionAction ;
242
+ /** Custom action handler function to run on hover of an @mention in a message */
243
+ onMentionsHover ?: OnMentionAction ;
244
+ /** If `dragAndDropWindow` prop is true, the props to pass to the MessageInput component (overrides props placed directly on MessageInput) */
245
+ optionalMessageInputProps ?: MessageInputProps ;
246
+ /** You can turn on/off thumbnail generation for video attachments */
247
+ shouldGenerateVideoThumbnail ?: boolean ;
248
+ /** If true, skips the message data string comparison used to memoize the current channel messages (helpful for channels with 1000s of messages) */
249
+ skipMessageDataMemoization ?: boolean ;
250
+ /** A custom function to provide size configuration for video attachments */
251
+ videoAttachmentSizeHandler ?: VideoAttachmentSizeHandler ;
252
+ } ;
254
253
255
254
const ChannelContainer = ( {
256
255
children,
@@ -269,9 +268,7 @@ const ChannelContainer = ({
269
268
) ;
270
269
} ;
271
270
272
- const UnMemoizedChannel = (
273
- props : PropsWithChildren < ChannelProps > ,
274
- ) => {
271
+ const UnMemoizedChannel = ( props : PropsWithChildren < ChannelProps > ) => {
275
272
const {
276
273
channel : propsChannel ,
277
274
EmptyPlaceholder = null ,
0 commit comments