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
@@ -1,5 +1,5 @@
1
1
  import React, { PropsWithChildren, useEffect, useState } from 'react';
2
- import { Platform } from 'react-native';
2
+ import { Image, Platform } from 'react-native';
3
3
 
4
4
  import Dayjs from 'dayjs';
5
5
 
@@ -15,6 +15,7 @@ import { useSyncDatabase } from './hooks/useSyncDatabase';
15
15
 
16
16
  import { ChannelsStateProvider } from '../../contexts/channelsStateContext/ChannelsStateContext';
17
17
  import { ChatContextValue, ChatProvider } from '../../contexts/chatContext/ChatContext';
18
+ import { useDebugContext } from '../../contexts/debugContext/DebugContext';
18
19
  import { useOverlayContext } from '../../contexts/overlayContext/OverlayContext';
19
20
  import { DeepPartial, ThemeProvider } from '../../contexts/themeContext/ThemeContext';
20
21
  import type { Theme } from '../../contexts/themeContext/utils/theme';
@@ -36,100 +37,101 @@ init();
36
37
 
37
38
  export type ChatProps<
38
39
  StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
39
- > = Pick<ChatContextValue<StreamChatGenerics>, 'client'> & {
40
- /**
41
- * When false, ws connection won't be disconnection upon backgrounding the app.
42
- * To receive push notifications, its necessary that user doesn't have active
43
- * websocket connection. So by default, we disconnect websocket connection when
44
- * app goes to background, and reconnect when app comes to foreground.
45
- */
46
- closeConnectionOnBackground?: boolean;
47
- /**
48
- * Enables offline storage and loading for chat data.
49
- */
50
- enableOfflineSupport?: boolean;
51
- /**
52
- * Instance of Streami18n class should be provided to Chat component to enable internationalization.
53
- *
54
- * Stream provides following list of in-built translations:
55
- * 1. English (en)
56
- * 2. Dutch (nl)
57
- * 3. ...
58
- * 4. ...
59
- *
60
- * Simplest way to start using chat components in one of the in-built languages would be following:
61
- *
62
- * ```
63
- * const i18n = new Streami18n('nl');
64
- * <Chat client={chatClient} i18nInstance={i18n}>
65
- * ...
66
- * </Chat>
67
- * ```
68
- *
69
- * If you would like to override certain keys in in-built translation.
70
- * UI will be automatically updated in this case.
71
- *
72
- * ```
73
- * const i18n = new Streami18n('nl');
74
- *
75
- * i18n.registerTranslation('nl', {
76
- * 'Nothing yet...': 'Nog Niet ...',
77
- * '{{ firstUser }} and {{ secondUser }} are typing...': '{{ firstUser }} en {{ secondUser }} zijn aan het typen...',
78
- * });
79
- *
80
- * <Chat client={chatClient} i18nInstance={i18n}>
81
- * ...
82
- * </Chat>
83
- * ```
84
- *
85
- * You can use the same function to add whole new language.
86
- *
87
- * ```
88
- * const i18n = new Streami18n('it');
89
- *
90
- * i18n.registerTranslation('it', {
91
- * 'Nothing yet...': 'Non ancora ...',
92
- * '{{ firstUser }} and {{ secondUser }} are typing...': '{{ firstUser }} a {{ secondUser }} stanno scrivendo...',
93
- * });
94
- *
95
- * // Make sure to call setLanguage to reflect new language in UI.
96
- * i18n.setLanguage('it');
97
- * <Chat client={chatClient} i18nInstance={i18n}>
98
- * ...
99
- * </Chat>
100
- * ```
101
- */
102
- i18nInstance?: Streami18n;
103
- /**
104
- * You can pass the theme object to customize the styles of Chat components. You can check the default theme in [theme.ts](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/contexts/themeContext/utils/theme.ts)
105
- *
106
- * Please check section about [themes in cookbook](https://github.com/GetStream/stream-chat-react-native/wiki/Cookbook-v3.0#theme) for details.
107
- *
108
- * ```
109
- * import type { DeepPartial, Theme } from 'stream-chat-react-native';
110
- *
111
- * const theme: DeepPartial<Theme> = {
112
- * messageSimple: {
113
- * file: {
114
- * container: {
115
- * backgroundColor: 'red',
116
- * },
117
- * icon: {
118
- * height: 16,
119
- * width: 16,
120
- * },
121
- * },
122
- * },
123
- * };
124
- *
125
- * <Chat style={theme}>
126
- * </Chat>
127
- * ```
128
- *
129
- * @overrideType object
130
- */
131
- style?: DeepPartial<Theme>;
132
- };
40
+ > = Pick<ChatContextValue<StreamChatGenerics>, 'client'> &
41
+ Partial<Pick<ChatContextValue<StreamChatGenerics>, 'ImageComponent'>> & {
42
+ /**
43
+ * When false, ws connection won't be disconnection upon backgrounding the app.
44
+ * To receive push notifications, its necessary that user doesn't have active
45
+ * websocket connection. So by default, we disconnect websocket connection when
46
+ * app goes to background, and reconnect when app comes to foreground.
47
+ */
48
+ closeConnectionOnBackground?: boolean;
49
+ /**
50
+ * Enables offline storage and loading for chat data.
51
+ */
52
+ enableOfflineSupport?: boolean;
53
+ /**
54
+ * Instance of Streami18n class should be provided to Chat component to enable internationalization.
55
+ *
56
+ * Stream provides following list of in-built translations:
57
+ * 1. English (en)
58
+ * 2. Dutch (nl)
59
+ * 3. ...
60
+ * 4. ...
61
+ *
62
+ * Simplest way to start using chat components in one of the in-built languages would be following:
63
+ *
64
+ * ```
65
+ * const i18n = new Streami18n('nl');
66
+ * <Chat client={chatClient} i18nInstance={i18n}>
67
+ * ...
68
+ * </Chat>
69
+ * ```
70
+ *
71
+ * If you would like to override certain keys in in-built translation.
72
+ * UI will be automatically updated in this case.
73
+ *
74
+ * ```
75
+ * const i18n = new Streami18n('nl');
76
+ *
77
+ * i18n.registerTranslation('nl', {
78
+ * 'Nothing yet...': 'Nog Niet ...',
79
+ * '{{ firstUser }} and {{ secondUser }} are typing...': '{{ firstUser }} en {{ secondUser }} zijn aan het typen...',
80
+ * });
81
+ *
82
+ * <Chat client={chatClient} i18nInstance={i18n}>
83
+ * ...
84
+ * </Chat>
85
+ * ```
86
+ *
87
+ * You can use the same function to add whole new language.
88
+ *
89
+ * ```
90
+ * const i18n = new Streami18n('it');
91
+ *
92
+ * i18n.registerTranslation('it', {
93
+ * 'Nothing yet...': 'Non ancora ...',
94
+ * '{{ firstUser }} and {{ secondUser }} are typing...': '{{ firstUser }} a {{ secondUser }} stanno scrivendo...',
95
+ * });
96
+ *
97
+ * // Make sure to call setLanguage to reflect new language in UI.
98
+ * i18n.setLanguage('it');
99
+ * <Chat client={chatClient} i18nInstance={i18n}>
100
+ * ...
101
+ * </Chat>
102
+ * ```
103
+ */
104
+ i18nInstance?: Streami18n;
105
+ /**
106
+ * You can pass the theme object to customize the styles of Chat components. You can check the default theme in [theme.ts](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/contexts/themeContext/utils/theme.ts)
107
+ *
108
+ * Please check section about [themes in cookbook](https://github.com/GetStream/stream-chat-react-native/wiki/Cookbook-v3.0#theme) for details.
109
+ *
110
+ * ```
111
+ * import type { DeepPartial, Theme } from 'stream-chat-react-native';
112
+ *
113
+ * const theme: DeepPartial<Theme> = {
114
+ * messageSimple: {
115
+ * file: {
116
+ * container: {
117
+ * backgroundColor: 'red',
118
+ * },
119
+ * icon: {
120
+ * height: 16,
121
+ * width: 16,
122
+ * },
123
+ * },
124
+ * },
125
+ * };
126
+ *
127
+ * <Chat style={theme}>
128
+ * </Chat>
129
+ * ```
130
+ *
131
+ * @overrideType object
132
+ */
133
+ style?: DeepPartial<Theme>;
134
+ };
133
135
 
134
136
  const ChatWithContext = <
135
137
  StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
@@ -142,6 +144,7 @@ const ChatWithContext = <
142
144
  closeConnectionOnBackground = true,
143
145
  enableOfflineSupport = false,
144
146
  i18nInstance,
147
+ ImageComponent = Image,
145
148
  style,
146
149
  } = props;
147
150
 
@@ -170,6 +173,9 @@ const ChatWithContext = <
170
173
  */
171
174
  const mutedUsers = useMutedUsers<StreamChatGenerics>(client);
172
175
 
176
+ const debugRef = useDebugContext();
177
+ const isDebugModeEnabled = __DEV__ && debugRef && debugRef.current;
178
+
173
179
  useEffect(() => {
174
180
  if (client) {
175
181
  client.setUserAgent(`${SDK}-${Platform.OS}-${version}`);
@@ -177,6 +183,15 @@ const ChatWithContext = <
177
183
  client.recoverStateOnReconnect = false;
178
184
  client.persistUserOnConnectionFailure = enableOfflineSupport;
179
185
  }
186
+
187
+ if (isDebugModeEnabled) {
188
+ if (debugRef.current.setEventType) debugRef.current.setEventType('send');
189
+ if (debugRef.current.setSendEventParams)
190
+ debugRef.current.setSendEventParams({
191
+ action: 'Client',
192
+ data: client.user,
193
+ });
194
+ }
180
195
  }, [client]);
181
196
 
182
197
  const setActiveChannel = (newChannel?: Channel<StreamChatGenerics>) => setChannel(newChannel);
@@ -193,6 +208,7 @@ const ChatWithContext = <
193
208
  client,
194
209
  connectionRecovering,
195
210
  enableOfflineSupport,
211
+ ImageComponent,
196
212
  isOnline,
197
213
  mutedUsers,
198
214
  setActiveChannel,
@@ -11,6 +11,7 @@ export const useCreateChatContext = <
11
11
  client,
12
12
  connectionRecovering,
13
13
  enableOfflineSupport,
14
+ ImageComponent,
14
15
  isOnline,
15
16
  mutedUsers,
16
17
  setActiveChannel,
@@ -31,6 +32,7 @@ export const useCreateChatContext = <
31
32
  client,
32
33
  connectionRecovering,
33
34
  enableOfflineSupport,
35
+ ImageComponent,
34
36
  isOnline,
35
37
  mutedUsers,
36
38
  setActiveChannel,
@@ -0,0 +1,77 @@
1
+ import * as React from 'react';
2
+
3
+ import { Image, ImageBackgroundProps, ImageProps, StyleSheet, View } from 'react-native';
4
+
5
+ /**
6
+ * DISCLAIMER: This component has been pretty-much copied from react-native's source code
7
+ * https://github.com/facebook/react-native/blob/main/Libraries/Image/ImageBackground.js
8
+ * Few modifications have been done such as converting to functional component, removing ref related logic (since its not required).
9
+ * Also support for prop `ImageComponent` has been introduced to allow rendering custom
10
+ * component instead of `Image`.
11
+ *
12
+ *
13
+ * Very simple drop-in replacement for <Image> which supports nesting views.
14
+ *
15
+ * ```ReactNativeWebPlayer
16
+ * import React, { Component } from 'react';
17
+ * import { AppRegistry, View, ImageBackground, Text } from 'react-native';
18
+ *
19
+ * class DisplayAnImageBackground extends Component {
20
+ * render() {
21
+ * return (
22
+ * <ImageBackground
23
+ * style={{width: 50, height: 50}}
24
+ * source={{uri: 'https://reactnative.dev/img/opengraph.png'}}
25
+ * >
26
+ * <Text>React</Text>
27
+ * </ImageBackground>
28
+ * );
29
+ * }
30
+ * }
31
+ *
32
+ */
33
+
34
+ export const ImageBackground: React.ComponentType<
35
+ ImageBackgroundProps & {
36
+ ImageComponent?: React.ComponentType<ImageProps>;
37
+ }
38
+ > = (props) => {
39
+ const {
40
+ children,
41
+ ImageComponent = Image,
42
+ imageStyle,
43
+ importantForAccessibility,
44
+ style,
45
+ ...rest
46
+ } = props;
47
+
48
+ const flattenedStyle = StyleSheet.flatten(style);
49
+ return (
50
+ <View
51
+ accessibilityIgnoresInvertColors={true}
52
+ importantForAccessibility={importantForAccessibility}
53
+ style={style}
54
+ >
55
+ <ImageComponent
56
+ {...rest}
57
+ importantForAccessibility={importantForAccessibility}
58
+ style={[
59
+ StyleSheet.absoluteFill,
60
+ {
61
+ // Temporary Workaround:
62
+ // Current (imperfect yet) implementation of <Image> overwrites width and height styles
63
+ // (which is not quite correct), and these styles conflict with explicitly set styles
64
+ // of <ImageBackground> and with our internal layout model here.
65
+ // So, we have to proxy/reapply these styles explicitly for actual <Image> component.
66
+ // This workaround should be removed after implementing proper support of
67
+ // intrinsic content size of the <Image>.
68
+ height: flattenedStyle?.height,
69
+ width: flattenedStyle?.width,
70
+ },
71
+ imageStyle,
72
+ ]}
73
+ />
74
+ {children}
75
+ </View>
76
+ );
77
+ };
@@ -118,7 +118,6 @@ export type MessagePropsWithContext<
118
118
  ChannelContextValue<StreamChatGenerics>,
119
119
  'channel' | 'disabled' | 'enforceUniqueReaction' | 'members'
120
120
  > &
121
- Pick<ChatContextValue<StreamChatGenerics>, 'client' | 'mutedUsers'> &
122
121
  Pick<KeyboardContextValue, 'dismissKeyboard'> &
123
122
  Partial<Omit<MessageContextValue<StreamChatGenerics>, 'groupStyles' | 'message'>> &
124
123
  Pick<MessageContextValue<StreamChatGenerics>, 'groupStyles' | 'message'> &
@@ -157,6 +156,7 @@ export type MessagePropsWithContext<
157
156
  Pick<OverlayContextValue, 'setOverlay'> &
158
157
  Pick<ThreadContextValue<StreamChatGenerics>, 'openThread'> &
159
158
  Pick<TranslationContextValue, 't'> & {
159
+ chatContext: ChatContextValue<StreamChatGenerics>;
160
160
  messagesContext: MessagesContextValue<StreamChatGenerics>;
161
161
  /**
162
162
  * Whether or not users are able to long press messages.
@@ -218,7 +218,6 @@ const MessageWithContext = <
218
218
 
219
219
  const {
220
220
  channel,
221
- client,
222
221
  disabled,
223
222
  dismissKeyboard,
224
223
  dismissKeyboardOnMessageTouch,
@@ -238,6 +237,7 @@ const MessageWithContext = <
238
237
  handleReaction: handleReactionProp,
239
238
  handleRetry,
240
239
  handleThreadReply,
240
+ chatContext,
241
241
  lastReceivedId,
242
242
  members,
243
243
  message,
@@ -272,7 +272,7 @@ const MessageWithContext = <
272
272
  threadList = false,
273
273
  updateMessage,
274
274
  } = props;
275
-
275
+ const { client } = chatContext;
276
276
  const {
277
277
  theme: {
278
278
  colors: { bg_gradient_start, targetedMessageBackground },
@@ -547,6 +547,7 @@ const MessageWithContext = <
547
547
 
548
548
  setData({
549
549
  alignment,
550
+ chatContext,
550
551
  clientId: client.userID,
551
552
  files: attachments.files,
552
553
  groupStyles,
@@ -719,23 +720,23 @@ const areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = Default
719
720
  nextProps: MessagePropsWithContext<StreamChatGenerics>,
720
721
  ) => {
721
722
  const {
723
+ chatContext: { mutedUsers: prevMutedUsers },
722
724
  goToMessage: prevGoToMessage,
723
725
  isAttachmentEqual,
724
726
  isTargetedMessage: prevIsTargetedMessage,
725
727
  lastReceivedId: prevLastReceivedId,
726
728
  members: prevMembers,
727
729
  message: prevMessage,
728
- mutedUsers: prevMutedUsers,
729
730
  showUnreadUnderlay: prevShowUnreadUnderlay,
730
731
  t: prevT,
731
732
  } = prevProps;
732
733
  const {
734
+ chatContext: { mutedUsers: nextMutedUsers },
733
735
  goToMessage: nextGoToMessage,
734
736
  isTargetedMessage: nextIsTargetedMessage,
735
737
  lastReceivedId: nextLastReceivedId,
736
738
  members: nextMembers,
737
739
  message: nextMessage,
738
- mutedUsers: nextMutedUsers,
739
740
  showUnreadUnderlay: nextShowUnreadUnderlay,
740
741
  t: nextT,
741
742
  } = nextProps;
@@ -857,7 +858,7 @@ export const Message = <
857
858
  ) => {
858
859
  const { channel, disabled, enforceUniqueReaction, members } =
859
860
  useChannelContext<StreamChatGenerics>();
860
- const { client, mutedUsers } = useChatContext<StreamChatGenerics>();
861
+ const chatContext = useChatContext<StreamChatGenerics>();
861
862
  const { dismissKeyboard } = useKeyboardContext();
862
863
  const { setData } = useMessageOverlayContext<StreamChatGenerics>();
863
864
  const messagesContext = useMessagesContext<StreamChatGenerics>();
@@ -870,13 +871,12 @@ export const Message = <
870
871
  {...messagesContext}
871
872
  {...{
872
873
  channel,
873
- client,
874
+ chatContext,
874
875
  disabled,
875
876
  dismissKeyboard,
876
877
  enforceUniqueReaction,
877
878
  members,
878
879
  messagesContext,
879
- mutedUsers,
880
880
  openThread,
881
881
  setData,
882
882
  setOverlay,
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { View } from 'react-native';
3
3
 
4
+ import { ChatContextValue, useChatContext } from '../../../contexts/chatContext/ChatContext';
4
5
  import {
5
6
  MessageContextValue,
6
7
  useMessageContext,
@@ -16,6 +17,7 @@ export type MessageAvatarPropsWithContext<
16
17
  MessageContextValue<StreamChatGenerics>,
17
18
  'alignment' | 'lastGroupMessage' | 'message' | 'showAvatar'
18
19
  > &
20
+ Pick<ChatContextValue<StreamChatGenerics>, 'ImageComponent'> &
19
21
  Partial<Pick<AvatarProps, 'size'>>;
20
22
 
21
23
  const MessageAvatarWithContext = <
@@ -23,7 +25,7 @@ const MessageAvatarWithContext = <
23
25
  >(
24
26
  props: MessageAvatarPropsWithContext<StreamChatGenerics>,
25
27
  ) => {
26
- const { alignment, lastGroupMessage, message, showAvatar, size } = props;
28
+ const { alignment, ImageComponent, lastGroupMessage, message, showAvatar, size } = props;
27
29
  const {
28
30
  theme: {
29
31
  avatar: { BASE_AVATAR_SIZE },
@@ -43,6 +45,7 @@ const MessageAvatarWithContext = <
43
45
  {visible ? (
44
46
  <Avatar
45
47
  image={message.user?.image}
48
+ ImageComponent={ImageComponent}
46
49
  name={message.user?.name || message.user?.id}
47
50
  size={size || BASE_AVATAR_SIZE}
48
51
  />
@@ -88,11 +91,12 @@ export const MessageAvatar = <
88
91
  ) => {
89
92
  const { alignment, lastGroupMessage, message, showAvatar } =
90
93
  useMessageContext<StreamChatGenerics>();
91
-
94
+ const { ImageComponent } = useChatContext<StreamChatGenerics>();
92
95
  return (
93
96
  <MemoizedMessageAvatar
94
97
  {...{
95
98
  alignment,
99
+ ImageComponent,
96
100
  lastGroupMessage,
97
101
  message,
98
102
  showAvatar,
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { StyleSheet, View } from 'react-native';
3
3
 
4
+ import { ChatContextValue, useChatContext } from '../../../contexts/chatContext/ChatContext';
4
5
  import type { MessageContextValue } from '../../../contexts/messageContext/MessageContext';
5
6
  import { useTheme } from '../../../contexts/themeContext/ThemeContext';
6
7
 
@@ -23,12 +24,12 @@ export type MessageRepliesAvatarsProps<
23
24
  StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
24
25
  > = Pick<MessageContextValue<StreamChatGenerics>, 'alignment' | 'message'>;
25
26
 
26
- export const MessageRepliesAvatars = <
27
+ export const MessageRepliesAvatarsWithContext = <
27
28
  StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
28
29
  >(
29
- props: MessageRepliesAvatarsProps<StreamChatGenerics>,
30
+ props: MessageRepliesAvatarsProps<StreamChatGenerics> & Pick<ChatContextValue, 'ImageComponent'>,
30
31
  ) => {
31
- const { alignment, message } = props;
32
+ const { alignment, ImageComponent, message } = props;
32
33
 
33
34
  const {
34
35
  theme: {
@@ -77,6 +78,7 @@ export const MessageRepliesAvatars = <
77
78
  avatar,
78
79
  ]}
79
80
  image={user.image}
81
+ ImageComponent={ImageComponent}
80
82
  name={user.name}
81
83
  size={avatarSize ? avatarSize : i === 1 ? 18 : 16}
82
84
  />
@@ -85,3 +87,13 @@ export const MessageRepliesAvatars = <
85
87
  </View>
86
88
  );
87
89
  };
90
+
91
+ export const MessageRepliesAvatars = <
92
+ StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
93
+ >(
94
+ props: MessageRepliesAvatarsProps<StreamChatGenerics>,
95
+ ) => {
96
+ const { ImageComponent } = useChatContext();
97
+
98
+ return <MessageRepliesAvatarsWithContext {...props} ImageComponent={ImageComponent} />;
99
+ };
@@ -30,6 +30,7 @@ import {
30
30
  useChannelContext,
31
31
  } from '../../contexts/channelContext/ChannelContext';
32
32
  import { ChatContextValue, useChatContext } from '../../contexts/chatContext/ChatContext';
33
+ import { useDebugContext } from '../../contexts/debugContext/DebugContext';
33
34
  import {
34
35
  ImageGalleryContextValue,
35
36
  useImageGalleryContext,
@@ -936,6 +937,20 @@ const MessageListWithContext = <
936
937
  setFlatListRef(ref);
937
938
  }
938
939
  };
940
+
941
+ const debugRef = useDebugContext();
942
+
943
+ const isDebugModeEnabled = __DEV__ && debugRef && debugRef.current;
944
+
945
+ if (isDebugModeEnabled) {
946
+ if (debugRef.current.setEventType) debugRef.current.setEventType('send');
947
+ if (debugRef.current.setSendEventParams)
948
+ debugRef.current.setSendEventParams({
949
+ action: thread ? 'ThreadList' : 'Messages',
950
+ data: messageList,
951
+ });
952
+ }
953
+
939
954
  const renderListEmptyComponent = () => (
940
955
  <View style={[styles.flex, styles.invert]} testID='empty-state'>
941
956
  <EmptyStateIndicator listType='message' />