stream-chat-react-native-core 5.1.1-beta.1 → 5.3.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/lib/commonjs/components/Attachment/Card.js +29 -18
  2. package/lib/commonjs/components/Attachment/Card.js.map +1 -1
  3. package/lib/commonjs/components/Attachment/Gallery.js +16 -20
  4. package/lib/commonjs/components/Attachment/Gallery.js.map +1 -1
  5. package/lib/commonjs/components/Attachment/GalleryImage.js +34 -6
  6. package/lib/commonjs/components/Attachment/GalleryImage.js.map +1 -1
  7. package/lib/commonjs/components/Attachment/Giphy.js +37 -29
  8. package/lib/commonjs/components/Attachment/Giphy.js.map +1 -1
  9. package/lib/commonjs/components/Avatar/Avatar.js +10 -8
  10. package/lib/commonjs/components/Avatar/Avatar.js.map +1 -1
  11. package/lib/commonjs/components/Avatar/GroupAvatar.js +3 -1
  12. package/lib/commonjs/components/Avatar/GroupAvatar.js.map +1 -1
  13. package/lib/commonjs/components/ChannelList/ChannelListMessenger.js +32 -15
  14. package/lib/commonjs/components/ChannelList/ChannelListMessenger.js.map +1 -1
  15. package/lib/commonjs/components/ChannelPreview/ChannelAvatar.js +30 -6
  16. package/lib/commonjs/components/ChannelPreview/ChannelAvatar.js.map +1 -1
  17. package/lib/commonjs/components/Chat/Chat.js +20 -5
  18. package/lib/commonjs/components/Chat/Chat.js.map +1 -1
  19. package/lib/commonjs/components/Chat/hooks/useCreateChatContext.js +2 -0
  20. package/lib/commonjs/components/Chat/hooks/useCreateChatContext.js.map +1 -1
  21. package/lib/commonjs/components/ImageBackground.js +64 -0
  22. package/lib/commonjs/components/ImageBackground.js.map +1 -0
  23. package/lib/commonjs/components/Message/Message.js +15 -16
  24. package/lib/commonjs/components/Message/Message.js.map +1 -1
  25. package/lib/commonjs/components/Message/MessageSimple/MessageAvatar.js +12 -4
  26. package/lib/commonjs/components/Message/MessageSimple/MessageAvatar.js.map +1 -1
  27. package/lib/commonjs/components/Message/MessageSimple/MessageRepliesAvatars.js +26 -5
  28. package/lib/commonjs/components/Message/MessageSimple/MessageRepliesAvatars.js.map +1 -1
  29. package/lib/commonjs/components/MessageList/MessageList.js +39 -26
  30. package/lib/commonjs/components/MessageList/MessageList.js.map +1 -1
  31. package/lib/commonjs/components/MessageOverlay/MessageOverlay.js +58 -47
  32. package/lib/commonjs/components/MessageOverlay/MessageOverlay.js.map +1 -1
  33. package/lib/commonjs/components/MessageOverlay/OverlayReactions.js +19 -19
  34. package/lib/commonjs/components/MessageOverlay/OverlayReactions.js.map +1 -1
  35. package/lib/commonjs/contexts/chatContext/ChatContext.js +2 -2
  36. package/lib/commonjs/contexts/chatContext/ChatContext.js.map +1 -1
  37. package/lib/commonjs/contexts/debugContext/DebugContext.js +63 -0
  38. package/lib/commonjs/contexts/debugContext/DebugContext.js.map +1 -0
  39. package/lib/commonjs/contexts/index.js +13 -0
  40. package/lib/commonjs/contexts/index.js.map +1 -1
  41. package/lib/commonjs/contexts/messageOverlayContext/MessageOverlayContext.js +2 -2
  42. package/lib/commonjs/contexts/messageOverlayContext/MessageOverlayContext.js.map +1 -1
  43. package/lib/commonjs/version.json +1 -1
  44. package/lib/module/components/Attachment/Card.js +29 -18
  45. package/lib/module/components/Attachment/Card.js.map +1 -1
  46. package/lib/module/components/Attachment/Gallery.js +16 -20
  47. package/lib/module/components/Attachment/Gallery.js.map +1 -1
  48. package/lib/module/components/Attachment/GalleryImage.js +34 -6
  49. package/lib/module/components/Attachment/GalleryImage.js.map +1 -1
  50. package/lib/module/components/Attachment/Giphy.js +37 -29
  51. package/lib/module/components/Attachment/Giphy.js.map +1 -1
  52. package/lib/module/components/Avatar/Avatar.js +10 -8
  53. package/lib/module/components/Avatar/Avatar.js.map +1 -1
  54. package/lib/module/components/Avatar/GroupAvatar.js +3 -1
  55. package/lib/module/components/Avatar/GroupAvatar.js.map +1 -1
  56. package/lib/module/components/ChannelList/ChannelListMessenger.js +32 -15
  57. package/lib/module/components/ChannelList/ChannelListMessenger.js.map +1 -1
  58. package/lib/module/components/ChannelPreview/ChannelAvatar.js +30 -6
  59. package/lib/module/components/ChannelPreview/ChannelAvatar.js.map +1 -1
  60. package/lib/module/components/Chat/Chat.js +20 -5
  61. package/lib/module/components/Chat/Chat.js.map +1 -1
  62. package/lib/module/components/Chat/hooks/useCreateChatContext.js +2 -0
  63. package/lib/module/components/Chat/hooks/useCreateChatContext.js.map +1 -1
  64. package/lib/module/components/ImageBackground.js +64 -0
  65. package/lib/module/components/ImageBackground.js.map +1 -0
  66. package/lib/module/components/Message/Message.js +15 -16
  67. package/lib/module/components/Message/Message.js.map +1 -1
  68. package/lib/module/components/Message/MessageSimple/MessageAvatar.js +12 -4
  69. package/lib/module/components/Message/MessageSimple/MessageAvatar.js.map +1 -1
  70. package/lib/module/components/Message/MessageSimple/MessageRepliesAvatars.js +26 -5
  71. package/lib/module/components/Message/MessageSimple/MessageRepliesAvatars.js.map +1 -1
  72. package/lib/module/components/MessageList/MessageList.js +39 -26
  73. package/lib/module/components/MessageList/MessageList.js.map +1 -1
  74. package/lib/module/components/MessageOverlay/MessageOverlay.js +58 -47
  75. package/lib/module/components/MessageOverlay/MessageOverlay.js.map +1 -1
  76. package/lib/module/components/MessageOverlay/OverlayReactions.js +19 -19
  77. package/lib/module/components/MessageOverlay/OverlayReactions.js.map +1 -1
  78. package/lib/module/contexts/chatContext/ChatContext.js +2 -2
  79. package/lib/module/contexts/chatContext/ChatContext.js.map +1 -1
  80. package/lib/module/contexts/debugContext/DebugContext.js +63 -0
  81. package/lib/module/contexts/debugContext/DebugContext.js.map +1 -0
  82. package/lib/module/contexts/index.js +13 -0
  83. package/lib/module/contexts/index.js.map +1 -1
  84. package/lib/module/contexts/messageOverlayContext/MessageOverlayContext.js +2 -2
  85. package/lib/module/contexts/messageOverlayContext/MessageOverlayContext.js.map +1 -1
  86. package/lib/module/version.json +1 -1
  87. package/lib/typescript/components/Attachment/Card.d.ts +3 -2
  88. package/lib/typescript/components/Attachment/GalleryImage.d.ts +8 -2
  89. package/lib/typescript/components/Attachment/Giphy.d.ts +2 -1
  90. package/lib/typescript/components/Avatar/Avatar.d.ts +2 -1
  91. package/lib/typescript/components/Avatar/GroupAvatar.d.ts +2 -1
  92. package/lib/typescript/components/ChannelPreview/ChannelAvatar.d.ts +2 -0
  93. package/lib/typescript/components/Chat/Chat.d.ts +1 -1
  94. package/lib/typescript/components/Chat/hooks/useCreateChatContext.d.ts +1 -1
  95. package/lib/typescript/components/ImageBackground.d.ts +33 -0
  96. package/lib/typescript/components/Message/Message.d.ts +2 -1
  97. package/lib/typescript/components/Message/MessageSimple/MessageAvatar.d.ts +2 -1
  98. package/lib/typescript/components/Message/MessageSimple/MessageRepliesAvatars.d.ts +2 -0
  99. package/lib/typescript/components/MessageOverlay/OverlayReactions.d.ts +1 -0
  100. package/lib/typescript/contexts/chatContext/ChatContext.d.ts +3 -1
  101. package/lib/typescript/contexts/debugContext/DebugContext.d.ts +27 -0
  102. package/lib/typescript/contexts/index.d.ts +1 -0
  103. package/lib/typescript/contexts/messageOverlayContext/MessageOverlayContext.d.ts +4 -0
  104. package/package.json +2 -2
  105. package/src/components/Attachment/Card.tsx +11 -2
  106. package/src/components/Attachment/Gallery.tsx +1 -7
  107. package/src/components/Attachment/GalleryImage.tsx +31 -9
  108. package/src/components/Attachment/Giphy.tsx +8 -2
  109. package/src/components/Avatar/Avatar.tsx +12 -2
  110. package/src/components/Avatar/GroupAvatar.tsx +4 -4
  111. package/src/components/ChannelList/ChannelListMessenger.tsx +17 -0
  112. package/src/components/ChannelList/hooks/listeners/__tests__/useChannelUpdated.test.tsx +2 -1
  113. package/src/components/ChannelPreview/ChannelAvatar.tsx +23 -4
  114. package/src/components/Chat/Chat.tsx +111 -95
  115. package/src/components/Chat/hooks/useCreateChatContext.ts +2 -0
  116. package/src/components/ImageBackground.tsx +77 -0
  117. package/src/components/Message/Message.tsx +8 -8
  118. package/src/components/Message/MessageSimple/MessageAvatar.tsx +6 -2
  119. package/src/components/Message/MessageSimple/MessageRepliesAvatars.tsx +15 -3
  120. package/src/components/MessageList/MessageList.tsx +15 -0
  121. package/src/components/MessageOverlay/MessageOverlay.tsx +210 -205
  122. package/src/components/MessageOverlay/OverlayReactions.tsx +1 -0
  123. package/src/contexts/chatContext/ChatContext.tsx +3 -1
  124. package/src/contexts/debugContext/DebugContext.tsx +77 -0
  125. package/src/contexts/index.ts +1 -0
  126. package/src/contexts/messageOverlayContext/MessageOverlayContext.tsx +8 -1
  127. package/src/version.json +1 -1
@@ -24,6 +24,7 @@ import { MessageActionList as DefaultMessageActionList } from './MessageActionLi
24
24
  import { OverlayReactionList as OverlayReactionListDefault } from './OverlayReactionList';
25
25
  import { OverlayReactionsAvatar as OverlayReactionsAvatarDefault } from './OverlayReactionsAvatar';
26
26
 
27
+ import { ChatProvider } from '../../contexts/chatContext/ChatContext';
27
28
  import { MessageProvider } from '../../contexts/messageContext/MessageContext';
28
29
  import {
29
30
  MessageOverlayContextValue,
@@ -118,6 +119,7 @@ const MessageOverlayWithContext = <
118
119
  groupStyles,
119
120
  handleReaction,
120
121
  images,
122
+ chatContext,
121
123
  message,
122
124
  messageActions,
123
125
  MessageActionList = DefaultMessageActionList,
@@ -301,219 +303,222 @@ const MessageOverlayWithContext = <
301
303
  const { Attachment, FileAttachmentGroup, Gallery, MessageAvatar, Reply } = messagesContext || {};
302
304
 
303
305
  return (
304
- <MessagesProvider value={messagesContext}>
305
- <MessageProvider value={messageContext}>
306
- <ThemeProvider mergedStyle={wrapMessageInTheme ? modifiedTheme : theme}>
307
- <Animated.View
308
- pointerEvents={'auto'}
309
- style={[StyleSheet.absoluteFillObject, containerStyle]}
310
- >
311
- <PanGestureHandler
312
- enabled={overlay === 'message'}
313
- maxPointers={1}
314
- minDist={10}
315
- onGestureEvent={onPan}
306
+ <ChatProvider value={chatContext}>
307
+ <MessagesProvider value={messagesContext}>
308
+ <MessageProvider value={messageContext}>
309
+ <ThemeProvider mergedStyle={wrapMessageInTheme ? modifiedTheme : theme}>
310
+ <Animated.View
311
+ pointerEvents={'auto'}
312
+ style={[StyleSheet.absoluteFillObject, containerStyle]}
316
313
  >
317
- <Animated.View style={[StyleSheet.absoluteFillObject]}>
318
- <SafeAreaView style={styles.flex}>
319
- <TapGestureHandler
320
- maxDist={32}
321
- onHandlerStateChange={({ nativeEvent: { state } }) => {
322
- if (state === State.END) {
323
- setOverlay('none');
324
- }
325
- }}
326
- >
327
- <Animated.View style={[styles.flex, panStyle]}>
328
- {message && (
329
- <View
330
- style={[
331
- styles.center,
332
- styles.overlayPadding,
333
- { padding: overlayPadding },
334
- alignment === 'left' ? styles.alignStart : styles.alignEnd,
335
- ]}
336
- >
337
- {handleReaction && ownCapabilities?.sendReaction ? (
338
- <OverlayReactionList
339
- messageLayout={messageLayout}
340
- ownReactionTypes={
341
- message?.own_reactions?.map((reaction) => reaction.type) || []
342
- }
343
- showScreen={showScreen}
344
- />
345
- ) : null}
346
- <Animated.View
347
- onLayout={({
348
- nativeEvent: {
349
- layout: { height: layoutHeight, width: layoutWidth, x, y },
350
- },
351
- }) => {
352
- messageLayout.value = {
353
- x: alignment === 'left' ? x + layoutWidth : x,
354
- y,
355
- };
356
- messageWidth.value = layoutWidth;
357
- messageHeight.value = layoutHeight;
358
- }}
359
- style={[styles.alignEnd, styles.row, showScreenStyle]}
314
+ <PanGestureHandler
315
+ enabled={overlay === 'message'}
316
+ maxPointers={1}
317
+ minDist={10}
318
+ onGestureEvent={onPan}
319
+ >
320
+ <Animated.View style={[StyleSheet.absoluteFillObject]}>
321
+ <SafeAreaView style={styles.flex}>
322
+ <TapGestureHandler
323
+ maxDist={32}
324
+ onHandlerStateChange={({ nativeEvent: { state } }) => {
325
+ if (state === State.END) {
326
+ setOverlay('none');
327
+ }
328
+ }}
329
+ >
330
+ <Animated.View style={[styles.flex, panStyle]}>
331
+ {message && (
332
+ <View
333
+ style={[
334
+ styles.center,
335
+ styles.overlayPadding,
336
+ { padding: overlayPadding },
337
+ alignment === 'left' ? styles.alignStart : styles.alignEnd,
338
+ ]}
360
339
  >
361
- {alignment === 'left' && MessageAvatar && (
362
- <MessageAvatar {...{ alignment, message, showAvatar: true }} />
363
- )}
364
- <View
365
- pointerEvents='none'
366
- style={[
367
- styles.containerInner,
368
- {
369
- backgroundColor:
370
- onlyEmojis && !message.quoted_message
371
- ? transparent
372
- : otherAttachments?.length
373
- ? otherAttachments[0].type === 'giphy'
374
- ? !message.quoted_message
375
- ? transparent
376
- : grey_gainsboro
377
- : blue_alice
378
- : alignment === 'left'
379
- ? white_smoke
380
- : grey_gainsboro,
381
- borderBottomLeftRadius:
382
- (groupStyle === 'left_bottom' ||
383
- groupStyle === 'left_single') &&
384
- (!hasThreadReplies || threadList)
385
- ? borderRadiusS
386
- : borderRadiusL,
387
- borderBottomRightRadius:
388
- (groupStyle === 'right_bottom' ||
389
- groupStyle === 'right_single') &&
390
- (!hasThreadReplies || threadList)
391
- ? borderRadiusS
392
- : borderRadiusL,
393
- borderColor: grey_whisper,
340
+ {handleReaction && ownCapabilities?.sendReaction ? (
341
+ <OverlayReactionList
342
+ messageLayout={messageLayout}
343
+ ownReactionTypes={
344
+ message?.own_reactions?.map((reaction) => reaction.type) || []
345
+ }
346
+ showScreen={showScreen}
347
+ />
348
+ ) : null}
349
+ <Animated.View
350
+ onLayout={({
351
+ nativeEvent: {
352
+ layout: { height: layoutHeight, width: layoutWidth, x, y },
394
353
  },
395
- (onlyEmojis && !message.quoted_message) || otherAttachments?.length
396
- ? { borderWidth: 0 }
397
- : {},
398
- containerInner,
399
- ]}
354
+ }) => {
355
+ messageLayout.value = {
356
+ x: alignment === 'left' ? x + layoutWidth : x,
357
+ y,
358
+ };
359
+ messageWidth.value = layoutWidth;
360
+ messageHeight.value = layoutHeight;
361
+ }}
362
+ style={[styles.alignEnd, styles.row, showScreenStyle]}
400
363
  >
401
- {messagesContext?.messageContentOrder?.map(
402
- (messageContentType, messageContentOrderIndex) => {
403
- switch (messageContentType) {
404
- case 'quoted_reply':
405
- return (
406
- message.quoted_message &&
407
- Reply && (
408
- <View
409
- key={`quoted_reply_${messageContentOrderIndex}`}
410
- style={[styles.replyContainer, replyContainer]}
411
- >
412
- <Reply
413
- quotedMessage={
414
- message.quoted_message as ReplyProps<StreamChatGenerics>['quotedMessage']
415
- }
416
- styles={{
417
- messageContainer: {
418
- maxWidth: vw(60),
419
- },
420
- }}
364
+ {alignment === 'left' && MessageAvatar && (
365
+ <MessageAvatar {...{ alignment, message, showAvatar: true }} />
366
+ )}
367
+ <View
368
+ pointerEvents='none'
369
+ style={[
370
+ styles.containerInner,
371
+ {
372
+ backgroundColor:
373
+ onlyEmojis && !message.quoted_message
374
+ ? transparent
375
+ : otherAttachments?.length
376
+ ? otherAttachments[0].type === 'giphy'
377
+ ? !message.quoted_message
378
+ ? transparent
379
+ : grey_gainsboro
380
+ : blue_alice
381
+ : alignment === 'left'
382
+ ? white_smoke
383
+ : grey_gainsboro,
384
+ borderBottomLeftRadius:
385
+ (groupStyle === 'left_bottom' ||
386
+ groupStyle === 'left_single') &&
387
+ (!hasThreadReplies || threadList)
388
+ ? borderRadiusS
389
+ : borderRadiusL,
390
+ borderBottomRightRadius:
391
+ (groupStyle === 'right_bottom' ||
392
+ groupStyle === 'right_single') &&
393
+ (!hasThreadReplies || threadList)
394
+ ? borderRadiusS
395
+ : borderRadiusL,
396
+ borderColor: grey_whisper,
397
+ },
398
+ (onlyEmojis && !message.quoted_message) ||
399
+ otherAttachments?.length
400
+ ? { borderWidth: 0 }
401
+ : {},
402
+ containerInner,
403
+ ]}
404
+ >
405
+ {messagesContext?.messageContentOrder?.map(
406
+ (messageContentType, messageContentOrderIndex) => {
407
+ switch (messageContentType) {
408
+ case 'quoted_reply':
409
+ return (
410
+ message.quoted_message &&
411
+ Reply && (
412
+ <View
413
+ key={`quoted_reply_${messageContentOrderIndex}`}
414
+ style={[styles.replyContainer, replyContainer]}
415
+ >
416
+ <Reply
417
+ quotedMessage={
418
+ message.quoted_message as ReplyProps<StreamChatGenerics>['quotedMessage']
419
+ }
420
+ styles={{
421
+ messageContainer: {
422
+ maxWidth: vw(60),
423
+ },
424
+ }}
425
+ />
426
+ </View>
427
+ )
428
+ );
429
+ case 'attachments':
430
+ return otherAttachments?.map(
431
+ (attachment, attachmentIndex) =>
432
+ Attachment && (
433
+ <Attachment
434
+ attachment={attachment}
435
+ key={`${message.id}-${attachmentIndex}`}
436
+ />
437
+ ),
438
+ );
439
+ case 'files':
440
+ return (
441
+ FileAttachmentGroup && (
442
+ <FileAttachmentGroup
443
+ files={files}
444
+ key={`file_attachment_group_${messageContentOrderIndex}`}
445
+ messageId={message.id}
421
446
  />
422
- </View>
423
- )
424
- );
425
- case 'attachments':
426
- return otherAttachments?.map(
427
- (attachment, attachmentIndex) =>
428
- Attachment && (
429
- <Attachment
430
- attachment={attachment}
431
- key={`${message.id}-${attachmentIndex}`}
447
+ )
448
+ );
449
+ case 'gallery':
450
+ return (
451
+ Gallery && (
452
+ <Gallery
453
+ alignment={alignment}
454
+ groupStyles={groupStyles}
455
+ hasThreadReplies={!!message?.reply_count}
456
+ images={images}
457
+ key={`gallery_${messageContentOrderIndex}`}
458
+ message={message}
459
+ threadList={threadList}
460
+ videos={videos}
432
461
  />
433
- ),
434
- );
435
- case 'files':
436
- return (
437
- FileAttachmentGroup && (
438
- <FileAttachmentGroup
439
- files={files}
440
- key={`file_attachment_group_${messageContentOrderIndex}`}
441
- messageId={message.id}
442
- />
443
- )
444
- );
445
- case 'gallery':
446
- return (
447
- Gallery && (
448
- <Gallery
449
- alignment={alignment}
450
- groupStyles={groupStyles}
451
- hasThreadReplies={!!message?.reply_count}
452
- images={images}
453
- key={`gallery_${messageContentOrderIndex}`}
462
+ )
463
+ );
464
+ case 'text':
465
+ default:
466
+ return otherAttachments?.length &&
467
+ otherAttachments[0].actions ? null : (
468
+ <MessageTextContainer<StreamChatGenerics>
469
+ key={`message_text_container_${messageContentOrderIndex}`}
454
470
  message={message}
455
- threadList={threadList}
456
- videos={videos}
471
+ messageOverlay
472
+ messageTextNumberOfLines={messageTextNumberOfLines}
473
+ onlyEmojis={onlyEmojis}
457
474
  />
458
- )
459
- );
460
- case 'text':
461
- default:
462
- return otherAttachments?.length &&
463
- otherAttachments[0].actions ? null : (
464
- <MessageTextContainer<StreamChatGenerics>
465
- key={`message_text_container_${messageContentOrderIndex}`}
466
- message={message}
467
- messageOverlay
468
- messageTextNumberOfLines={messageTextNumberOfLines}
469
- onlyEmojis={onlyEmojis}
470
- />
471
- );
472
- }
473
- },
474
- )}
475
- </View>
476
- </Animated.View>
477
- {messageActions && (
478
- <MessageActionList
479
- MessageActionListItem={MessageActionListItem}
480
- showScreen={showScreen}
481
- {...messageActionProps}
482
- message={message}
483
- />
484
- )}
485
- {!!messageReactionTitle &&
486
- message.latest_reactions &&
487
- message.latest_reactions.length > 0 ? (
488
- <OverlayReactions
489
- alignment={alignment}
490
- OverlayReactionsAvatar={OverlayReactionsAvatar}
491
- reactions={
492
- message.latest_reactions.map((reaction) => ({
493
- alignment:
494
- clientId && clientId === reaction.user?.id ? 'right' : 'left',
495
- id: reaction?.user?.id || '',
496
- image: reaction?.user?.image,
497
- name: reaction?.user?.name || reaction.user_id || '',
498
- type: reaction.type,
499
- })) as Reaction[]
500
- }
501
- showScreen={showScreen}
502
- supportedReactions={messagesContext?.supportedReactions}
503
- title={messageReactionTitle}
504
- />
505
- ) : null}
506
- </View>
507
- )}
508
- </Animated.View>
509
- </TapGestureHandler>
510
- </SafeAreaView>
511
- </Animated.View>
512
- </PanGestureHandler>
513
- </Animated.View>
514
- </ThemeProvider>
515
- </MessageProvider>
516
- </MessagesProvider>
475
+ );
476
+ }
477
+ },
478
+ )}
479
+ </View>
480
+ </Animated.View>
481
+ {messageActions && (
482
+ <MessageActionList
483
+ MessageActionListItem={MessageActionListItem}
484
+ showScreen={showScreen}
485
+ {...messageActionProps}
486
+ message={message}
487
+ />
488
+ )}
489
+ {!!messageReactionTitle &&
490
+ message.latest_reactions &&
491
+ message.latest_reactions.length > 0 ? (
492
+ <OverlayReactions
493
+ alignment={alignment}
494
+ OverlayReactionsAvatar={OverlayReactionsAvatar}
495
+ reactions={
496
+ message.latest_reactions.map((reaction) => ({
497
+ alignment:
498
+ clientId && clientId === reaction.user?.id ? 'right' : 'left',
499
+ id: reaction?.user?.id || '',
500
+ image: reaction?.user?.image,
501
+ name: reaction?.user?.name || reaction.user_id || '',
502
+ type: reaction.type,
503
+ })) as Reaction[]
504
+ }
505
+ showScreen={showScreen}
506
+ supportedReactions={messagesContext?.supportedReactions}
507
+ title={messageReactionTitle}
508
+ />
509
+ ) : null}
510
+ </View>
511
+ )}
512
+ </Animated.View>
513
+ </TapGestureHandler>
514
+ </SafeAreaView>
515
+ </Animated.View>
516
+ </PanGestureHandler>
517
+ </Animated.View>
518
+ </ThemeProvider>
519
+ </MessageProvider>
520
+ </MessagesProvider>
521
+ </ChatProvider>
517
522
  );
518
523
  };
519
524
 
@@ -96,6 +96,7 @@ const reactionData: ReactionData[] = [
96
96
 
97
97
  export type Reaction = {
98
98
  alignment: Alignment;
99
+ id: string;
99
100
  name: string;
100
101
  type: string;
101
102
  image?: string;
@@ -1,4 +1,5 @@
1
1
  import React, { PropsWithChildren, useContext } from 'react';
2
+ import type { ImageProps } from 'react-native';
2
3
 
3
4
  import type { AppSettingsAPIResponse, Channel, EventHandler, Mute, StreamChat } from 'stream-chat';
4
5
 
@@ -34,6 +35,7 @@ export type ChatContextValue<
34
35
  client: StreamChat<StreamChatGenerics>;
35
36
  connectionRecovering: boolean;
36
37
  enableOfflineSupport: boolean;
38
+ ImageComponent: React.ComponentType<ImageProps>;
37
39
  isOnline: boolean;
38
40
  mutedUsers: Mute<StreamChatGenerics>[];
39
41
  /**
@@ -71,7 +73,7 @@ export const ChatProvider = <
71
73
  children,
72
74
  value,
73
75
  }: PropsWithChildren<{
74
- value: ChatContextValue<StreamChatGenerics>;
76
+ value?: ChatContextValue<StreamChatGenerics>;
75
77
  }>) => (
76
78
  <ChatContext.Provider value={value as unknown as ChatContextValue}>
77
79
  {children}
@@ -0,0 +1,77 @@
1
+ import React, { PropsWithChildren, useContext, useRef } from 'react';
2
+
3
+ import type { Channel, ChannelState, StreamChat } from 'stream-chat';
4
+
5
+ import type { MessageType } from '../../components/MessageList/hooks/useMessageList';
6
+ import type { DefaultStreamChatGenerics } from '../../types/types';
7
+
8
+ import { DEFAULT_BASE_CONTEXT_VALUE } from '../utils/defaultBaseContextValue';
9
+
10
+ export type DebugDataType<
11
+ StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
12
+ > =
13
+ | StreamChat<StreamChatGenerics>['user']
14
+ | {
15
+ data: Channel<StreamChatGenerics>['data'];
16
+ members: ChannelState<StreamChatGenerics>['members'];
17
+ }[]
18
+ | MessageType<StreamChatGenerics>[];
19
+
20
+ export type DebugContextValue<
21
+ StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
22
+ > = {
23
+ eventType?: string;
24
+ sendEventParams?: {
25
+ action: string;
26
+ data: DebugDataType<StreamChatGenerics>;
27
+ };
28
+ setEventType?: (data: string) => void;
29
+ setSendEventParams?: (data: { action: string; data: DebugDataType<StreamChatGenerics> }) => void;
30
+ };
31
+
32
+ export const DebugContext = React.createContext(
33
+ DEFAULT_BASE_CONTEXT_VALUE as React.MutableRefObject<DebugContextValue>,
34
+ );
35
+
36
+ export const DebugContextProvider = <
37
+ StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
38
+ >({
39
+ children,
40
+ useFlipper,
41
+ }: PropsWithChildren<{
42
+ useFlipper: () => {
43
+ updateData: (ref: React.RefObject<DebugContextValue<StreamChatGenerics>>) => void;
44
+ };
45
+ }>) => {
46
+ const debugRef = useRef<DebugContextValue<StreamChatGenerics>>({
47
+ eventType: undefined,
48
+ sendEventParams: undefined,
49
+ });
50
+
51
+ const { updateData } = useFlipper();
52
+
53
+ const ref = useRef<DebugContextValue<StreamChatGenerics>>({
54
+ setEventType: (data: string) => {
55
+ debugRef.current.eventType = data;
56
+ updateData(debugRef);
57
+ },
58
+ setSendEventParams: (data: { action: string; data: DebugDataType<StreamChatGenerics> }) => {
59
+ debugRef.current.sendEventParams = data;
60
+ updateData(debugRef);
61
+ },
62
+ });
63
+
64
+ return (
65
+ <DebugContext.Provider value={ref as unknown as React.MutableRefObject<DebugContextValue>}>
66
+ {children}
67
+ </DebugContext.Provider>
68
+ );
69
+ };
70
+
71
+ export const useDebugContext = () => {
72
+ const contextValue = useContext(
73
+ DebugContext,
74
+ ) as unknown as React.MutableRefObject<DebugContextValue>;
75
+
76
+ return contextValue;
77
+ };
@@ -2,6 +2,7 @@ export * from './attachmentPickerContext/AttachmentPickerContext';
2
2
  export * from './channelContext/ChannelContext';
3
3
  export * from './channelsContext/ChannelsContext';
4
4
  export * from './chatContext/ChatContext';
5
+ export * from './debugContext/DebugContext';
5
6
  export * from './imageGalleryContext/ImageGalleryContext';
6
7
  export * from './keyboardContext/KeyboardContext';
7
8
  export * from './messageContext/MessageContext';
@@ -1,5 +1,7 @@
1
1
  import React, { PropsWithChildren, useContext } from 'react';
2
2
 
3
+ import type { ImageProps } from 'react-native';
4
+
3
5
  import type { Attachment, TranslationLanguages } from 'stream-chat';
4
6
 
5
7
  import { useResettableState } from './hooks/useResettableState';
@@ -15,6 +17,7 @@ import type { OverlayReactionsProps } from '../../components/MessageOverlay/Over
15
17
  import type { OverlayReactionsAvatarProps } from '../../components/MessageOverlay/OverlayReactionsAvatar';
16
18
  import type { DefaultStreamChatGenerics, UnknownType } from '../../types/types';
17
19
  import type { ReactionData } from '../../utils/utils';
20
+ import type { ChatContextValue } from '../chatContext/ChatContext';
18
21
  import type { Alignment, MessageContextValue } from '../messageContext/MessageContext';
19
22
  import type { MessagesContextValue } from '../messagesContext/MessagesContext';
20
23
  import type { OwnCapabilitiesContextValue } from '../ownCapabilitiesContext/OwnCapabilitiesContext';
@@ -27,10 +30,12 @@ export type MessageOverlayData<
27
30
  StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
28
31
  > = {
29
32
  alignment?: Alignment;
33
+ chatContext?: ChatContextValue<StreamChatGenerics>;
30
34
  clientId?: string;
31
35
  files?: Attachment<StreamChatGenerics>[];
32
36
  groupStyles?: GroupType[];
33
37
  handleReaction?: (reactionType: string) => Promise<void>;
38
+ ImageComponent?: React.ComponentType<ImageProps>;
34
39
  images?: Attachment<StreamChatGenerics>[];
35
40
  message?: MessageType<StreamChatGenerics>;
36
41
  messageActions?: MessageActionType[];
@@ -89,7 +94,9 @@ export const MessageOverlayProvider = <
89
94
  }>) => {
90
95
  const messageOverlayContext = useResettableState(value);
91
96
  return (
92
- <MessageOverlayContext.Provider value={messageOverlayContext as MessageOverlayContextValue}>
97
+ <MessageOverlayContext.Provider
98
+ value={messageOverlayContext as unknown as MessageOverlayContextValue}
99
+ >
93
100
  {children}
94
101
  </MessageOverlayContext.Provider>
95
102
  );
package/src/version.json CHANGED
@@ -1,3 +1,3 @@
1
1
  {
2
- "version": "5.1.1-beta.1"
2
+ "version": "5.3.0-beta.1"
3
3
  }