stream-chat-react-native-core 5.44.2 → 5.44.4

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 (42) hide show
  1. package/README.md +1 -1
  2. package/lib/commonjs/components/ChannelPreview/ChannelAvatar.js +8 -3
  3. package/lib/commonjs/components/ChannelPreview/ChannelAvatar.js.map +1 -1
  4. package/lib/commonjs/components/MessageList/hooks/useLastReadData.js +21 -0
  5. package/lib/commonjs/components/MessageList/hooks/useLastReadData.js.map +1 -0
  6. package/lib/commonjs/components/MessageList/hooks/useMessageList.js +6 -2
  7. package/lib/commonjs/components/MessageList/hooks/useMessageList.js.map +1 -1
  8. package/lib/commonjs/components/MessageList/utils/getReadStates.js +6 -7
  9. package/lib/commonjs/components/MessageList/utils/getReadStates.js.map +1 -1
  10. package/lib/commonjs/contexts/themeContext/utils/theme.js +3 -0
  11. package/lib/commonjs/contexts/themeContext/utils/theme.js.map +1 -1
  12. package/lib/commonjs/version.json +1 -1
  13. package/lib/module/components/ChannelPreview/ChannelAvatar.js +8 -3
  14. package/lib/module/components/ChannelPreview/ChannelAvatar.js.map +1 -1
  15. package/lib/module/components/MessageList/hooks/useLastReadData.js +21 -0
  16. package/lib/module/components/MessageList/hooks/useLastReadData.js.map +1 -0
  17. package/lib/module/components/MessageList/hooks/useMessageList.js +6 -2
  18. package/lib/module/components/MessageList/hooks/useMessageList.js.map +1 -1
  19. package/lib/module/components/MessageList/utils/getReadStates.js +6 -7
  20. package/lib/module/components/MessageList/utils/getReadStates.js.map +1 -1
  21. package/lib/module/contexts/themeContext/utils/theme.js +3 -0
  22. package/lib/module/contexts/themeContext/utils/theme.js.map +1 -1
  23. package/lib/module/version.json +1 -1
  24. package/lib/typescript/components/Channel/hooks/useCreateMessagesContext.d.ts +1 -1
  25. package/lib/typescript/components/ChannelPreview/ChannelAvatar.d.ts +12 -2
  26. package/lib/typescript/components/ChannelPreview/ChannelAvatar.d.ts.map +1 -1
  27. package/lib/typescript/components/MessageList/hooks/useLastReadData.d.ts +13 -0
  28. package/lib/typescript/components/MessageList/hooks/useLastReadData.d.ts.map +1 -0
  29. package/lib/typescript/components/MessageList/hooks/useMessageList.d.ts.map +1 -1
  30. package/lib/typescript/components/MessageList/utils/getReadStates.d.ts +2 -2
  31. package/lib/typescript/components/MessageList/utils/getReadStates.d.ts.map +1 -1
  32. package/lib/typescript/contexts/themeContext/utils/theme.d.ts +3 -0
  33. package/lib/typescript/contexts/themeContext/utils/theme.d.ts.map +1 -1
  34. package/lib/typescript/store/mappers/mapStorableToChannel.d.ts +1 -1
  35. package/package.json +1 -1
  36. package/src/components/ChannelPreview/ChannelAvatar.tsx +18 -4
  37. package/src/components/MessageInput/__tests__/MessageInput.test.js +116 -2
  38. package/src/components/MessageList/hooks/useLastReadData.ts +37 -0
  39. package/src/components/MessageList/hooks/useMessageList.ts +7 -2
  40. package/src/components/MessageList/utils/getReadStates.ts +8 -8
  41. package/src/contexts/themeContext/utils/theme.ts +6 -0
  42. package/src/version.json +1 -1
@@ -6,11 +6,11 @@ import type { DefaultStreamChatGenerics } from '../../../types/types';
6
6
  export const getReadStates = <
7
7
  StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
8
8
  >(
9
- clientUserId: string | undefined,
10
9
  messages:
11
10
  | PaginatedMessageListContextValue<StreamChatGenerics>['messages']
12
11
  | ThreadContextValue<StreamChatGenerics>['threadMessages'],
13
12
  read?: ChannelContextValue<StreamChatGenerics>['read'],
13
+ returnAllReadData?: boolean,
14
14
  ) => {
15
15
  const readData: Record<string, number> = {};
16
16
 
@@ -32,20 +32,20 @@ export const getReadStates = <
32
32
  if (msg.created_at && msg.created_at < readState.last_read) {
33
33
  userLastReadMsgId = msg.id;
34
34
 
35
- // if true, save other user's read data for all messages they've read
36
- if (!readData[userLastReadMsgId]) {
37
- readData[userLastReadMsgId] = 0;
38
- }
35
+ if (returnAllReadData) {
36
+ // if true, save other user's read data for all messages they've read
37
+ if (!readData[userLastReadMsgId]) {
38
+ readData[userLastReadMsgId] = 0;
39
+ }
39
40
 
40
- // Only increment read count if the message is not sent by the current user
41
- if (msg.user?.id !== clientUserId) {
41
+ // Only increment read count if the message is not sent by the current user
42
42
  readData[userLastReadMsgId] = readData[userLastReadMsgId] + 1;
43
43
  }
44
44
  }
45
45
  });
46
46
 
47
47
  // if true, only save read data for other user's last read message
48
- if (userLastReadMsgId) {
48
+ if (userLastReadMsgId && !returnAllReadData) {
49
49
  if (!readData[userLastReadMsgId]) {
50
50
  readData[userLastReadMsgId] = 0;
51
51
  }
@@ -152,6 +152,9 @@ export type Theme = {
152
152
  maskFillColor?: ColorValue;
153
153
  };
154
154
  channelPreview: {
155
+ avatar: {
156
+ size: number;
157
+ };
155
158
  checkAllIcon: IconProps;
156
159
  checkIcon: IconProps;
157
160
  container: ViewStyle;
@@ -875,6 +878,9 @@ export const defaultTheme: Theme = {
875
878
  height: 64,
876
879
  },
877
880
  channelPreview: {
881
+ avatar: {
882
+ size: 40,
883
+ },
878
884
  checkAllIcon: {
879
885
  height: DEFAULT_STATUS_ICON_SIZE,
880
886
  width: DEFAULT_STATUS_ICON_SIZE,
package/src/version.json CHANGED
@@ -1,3 +1,3 @@
1
1
  {
2
- "version": "5.44.2"
2
+ "version": "5.44.4"
3
3
  }