stream-chat-react-native-core 5.39.1 → 5.39.2-beta.2

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 (85) hide show
  1. package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerItem.js +7 -2
  2. package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerItem.js.map +1 -1
  3. package/lib/commonjs/components/ChannelList/ChannelList.js +2 -1
  4. package/lib/commonjs/components/ChannelList/ChannelList.js.map +1 -1
  5. package/lib/commonjs/components/ChannelList/hooks/listeners/useUserPresence.js +5 -1
  6. package/lib/commonjs/components/ChannelList/hooks/listeners/useUserPresence.js.map +1 -1
  7. package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewDisplayPresence.js +4 -1
  8. package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewDisplayPresence.js.map +1 -1
  9. package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js +49 -33
  10. package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js.map +1 -1
  11. package/lib/commonjs/i18n/en.json +1 -0
  12. package/lib/commonjs/i18n/es.json +1 -0
  13. package/lib/commonjs/i18n/fr.json +1 -0
  14. package/lib/commonjs/i18n/he.json +1 -0
  15. package/lib/commonjs/i18n/hi.json +1 -0
  16. package/lib/commonjs/i18n/it.json +1 -0
  17. package/lib/commonjs/i18n/ja.json +1 -0
  18. package/lib/commonjs/i18n/ko.json +1 -0
  19. package/lib/commonjs/i18n/nl.json +1 -0
  20. package/lib/commonjs/i18n/pt-br.json +1 -0
  21. package/lib/commonjs/i18n/ru.json +1 -0
  22. package/lib/commonjs/i18n/tr.json +1 -0
  23. package/lib/commonjs/version.json +1 -1
  24. package/lib/module/components/AttachmentPicker/components/AttachmentPickerItem.js +7 -2
  25. package/lib/module/components/AttachmentPicker/components/AttachmentPickerItem.js.map +1 -1
  26. package/lib/module/components/ChannelList/ChannelList.js +2 -1
  27. package/lib/module/components/ChannelList/ChannelList.js.map +1 -1
  28. package/lib/module/components/ChannelList/hooks/listeners/useUserPresence.js +5 -1
  29. package/lib/module/components/ChannelList/hooks/listeners/useUserPresence.js.map +1 -1
  30. package/lib/module/components/ChannelPreview/hooks/useChannelPreviewDisplayPresence.js +4 -1
  31. package/lib/module/components/ChannelPreview/hooks/useChannelPreviewDisplayPresence.js.map +1 -1
  32. package/lib/module/contexts/messageInputContext/MessageInputContext.js +49 -33
  33. package/lib/module/contexts/messageInputContext/MessageInputContext.js.map +1 -1
  34. package/lib/module/i18n/en.json +1 -0
  35. package/lib/module/i18n/es.json +1 -0
  36. package/lib/module/i18n/fr.json +1 -0
  37. package/lib/module/i18n/he.json +1 -0
  38. package/lib/module/i18n/hi.json +1 -0
  39. package/lib/module/i18n/it.json +1 -0
  40. package/lib/module/i18n/ja.json +1 -0
  41. package/lib/module/i18n/ko.json +1 -0
  42. package/lib/module/i18n/nl.json +1 -0
  43. package/lib/module/i18n/pt-br.json +1 -0
  44. package/lib/module/i18n/ru.json +1 -0
  45. package/lib/module/i18n/tr.json +1 -0
  46. package/lib/module/version.json +1 -1
  47. package/lib/typescript/components/AttachmentPicker/components/AttachmentPickerItem.d.ts.map +1 -1
  48. package/lib/typescript/components/ChannelList/ChannelList.d.ts.map +1 -1
  49. package/lib/typescript/components/ChannelList/hooks/listeners/useUserPresence.d.ts +2 -1
  50. package/lib/typescript/components/ChannelList/hooks/listeners/useUserPresence.d.ts.map +1 -1
  51. package/lib/typescript/components/ChannelPreview/hooks/useChannelPreviewDisplayPresence.d.ts.map +1 -1
  52. package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts.map +1 -1
  53. package/lib/typescript/i18n/en.json +1 -0
  54. package/lib/typescript/i18n/es.json +1 -0
  55. package/lib/typescript/i18n/fr.json +1 -0
  56. package/lib/typescript/i18n/he.json +1 -0
  57. package/lib/typescript/i18n/hi.json +1 -0
  58. package/lib/typescript/i18n/it.json +1 -0
  59. package/lib/typescript/i18n/ja.json +1 -0
  60. package/lib/typescript/i18n/ko.json +1 -0
  61. package/lib/typescript/i18n/nl.json +1 -0
  62. package/lib/typescript/i18n/pt-br.json +1 -0
  63. package/lib/typescript/i18n/ru.json +1 -0
  64. package/lib/typescript/i18n/tr.json +1 -0
  65. package/lib/typescript/utils/i18n/Streami18n.d.ts +1 -0
  66. package/lib/typescript/utils/i18n/Streami18n.d.ts.map +1 -1
  67. package/package.json +1 -1
  68. package/src/components/AttachmentPicker/components/AttachmentPickerItem.tsx +5 -2
  69. package/src/components/ChannelList/ChannelList.tsx +1 -0
  70. package/src/components/ChannelList/hooks/listeners/useUserPresence.ts +3 -0
  71. package/src/components/ChannelPreview/hooks/useChannelPreviewDisplayPresence.ts +3 -2
  72. package/src/contexts/messageInputContext/MessageInputContext.tsx +13 -1
  73. package/src/i18n/en.json +1 -0
  74. package/src/i18n/es.json +1 -0
  75. package/src/i18n/fr.json +1 -0
  76. package/src/i18n/he.json +1 -0
  77. package/src/i18n/hi.json +1 -0
  78. package/src/i18n/it.json +1 -0
  79. package/src/i18n/ja.json +1 -0
  80. package/src/i18n/ko.json +1 -0
  81. package/src/i18n/nl.json +1 -0
  82. package/src/i18n/pt-br.json +1 -0
  83. package/src/i18n/ru.json +1 -0
  84. package/src/i18n/tr.json +1 -0
  85. package/src/version.json +1 -1
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "stream-chat-react-native-core",
3
3
  "description": "The official React Native and Expo components for Stream Chat, a service for building chat applications",
4
- "version": "5.39.1",
4
+ "version": "5.39.2-beta.2",
5
5
  "author": {
6
6
  "company": "Stream.io Inc",
7
7
  "name": "Stream.io Inc"
@@ -5,6 +5,7 @@ import { Alert, ImageBackground, Platform, StyleSheet, Text, View } from 'react-
5
5
  import { TouchableOpacity } from '@gorhom/bottom-sheet';
6
6
  import { lookup } from 'mime-types';
7
7
 
8
+ import { useTranslationContext } from '../../../contexts';
8
9
  import { AttachmentPickerContextValue } from '../../../contexts/attachmentPickerContext/AttachmentPickerContext';
9
10
  import { useTheme } from '../../../contexts/themeContext/ThemeContext';
10
11
  import { useViewport } from '../../../hooks/useViewport';
@@ -39,6 +40,7 @@ const AttachmentVideo = (props: AttachmentVideoProps) => {
39
40
  setSelectedFiles,
40
41
  } = props;
41
42
  const { vw } = useViewport();
43
+ const { t } = useTranslationContext();
42
44
 
43
45
  const {
44
46
  theme: {
@@ -76,7 +78,7 @@ const AttachmentVideo = (props: AttachmentVideoProps) => {
76
78
 
77
79
  const updateSelectedFiles = async () => {
78
80
  if (numberOfUploads >= maxNumberOfFiles) {
79
- Alert.alert('Maximum number of files reached');
81
+ Alert.alert(t('Maximum number of files reached'));
80
82
  return;
81
83
  }
82
84
  const files = await patchVideoFile(selectedFiles);
@@ -143,6 +145,7 @@ const AttachmentImage = (props: AttachmentImageProps) => {
143
145
  },
144
146
  } = useTheme();
145
147
  const { vw } = useViewport();
148
+ const { t } = useTranslationContext();
146
149
 
147
150
  const size = vw(100) / (numberOfAttachmentPickerImageColumns || 3) - 2;
148
151
 
@@ -165,7 +168,7 @@ const AttachmentImage = (props: AttachmentImageProps) => {
165
168
 
166
169
  const updateSelectedImages = async () => {
167
170
  if (numberOfUploads >= maxNumberOfFiles) {
168
- Alert.alert('Maximum number of files reached');
171
+ Alert.alert(t('Maximum number of files reached'));
169
172
  return;
170
173
  }
171
174
  const images = await patchImageFile(selectedImages);
@@ -354,6 +354,7 @@ export const ChannelList = <
354
354
 
355
355
  useUserPresence({
356
356
  setChannels,
357
+ setForceUpdate,
357
358
  });
358
359
 
359
360
  const channelIdsStr = channels?.reduce((acc, channel) => `${acc}${channel.cid}`, '');
@@ -9,12 +9,14 @@ import type { DefaultStreamChatGenerics } from '../../../../types/types';
9
9
  type Parameters<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> =
10
10
  {
11
11
  setChannels: React.Dispatch<React.SetStateAction<Channel<StreamChatGenerics>[] | null>>;
12
+ setForceUpdate: React.Dispatch<React.SetStateAction<number>>;
12
13
  };
13
14
 
14
15
  export const useUserPresence = <
15
16
  StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
16
17
  >({
17
18
  setChannels,
19
+ setForceUpdate,
18
20
  }: Parameters<StreamChatGenerics>) => {
19
21
  const { client } = useChatContext<StreamChatGenerics>();
20
22
 
@@ -33,6 +35,7 @@ export const useUserPresence = <
33
35
 
34
36
  return [...newChannels];
35
37
  });
38
+ setForceUpdate((u) => u + 1);
36
39
  };
37
40
 
38
41
  const listeners = [
@@ -2,6 +2,7 @@ import { useEffect, useState } from 'react';
2
2
 
3
3
  import type { Channel, StreamChat } from 'stream-chat';
4
4
 
5
+ import { useChannelsContext } from '../../../contexts';
5
6
  import { useChatContext } from '../../../contexts/chatContext/ChatContext';
6
7
 
7
8
  import type { DefaultStreamChatGenerics } from '../../../types/types';
@@ -37,6 +38,7 @@ export const useChannelPreviewDisplayPresence = <
37
38
  channel: Channel<StreamChatGenerics>,
38
39
  ) => {
39
40
  const { client } = useChatContext<StreamChatGenerics>();
41
+ const { forceUpdate } = useChannelsContext<StreamChatGenerics>();
40
42
 
41
43
  const currentUserId = client.userID;
42
44
  const members = Object.values(channel.state.members).filter(
@@ -48,8 +50,7 @@ export const useChannelPreviewDisplayPresence = <
48
50
 
49
51
  useEffect(() => {
50
52
  setDisplayPresence(getChannelPreviewDisplayPresence(channel, client));
51
- // eslint-disable-next-line react-hooks/exhaustive-deps
52
- }, [channelMemberOnline]);
53
+ }, [channel, channelMemberOnline, client, forceUpdate]);
53
54
 
54
55
  return displayPresence;
55
56
  };
@@ -694,7 +694,19 @@ export const MessageInputProvider = <
694
694
  ],
695
695
  );
696
696
  }
697
+
698
+ // RN CLI
699
+ if (numberOfUploads >= value.maxNumberOfFiles) {
700
+ Alert.alert(t('Maximum number of files reached'));
701
+ return;
702
+ }
703
+
697
704
  if (result.assets && result.assets.length > 0) {
705
+ // Expo
706
+ if (result.assets.length > value.maxNumberOfFiles) {
707
+ Alert.alert(t('Maximum number of files reached'));
708
+ return;
709
+ }
698
710
  result.assets.forEach(async (asset) => {
699
711
  if (asset.type.includes('image')) {
700
712
  await uploadNewImage(asset);
@@ -746,7 +758,7 @@ export const MessageInputProvider = <
746
758
  }
747
759
 
748
760
  if (numberOfUploads >= value.maxNumberOfFiles) {
749
- Alert.alert('Maximum number of files reached');
761
+ Alert.alert(t('Maximum number of files reached'));
750
762
  return;
751
763
  }
752
764
 
package/src/i18n/en.json CHANGED
@@ -40,6 +40,7 @@
40
40
  "Loading messages...": "Loading messages...",
41
41
  "Loading threads...": "Loading threads...",
42
42
  "Loading...": "Loading...",
43
+ "Maximum number of files reached": "Maximum number of files reached",
43
44
  "Message Reactions": "Message Reactions",
44
45
  "Message deleted": "Message deleted",
45
46
  "Message flagged": "Message flagged",
package/src/i18n/es.json CHANGED
@@ -40,6 +40,7 @@
40
40
  "Loading messages...": "Cargando mensajes...",
41
41
  "Loading threads...": "Cargando hilos...",
42
42
  "Loading...": "Cargando...",
43
+ "Maximum number of files reached": "Número máximo de archivos alcanzado",
43
44
  "Message Reactions": "Reacciones al mensaje",
44
45
  "Message deleted": "Mensaje eliminado",
45
46
  "Message flagged": "Mensaje reportado",
package/src/i18n/fr.json CHANGED
@@ -40,6 +40,7 @@
40
40
  "Loading messages...": "Chargement des messages...",
41
41
  "Loading threads...": "Chargement des fils...",
42
42
  "Loading...": "Chargement...",
43
+ "Maximum number of files reached": "Nombre maximal de fichiers atteint",
43
44
  "Message Reactions": "Réactions aux messages",
44
45
  "Message deleted": "Message supprimé",
45
46
  "Message flagged": "Message signalé",
package/src/i18n/he.json CHANGED
@@ -40,6 +40,7 @@
40
40
  "Loading messages...": "ההודעות בטעינה..",
41
41
  "Loading threads...": "טוען שרשורים...",
42
42
  "Loading...": "טוען...",
43
+ "Maximum number of files reached": "הגעת למספר המרבי של קבצים",
43
44
  "Message Reactions": "תגובות להודעה",
44
45
  "Message deleted": "ההודעה נמחקה",
45
46
  "Message flagged": "ההודעה סומנה",
package/src/i18n/hi.json CHANGED
@@ -40,6 +40,7 @@
40
40
  "Loading messages...": "मेसेजस लोड हो रहे हैं...",
41
41
  "Loading threads...": "थ्रेड्स लोड हो रहे हैं...",
42
42
  "Loading...": "लोड हो रहा है...",
43
+ "Maximum number of files reached": "फ़ाइलों की अधिकतम संख्या पहुँच गई",
43
44
  "Message Reactions": "संदेश प्रतिक्रियाएँ",
44
45
  "Message deleted": "मैसेज हटा दिया गया",
45
46
  "Message flagged": "संदेश को ध्वजांकित किया गया",
package/src/i18n/it.json CHANGED
@@ -40,6 +40,7 @@
40
40
  "Loading messages...": "Caricamento messaggi...",
41
41
  "Loading threads...": "Caricamento dei thread...",
42
42
  "Loading...": "Caricamento...",
43
+ "Maximum number of files reached": "Numero massimo di file raggiunto",
43
44
  "Message Reactions": "Reazioni ai Messaggi",
44
45
  "Message deleted": "Messaggio cancellato",
45
46
  "Message flagged": "Messaggio contrassegnato",
package/src/i18n/ja.json CHANGED
@@ -40,6 +40,7 @@
40
40
  "Loading messages...": "メッセージを読み込み中。。。",
41
41
  "Loading threads...": "スレッドを読み込み中...",
42
42
  "Loading...": "読み込み中。。。",
43
+ "Maximum number of files reached": "ファイルの最大数に達しました",
43
44
  "Message Reactions": "メッセージのリアクション",
44
45
  "Message deleted": "メッセージが削除されました",
45
46
  "Message flagged": "メッセージにフラグが付けられました",
package/src/i18n/ko.json CHANGED
@@ -40,6 +40,7 @@
40
40
  "Loading messages...": "메시지를 로딩 중...",
41
41
  "Loading threads...": "스레드 로딩 중...",
42
42
  "Loading...": "로딩 중...",
43
+ "Maximum number of files reached": "최대 파일 수에 도달했습니다",
43
44
  "Message Reactions": "메시지의 리액션",
44
45
  "Message deleted": "메시지가 삭제되었습니다.",
45
46
  "Message flagged": "메시지에 플래그가 지정되었습니다",
package/src/i18n/nl.json CHANGED
@@ -40,6 +40,7 @@
40
40
  "Loading messages...": "Berichten aan het laden...",
41
41
  "Loading threads...": "Threads laden...",
42
42
  "Loading...": "Aan het laden...",
43
+ "Maximum number of files reached": "Maximaal aantal bestanden bereikt",
43
44
  "Message Reactions": "Bericht Reacties",
44
45
  "Message deleted": "Bericht verwijderd",
45
46
  "Message flagged": "Bericht gemarkeerd",
@@ -40,6 +40,7 @@
40
40
  "Loading messages...": "Carregando mensagens...",
41
41
  "Loading threads...": "Carregando tópicos...",
42
42
  "Loading...": "Carregando...",
43
+ "Maximum number of files reached": "Número máximo de arquivos atingido",
43
44
  "Message Reactions": "Reações à Mensagem",
44
45
  "Message deleted": "Mensagem excluída",
45
46
  "Message flagged": "Mensagem sinalizada",
package/src/i18n/ru.json CHANGED
@@ -40,6 +40,7 @@
40
40
  "Loading messages...": "Загружаю сообщения...",
41
41
  "Loading threads...": "Загрузка потоков...",
42
42
  "Loading...": "Загружаю...",
43
+ "Maximum number of files reached": "Достигнуто максимальное количество файлов",
43
44
  "Message Reactions": "Сообщения Реакции",
44
45
  "Message deleted": "Сообщение удалено",
45
46
  "Message flagged": "Сообщение отмечено",
package/src/i18n/tr.json CHANGED
@@ -40,6 +40,7 @@
40
40
  "Loading messages...": "Mesajlar yükleniyor...",
41
41
  "Loading threads...": "Akışlar yükleniyor...",
42
42
  "Loading...": "Yükleniyor...",
43
+ "Maximum number of files reached": "Maksimum dosya sayısına ulaşıldı",
43
44
  "Message Reactions": "Mesaj Tepkileri",
44
45
  "Message deleted": "Mesaj silindi",
45
46
  "Message flagged": "Mesaj işaretlendi",
package/src/version.json CHANGED
@@ -1,3 +1,3 @@
1
1
  {
2
- "version": "5.39.1"
2
+ "version": "5.39.2-beta.2"
3
3
  }