stream-chat-react-native-core 5.26.0-beta.2 → 5.26.0-beta.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 (59) hide show
  1. package/lib/commonjs/components/Channel/Channel.js +49 -35
  2. package/lib/commonjs/components/Channel/Channel.js.map +1 -1
  3. package/lib/commonjs/components/Channel/hooks/useTargetedMessage.js +5 -0
  4. package/lib/commonjs/components/Channel/hooks/useTargetedMessage.js.map +1 -1
  5. package/lib/commonjs/i18n/es.json +24 -24
  6. package/lib/commonjs/i18n/fr.json +24 -24
  7. package/lib/commonjs/i18n/he.json +24 -24
  8. package/lib/commonjs/i18n/hi.json +24 -24
  9. package/lib/commonjs/i18n/it.json +24 -24
  10. package/lib/commonjs/i18n/ja.json +24 -24
  11. package/lib/commonjs/i18n/ko.json +24 -24
  12. package/lib/commonjs/i18n/nl.json +24 -24
  13. package/lib/commonjs/i18n/pt-BR.json +24 -24
  14. package/lib/commonjs/i18n/ru.json +24 -24
  15. package/lib/commonjs/i18n/tr.json +24 -24
  16. package/lib/commonjs/version.json +1 -1
  17. package/lib/module/components/Channel/Channel.js +49 -35
  18. package/lib/module/components/Channel/Channel.js.map +1 -1
  19. package/lib/module/components/Channel/hooks/useTargetedMessage.js +5 -0
  20. package/lib/module/components/Channel/hooks/useTargetedMessage.js.map +1 -1
  21. package/lib/module/i18n/es.json +24 -24
  22. package/lib/module/i18n/fr.json +24 -24
  23. package/lib/module/i18n/he.json +24 -24
  24. package/lib/module/i18n/hi.json +24 -24
  25. package/lib/module/i18n/it.json +24 -24
  26. package/lib/module/i18n/ja.json +24 -24
  27. package/lib/module/i18n/ko.json +24 -24
  28. package/lib/module/i18n/nl.json +24 -24
  29. package/lib/module/i18n/pt-BR.json +24 -24
  30. package/lib/module/i18n/ru.json +24 -24
  31. package/lib/module/i18n/tr.json +24 -24
  32. package/lib/module/version.json +1 -1
  33. package/lib/typescript/components/Channel/hooks/useTargetedMessage.d.ts +1 -0
  34. package/lib/typescript/i18n/es.json +24 -24
  35. package/lib/typescript/i18n/fr.json +24 -24
  36. package/lib/typescript/i18n/he.json +24 -24
  37. package/lib/typescript/i18n/hi.json +24 -24
  38. package/lib/typescript/i18n/it.json +24 -24
  39. package/lib/typescript/i18n/ja.json +24 -24
  40. package/lib/typescript/i18n/ko.json +24 -24
  41. package/lib/typescript/i18n/nl.json +24 -24
  42. package/lib/typescript/i18n/pt-BR.json +24 -24
  43. package/lib/typescript/i18n/ru.json +24 -24
  44. package/lib/typescript/i18n/tr.json +24 -24
  45. package/package.json +1 -1
  46. package/src/components/Channel/Channel.tsx +38 -21
  47. package/src/components/Channel/hooks/useTargetedMessage.ts +6 -0
  48. package/src/i18n/es.json +24 -24
  49. package/src/i18n/fr.json +24 -24
  50. package/src/i18n/he.json +24 -24
  51. package/src/i18n/hi.json +24 -24
  52. package/src/i18n/it.json +24 -24
  53. package/src/i18n/ja.json +24 -24
  54. package/src/i18n/ko.json +24 -24
  55. package/src/i18n/nl.json +24 -24
  56. package/src/i18n/pt-BR.json +24 -24
  57. package/src/i18n/ru.json +24 -24
  58. package/src/i18n/tr.json +24 -24
  59. package/src/version.json +1 -1
@@ -1,9 +1,9 @@
1
1
  {
2
- "1 Reply": "",
2
+ "1 Reply": "1 Antwoord",
3
3
  "1 Thread Reply": "",
4
- "Allow access to your Gallery": "",
5
- "Allow camera access in device settings": "",
6
- "Also send to channel": "Stuur ook naar kanaal",
4
+ "Allow access to your Gallery": "Geef toegang tot uw galerij",
5
+ "Allow camera access in device settings": "Sta cameratoegang toe in de apparaatinstellingen",
6
+ "Also send to channel": "",
7
7
  "Are you sure you want to permanently delete this message?": "",
8
8
  "Are you sure?": "",
9
9
  "Block User": "",
@@ -13,22 +13,22 @@
13
13
  "Copy Message": "",
14
14
  "Delete": "",
15
15
  "Delete Message": "",
16
- "Device camera is used to take photos or videos.": "",
16
+ "Device camera is used to take photos or videos.": "De camera van het apparaat wordt gebruikt om foto's of video's te maken.",
17
17
  "Do you want to send a copy of this message to a moderator for further investigation?": "",
18
18
  "Edit Message": "",
19
- "Editing Message": "",
20
- "Emoji matching": "",
19
+ "Editing Message": "Bericht aanpassen",
20
+ "Emoji matching": "Emoji-overeenkomsten",
21
21
  "Empty message...": "",
22
22
  "Error loading": "",
23
23
  "Error loading channel list...": "",
24
24
  "Error loading messages for this channel...": "",
25
25
  "Error while loading, please reload/refresh": "",
26
- "File type not supported": "",
26
+ "File type not supported": "Bestandstype niet ondersteund",
27
27
  "Flag": "",
28
28
  "Flag Message": "",
29
29
  "Flag action failed either due to a network issue or the message is already flagged": "",
30
30
  "How about sending your first message to a friend?": "",
31
- "Instant Commands": "",
31
+ "Instant Commands": "Directe Opdrachten",
32
32
  "Let's start chatting!": "",
33
33
  "Links are disabled": "",
34
34
  "Loading channels...": "",
@@ -42,37 +42,37 @@
42
42
  "Not supported": "",
43
43
  "Nothing yet...": "",
44
44
  "Ok": "",
45
- "Only visible to you": "Alleen zichtbaar voor jou",
46
- "Open Settings": "",
47
- "Photo": "",
48
- "Photos and Videos": "",
45
+ "Only visible to you": "",
46
+ "Open Settings": "Open instellingen",
47
+ "Photo": "Foto",
48
+ "Photos and Videos": "Foto's en video's",
49
49
  "Pin to Conversation": "",
50
50
  "Pinned by": "",
51
- "Please enable access to your photos and videos so you can share them.": "",
51
+ "Please enable access to your photos and videos so you can share them.": "Schakel toegang tot uw foto's en video's in zodat u ze kunt delen.",
52
52
  "Please select a channel first": "",
53
53
  "Reconnecting...": "",
54
54
  "Reply": "",
55
- "Reply to Message": "",
55
+ "Reply to Message": "Beantwoord bericht",
56
56
  "Resend": "",
57
- "Search GIFs": "",
58
- "Select More Photos": "",
57
+ "Search GIFs": "Zoek GIF's",
58
+ "Select More Photos": "Selecteer Meer foto's",
59
59
  "Send Anyway": "",
60
- "Send a message": "",
60
+ "Send a message": "Stuur een bericht",
61
61
  "Sending links is not allowed in this conversation": "",
62
- "Slow mode ON": "",
62
+ "Slow mode ON": "Langzame modus aan",
63
63
  "The message has been reported to a moderator.": "",
64
64
  "Thread Reply": "",
65
65
  "Unblock User": "",
66
- "Unknown User": "",
66
+ "Unknown User": "Onbekende gebruiker",
67
67
  "Unmute User": "",
68
68
  "Unpin from Conversation": "",
69
69
  "Unread Messages": "",
70
- "Video": "",
70
+ "Video": "Video",
71
71
  "You": "",
72
- "You can't send messages in this channel": "Je kan geen berichten sturen in dit kanaal",
72
+ "You can't send messages in this channel": "",
73
73
  "{{ firstUser }} and {{ nonSelfUserLength }} more are typing": "",
74
- "{{ index }} of {{ photoLength }}": "",
75
- "{{ replyCount }} Replies": "",
74
+ "{{ index }} of {{ photoLength }}": "{{ index }} van {{ photoLength }}",
75
+ "{{ replyCount }} Replies": "{{ replyCount }} Antwoorden",
76
76
  "{{ replyCount }} Thread Replies": "",
77
77
  "{{ user }} is typing": "",
78
78
  "🏙 Attachment...": ""
@@ -1,9 +1,9 @@
1
1
  {
2
- "1 Reply": "",
2
+ "1 Reply": "1 Resposta",
3
3
  "1 Thread Reply": "",
4
- "Allow access to your Gallery": "",
5
- "Allow camera access in device settings": "",
6
- "Also send to channel": "Também enviar para o canal",
4
+ "Allow access to your Gallery": "Permitir acesso à sua Galeria",
5
+ "Allow camera access in device settings": "Permitir acesso à câmera nas configurações do dispositivo",
6
+ "Also send to channel": "",
7
7
  "Are you sure you want to permanently delete this message?": "",
8
8
  "Are you sure?": "",
9
9
  "Block User": "",
@@ -13,22 +13,22 @@
13
13
  "Copy Message": "",
14
14
  "Delete": "",
15
15
  "Delete Message": "",
16
- "Device camera is used to take photos or videos.": "",
16
+ "Device camera is used to take photos or videos.": "A câmera do dispositivo é usada para tirar fotos ou vídeos.",
17
17
  "Do you want to send a copy of this message to a moderator for further investigation?": "",
18
18
  "Edit Message": "",
19
- "Editing Message": "",
20
- "Emoji matching": "",
19
+ "Editing Message": "Editando Mensagem",
20
+ "Emoji matching": "Correspondência de Emoji",
21
21
  "Empty message...": "",
22
22
  "Error loading": "",
23
23
  "Error loading channel list...": "",
24
24
  "Error loading messages for this channel...": "",
25
25
  "Error while loading, please reload/refresh": "",
26
- "File type not supported": "",
26
+ "File type not supported": "Tipo de arquivo não suportado",
27
27
  "Flag": "",
28
28
  "Flag Message": "",
29
29
  "Flag action failed either due to a network issue or the message is already flagged": "",
30
30
  "How about sending your first message to a friend?": "",
31
- "Instant Commands": "",
31
+ "Instant Commands": "Comandos Instantâneos",
32
32
  "Let's start chatting!": "",
33
33
  "Links are disabled": "",
34
34
  "Loading channels...": "",
@@ -42,37 +42,37 @@
42
42
  "Not supported": "",
43
43
  "Nothing yet...": "",
44
44
  "Ok": "",
45
- "Only visible to you": "Apenas visível para você",
46
- "Open Settings": "",
47
- "Photo": "",
48
- "Photos and Videos": "",
45
+ "Only visible to you": "",
46
+ "Open Settings": "Abrir Configurações",
47
+ "Photo": "Foto",
48
+ "Photos and Videos": "Fotos e Vídeos",
49
49
  "Pin to Conversation": "",
50
50
  "Pinned by": "",
51
- "Please enable access to your photos and videos so you can share them.": "",
51
+ "Please enable access to your photos and videos so you can share them.": "Por favor, habilite o acesso às suas fotos e vídeos para poder compartilhá-los.",
52
52
  "Please select a channel first": "",
53
53
  "Reconnecting...": "",
54
54
  "Reply": "",
55
- "Reply to Message": "",
55
+ "Reply to Message": "Responder à Mensagem",
56
56
  "Resend": "",
57
- "Search GIFs": "",
58
- "Select More Photos": "",
57
+ "Search GIFs": "Pesquisar GIFs",
58
+ "Select More Photos": "Selecionar Mais Fotos",
59
59
  "Send Anyway": "",
60
- "Send a message": "",
60
+ "Send a message": "Enviar uma mensagem",
61
61
  "Sending links is not allowed in this conversation": "",
62
- "Slow mode ON": "",
62
+ "Slow mode ON": "Modo Lento ATIVADO",
63
63
  "The message has been reported to a moderator.": "",
64
64
  "Thread Reply": "",
65
65
  "Unblock User": "",
66
- "Unknown User": "",
66
+ "Unknown User": "Usuário Desconhecido",
67
67
  "Unmute User": "",
68
68
  "Unpin from Conversation": "",
69
69
  "Unread Messages": "",
70
- "Video": "",
70
+ "Video": "Vídeo",
71
71
  "You": "",
72
- "You can't send messages in this channel": "Você não pode enviar mensagens neste canal",
72
+ "You can't send messages in this channel": "",
73
73
  "{{ firstUser }} and {{ nonSelfUserLength }} more are typing": "",
74
- "{{ index }} of {{ photoLength }}": "",
75
- "{{ replyCount }} Replies": "",
74
+ "{{ index }} of {{ photoLength }}": "{{ index }} de {{ photoLength }}",
75
+ "{{ replyCount }} Replies": "{{ replyCount }} Respostas",
76
76
  "{{ replyCount }} Thread Replies": "",
77
77
  "{{ user }} is typing": "",
78
78
  "🏙 Attachment...": ""
@@ -1,9 +1,9 @@
1
1
  {
2
- "1 Reply": "",
2
+ "1 Reply": "1 Ответ",
3
3
  "1 Thread Reply": "",
4
- "Allow access to your Gallery": "",
5
- "Allow camera access in device settings": "",
6
- "Also send to channel": "Также отправить на канал",
4
+ "Allow access to your Gallery": "Разрешить доступ к вашей галерее",
5
+ "Allow camera access in device settings": "Разрешите доступ к камере в настройках устройства.",
6
+ "Also send to channel": "",
7
7
  "Are you sure you want to permanently delete this message?": "",
8
8
  "Are you sure?": "",
9
9
  "Block User": "",
@@ -13,22 +13,22 @@
13
13
  "Copy Message": "",
14
14
  "Delete": "",
15
15
  "Delete Message": "",
16
- "Device camera is used to take photos or videos.": "",
16
+ "Device camera is used to take photos or videos.": "Камера устройства используется для съемки фотографий или видео.",
17
17
  "Do you want to send a copy of this message to a moderator for further investigation?": "",
18
18
  "Edit Message": "",
19
- "Editing Message": "",
20
- "Emoji matching": "",
19
+ "Editing Message": "Редактирование сообщения",
20
+ "Emoji matching": "Соответствие эмодзи",
21
21
  "Empty message...": "",
22
22
  "Error loading": "",
23
23
  "Error loading channel list...": "",
24
24
  "Error loading messages for this channel...": "",
25
25
  "Error while loading, please reload/refresh": "",
26
- "File type not supported": "",
26
+ "File type not supported": "Тип файла не поддерживается",
27
27
  "Flag": "",
28
28
  "Flag Message": "",
29
29
  "Flag action failed either due to a network issue or the message is already flagged": "",
30
30
  "How about sending your first message to a friend?": "",
31
- "Instant Commands": "",
31
+ "Instant Commands": "Мгновенные Команды",
32
32
  "Let's start chatting!": "",
33
33
  "Links are disabled": "",
34
34
  "Loading channels...": "",
@@ -42,37 +42,37 @@
42
42
  "Not supported": "",
43
43
  "Nothing yet...": "",
44
44
  "Ok": "",
45
- "Only visible to you": "Видно только вам",
46
- "Open Settings": "",
47
- "Photo": "",
48
- "Photos and Videos": "",
45
+ "Only visible to you": "",
46
+ "Open Settings": "Открыть настройки",
47
+ "Photo": "Фото",
48
+ "Photos and Videos": "Фото и видео",
49
49
  "Pin to Conversation": "",
50
50
  "Pinned by": "",
51
- "Please enable access to your photos and videos so you can share them.": "",
51
+ "Please enable access to your photos and videos so you can share them.": "Разрешите доступ к своим фотографиям и видео, чтобы вы могли ими поделиться.",
52
52
  "Please select a channel first": "",
53
53
  "Reconnecting...": "",
54
54
  "Reply": "",
55
- "Reply to Message": "",
55
+ "Reply to Message": "Ответить на сообщение",
56
56
  "Resend": "",
57
- "Search GIFs": "",
58
- "Select More Photos": "",
57
+ "Search GIFs": "Поиск GIF",
58
+ "Select More Photos": "Выбрать больше фотографий",
59
59
  "Send Anyway": "",
60
- "Send a message": "",
60
+ "Send a message": "Отправить сообщение",
61
61
  "Sending links is not allowed in this conversation": "",
62
- "Slow mode ON": "",
62
+ "Slow mode ON": "Медленный режим включен",
63
63
  "The message has been reported to a moderator.": "",
64
64
  "Thread Reply": "",
65
65
  "Unblock User": "",
66
- "Unknown User": "",
66
+ "Unknown User": "Неизвестный пользователь",
67
67
  "Unmute User": "",
68
68
  "Unpin from Conversation": "",
69
69
  "Unread Messages": "",
70
- "Video": "",
70
+ "Video": "видео",
71
71
  "You": "",
72
- "You can't send messages in this channel": "Вы не можете отправлять сообщения в этот канал",
72
+ "You can't send messages in this channel": "",
73
73
  "{{ firstUser }} and {{ nonSelfUserLength }} more are typing": "",
74
- "{{ index }} of {{ photoLength }}": "",
75
- "{{ replyCount }} Replies": "",
74
+ "{{ index }} of {{ photoLength }}": "{{ index }} из {{ photoLength }}",
75
+ "{{ replyCount }} Replies": "{{ replyCount }} Ответов",
76
76
  "{{ replyCount }} Thread Replies": "",
77
77
  "{{ user }} is typing": "",
78
78
  "🏙 Attachment...": ""
@@ -1,9 +1,9 @@
1
1
  {
2
- "1 Reply": "",
2
+ "1 Reply": "1 Cevap",
3
3
  "1 Thread Reply": "",
4
- "Allow access to your Gallery": "",
5
- "Allow camera access in device settings": "",
6
- "Also send to channel": "Kanala da gönder",
4
+ "Allow access to your Gallery": "Galerinize erişime izin verin",
5
+ "Allow camera access in device settings": "Cihaz ayarlarında kamera erişimine izin ver",
6
+ "Also send to channel": "",
7
7
  "Are you sure you want to permanently delete this message?": "",
8
8
  "Are you sure?": "",
9
9
  "Block User": "",
@@ -13,22 +13,22 @@
13
13
  "Copy Message": "",
14
14
  "Delete": "",
15
15
  "Delete Message": "",
16
- "Device camera is used to take photos or videos.": "",
16
+ "Device camera is used to take photos or videos.": "Cihaz kamerası fotoğraf veya video çekmek için kullanılır.",
17
17
  "Do you want to send a copy of this message to a moderator for further investigation?": "",
18
18
  "Edit Message": "",
19
- "Editing Message": "",
20
- "Emoji matching": "",
19
+ "Editing Message": "Mesaj Düzenleniyor",
20
+ "Emoji matching": "Emoji eşleştirme",
21
21
  "Empty message...": "",
22
22
  "Error loading": "",
23
23
  "Error loading channel list...": "",
24
24
  "Error loading messages for this channel...": "",
25
25
  "Error while loading, please reload/refresh": "",
26
- "File type not supported": "",
26
+ "File type not supported": "Dosya türü desteklenmiyor",
27
27
  "Flag": "",
28
28
  "Flag Message": "",
29
29
  "Flag action failed either due to a network issue or the message is already flagged": "",
30
30
  "How about sending your first message to a friend?": "",
31
- "Instant Commands": "",
31
+ "Instant Commands": "Anlık Komutlar",
32
32
  "Let's start chatting!": "",
33
33
  "Links are disabled": "",
34
34
  "Loading channels...": "",
@@ -42,37 +42,37 @@
42
42
  "Not supported": "",
43
43
  "Nothing yet...": "",
44
44
  "Ok": "",
45
- "Only visible to you": "Sadece siz görebilirsiniz",
46
- "Open Settings": "",
47
- "Photo": "",
48
- "Photos and Videos": "",
45
+ "Only visible to you": "",
46
+ "Open Settings": "Ayarları aç",
47
+ "Photo": "Fotoğraf",
48
+ "Photos and Videos": "Fotoğraflar ve Videolar",
49
49
  "Pin to Conversation": "",
50
50
  "Pinned by": "",
51
- "Please enable access to your photos and videos so you can share them.": "",
51
+ "Please enable access to your photos and videos so you can share them.": "Paylaşım yapabilmek için lutfen fotoğraflarınıza ve videolarınıza erişimi etkinleştirin.",
52
52
  "Please select a channel first": "",
53
53
  "Reconnecting...": "",
54
54
  "Reply": "",
55
- "Reply to Message": "",
55
+ "Reply to Message": "Mesajı Yanıtla",
56
56
  "Resend": "",
57
- "Search GIFs": "",
58
- "Select More Photos": "",
57
+ "Search GIFs": "GIF Ara",
58
+ "Select More Photos": "Daha Fazla Fotoğraf Seçin",
59
59
  "Send Anyway": "",
60
- "Send a message": "",
60
+ "Send a message": "Mesaj gönder",
61
61
  "Sending links is not allowed in this conversation": "",
62
- "Slow mode ON": "",
62
+ "Slow mode ON": "Yavaş Mod Açık",
63
63
  "The message has been reported to a moderator.": "",
64
64
  "Thread Reply": "",
65
65
  "Unblock User": "",
66
- "Unknown User": "",
66
+ "Unknown User": "Bilinmeyen kullanıcı",
67
67
  "Unmute User": "",
68
68
  "Unpin from Conversation": "",
69
69
  "Unread Messages": "",
70
- "Video": "",
70
+ "Video": "Video",
71
71
  "You": "",
72
- "You can't send messages in this channel": "Bu konuşmaya mesaj gönderemezsiniz",
72
+ "You can't send messages in this channel": "",
73
73
  "{{ firstUser }} and {{ nonSelfUserLength }} more are typing": "",
74
- "{{ index }} of {{ photoLength }}": "",
75
- "{{ replyCount }} Replies": "",
74
+ "{{ index }} of {{ photoLength }}": "{{ index }} / {{ photoLength }}",
75
+ "{{ replyCount }} Replies": "{{ replyCount }} Cevap",
76
76
  "{{ replyCount }} Thread Replies": "",
77
77
  "{{ user }} is typing": "",
78
78
  "🏙 Attachment...": ""
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.26.0-beta.2",
4
+ "version": "5.26.0-beta.4",
5
5
  "author": {
6
6
  "company": "Stream.io Inc",
7
7
  "name": "Stream.io Inc"
@@ -600,7 +600,7 @@ const ChannelWithContext = <
600
600
  */
601
601
  const [hasNoMoreRecentMessagesToLoad, setHasNoMoreRecentMessagesToLoad] = useState(true);
602
602
 
603
- const { setTargetedMessage, targetedMessage } = useTargetedMessage();
603
+ const { prevTargetedMessage, setTargetedMessage, targetedMessage } = useTargetedMessage();
604
604
 
605
605
  /**
606
606
  * If we loaded a channel around message
@@ -718,7 +718,7 @@ const ChannelWithContext = <
718
718
  () => {
719
719
  if (channel) {
720
720
  clearInterval(mergeSetsIntervalRef.current);
721
- setMessages([...channel.state.messages]);
721
+ setMessages(channel.state.messages);
722
722
  restartSetsMergeFuncRef.current();
723
723
  }
724
724
  },
@@ -786,6 +786,8 @@ const ChannelWithContext = <
786
786
  // subscribe to the generic all channel event
787
787
  useEffect(() => {
788
788
  const handleEvent: EventHandler<StreamChatGenerics> = (event) => {
789
+ const ignorableEvents = ['user.watching.start', 'user.watching.stop'];
790
+ if (ignorableEvents.includes(event.type)) return;
789
791
  if (shouldSyncChannel) {
790
792
  const isTypingEvent = event.type === 'typing.start' || event.type === 'typing.stop';
791
793
  if (!isTypingEvent) {
@@ -804,6 +806,7 @@ const ChannelWithContext = <
804
806
  // only update channel state if the events are not the previously subscribed useEffect's subscription events
805
807
  if (
806
808
  channel &&
809
+ channel.initialized &&
807
810
  event.type !== 'message.new' &&
808
811
  event.type !== 'message.read' &&
809
812
  event.type !== 'typing.start' &&
@@ -860,8 +863,8 @@ const ChannelWithContext = <
860
863
  const scrollToMessageIndex = scrollToMessageId
861
864
  ? currentMessages.findIndex(({ id }) => id === scrollToMessageId)
862
865
  : -1;
863
-
864
866
  if (channel && scrollToMessageIndex !== -1) {
867
+ copyChannelState.cancel();
865
868
  // We assume that on average user sees 5 messages on screen
866
869
  // We dont want new renders to happen while scrolling to the targeted message
867
870
  // hence we limit the number of messages to be rendered after the targeted message to 5 - 1 = 4
@@ -869,21 +872,19 @@ const ChannelWithContext = <
869
872
  // the previous latest message set will be thrown away as we cannot merge it with the current message set after the target message is set
870
873
  const limitAfter = 4;
871
874
  const currentLength = currentMessages.length;
872
- if (scrollToMessageIndex !== -1) {
873
- const noOfMessagesAfter = currentLength - scrollToMessageIndex - 1;
874
- // number of messages are over the limit, limit the length of messages
875
- if (noOfMessagesAfter > limitAfter) {
876
- const endIndex = scrollToMessageIndex + limitAfter;
877
- channel.state.clearMessages();
878
- channel.state.messages = currentMessages.slice(0, endIndex + 1);
879
- splitLatestCurrentMessageSetRef.current();
880
- const restOfMessages = currentMessages.slice(endIndex + 1);
881
- if (hadCurrentLatestMessages) {
882
- const latestSet = channel.state.messageSets.find((set) => set.isLatest);
883
- if (latestSet) {
884
- latestSet.messages = restOfMessages;
885
- hasOverlappingRecentMessagesRef.current = true;
886
- }
875
+ const noOfMessagesAfter = currentLength - scrollToMessageIndex - 1;
876
+ // number of messages are over the limit, limit the length of messages
877
+ if (noOfMessagesAfter > limitAfter) {
878
+ const endIndex = scrollToMessageIndex + limitAfter;
879
+ channel.state.clearMessages();
880
+ channel.state.messages = currentMessages.slice(0, endIndex + 1);
881
+ splitLatestCurrentMessageSetRef.current();
882
+ const restOfMessages = currentMessages.slice(endIndex + 1);
883
+ if (hadCurrentLatestMessages) {
884
+ const latestSet = channel.state.messageSets.find((set) => set.isLatest);
885
+ if (latestSet) {
886
+ latestSet.messages = restOfMessages;
887
+ hasOverlappingRecentMessagesRef.current = true;
887
888
  }
888
889
  }
889
890
  }
@@ -892,7 +893,10 @@ const ChannelWithContext = <
892
893
  channel.state.setIsUpToDate(hasLatestMessages);
893
894
  setHasNoMoreRecentMessagesToLoad(hasLatestMessages);
894
895
  copyChannelState();
895
- restartSetsMergeFuncRef.current();
896
+ if (scrollToMessageIndex !== -1) {
897
+ // since we need to scroll after immediately do this without throttle
898
+ copyChannelState.flush();
899
+ }
896
900
  onAfterQueryCall?.();
897
901
  } catch (err) {
898
902
  if (err instanceof Error) {
@@ -953,7 +957,11 @@ const ChannelWithContext = <
953
957
  await loadLatestMessagesRef.current();
954
958
  }
955
959
  },
956
- undefined,
960
+ () => {
961
+ if (unreadMessageIdToScrollTo) {
962
+ restartSetsMergeFuncRef.current();
963
+ }
964
+ },
957
965
  () => unreadMessageIdToScrollTo,
958
966
  );
959
967
  };
@@ -994,12 +1002,21 @@ const ChannelWithContext = <
994
1002
  },
995
1003
  () => {
996
1004
  if (messageIdToLoadAround) {
1005
+ clearInterval(mergeSetsIntervalRef.current); // do not merge sets as we will scroll/highlight to the message
997
1006
  setTargetedMessage(messageIdToLoadAround);
998
1007
  }
999
1008
  },
1000
1009
  messageIdToLoadAround,
1001
1010
  );
1002
1011
 
1012
+ useEffect(() => {
1013
+ if (!targetedMessage && prevTargetedMessage) {
1014
+ // we cleared the merge sets interval to wait for the targeted message to be set
1015
+ // now restart it since its done
1016
+ restartSetsMergeFuncRef.current();
1017
+ }
1018
+ }, [targetedMessage]);
1019
+
1003
1020
  /**
1004
1021
  * @deprecated use loadChannelAroundMessage instead
1005
1022
  *
@@ -1088,7 +1105,7 @@ const ChannelWithContext = <
1088
1105
  const currentLength = channel.state.messages.length || 0;
1089
1106
  const didMerge = mergeOverlappingMessageSetsRef.current(true);
1090
1107
  if (didMerge && channel.state.messages.length !== currentLength) {
1091
- setMessages([...channel.state.messages]);
1108
+ setMessages(channel.state.messages);
1092
1109
  }
1093
1110
  }, 1000);
1094
1111
  });
@@ -3,6 +3,11 @@ import { useEffect, useRef, useState } from 'react';
3
3
  export const useTargetedMessage = (messageId?: string) => {
4
4
  const clearTargetedMessageCall = useRef<ReturnType<typeof setTimeout>>();
5
5
  const [targetedMessage, setTargetedMessage] = useState(messageId);
6
+ const prevTargetedMessageRef = useRef<string>();
7
+
8
+ useEffect(() => {
9
+ prevTargetedMessageRef.current = targetedMessage;
10
+ }, [targetedMessage]);
6
11
 
7
12
  useEffect(() => {
8
13
  clearTargetedMessageCall.current = setTimeout(() => {
@@ -25,6 +30,7 @@ export const useTargetedMessage = (messageId?: string) => {
25
30
  });
26
31
 
27
32
  return {
33
+ prevTargetedMessage: prevTargetedMessageRef.current,
28
34
  setTargetedMessage: setTargetedMessageTimeoutRef.current,
29
35
  targetedMessage,
30
36
  };
package/src/i18n/es.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
- "1 Reply": "",
2
+ "1 Reply": "1 respuesta",
3
3
  "1 Thread Reply": "",
4
- "Allow access to your Gallery": "",
5
- "Allow camera access in device settings": "",
6
- "Also send to channel": "También enviar al canal",
4
+ "Allow access to your Gallery": "Permitir acceso a tu galería",
5
+ "Allow camera access in device settings": "Permitir el acceso a la cámara en la configuración del dispositivo",
6
+ "Also send to channel": "",
7
7
  "Are you sure you want to permanently delete this message?": "",
8
8
  "Are you sure?": "",
9
9
  "Block User": "",
@@ -13,22 +13,22 @@
13
13
  "Copy Message": "",
14
14
  "Delete": "",
15
15
  "Delete Message": "",
16
- "Device camera is used to take photos or videos.": "",
16
+ "Device camera is used to take photos or videos.": "La cámara del dispositivo se utiliza para tomar fotografías o vídeos.",
17
17
  "Do you want to send a copy of this message to a moderator for further investigation?": "",
18
18
  "Edit Message": "",
19
- "Editing Message": "",
20
- "Emoji matching": "",
19
+ "Editing Message": "Editando mensaje",
20
+ "Emoji matching": "Coincidencia de emoji",
21
21
  "Empty message...": "",
22
22
  "Error loading": "",
23
23
  "Error loading channel list...": "",
24
24
  "Error loading messages for this channel...": "",
25
25
  "Error while loading, please reload/refresh": "",
26
- "File type not supported": "",
26
+ "File type not supported": "Tipo de archivo no admitido",
27
27
  "Flag": "",
28
28
  "Flag Message": "",
29
29
  "Flag action failed either due to a network issue or the message is already flagged": "",
30
30
  "How about sending your first message to a friend?": "",
31
- "Instant Commands": "",
31
+ "Instant Commands": "Comandos instantáneos",
32
32
  "Let's start chatting!": "",
33
33
  "Links are disabled": "",
34
34
  "Loading channels...": "",
@@ -42,37 +42,37 @@
42
42
  "Not supported": "",
43
43
  "Nothing yet...": "",
44
44
  "Ok": "",
45
- "Only visible to you": "Solo visible para ti",
46
- "Open Settings": "",
47
- "Photo": "",
48
- "Photos and Videos": "",
45
+ "Only visible to you": "",
46
+ "Open Settings": "Configuración abierta",
47
+ "Photo": "Foto",
48
+ "Photos and Videos": "Fotos y videos",
49
49
  "Pin to Conversation": "",
50
50
  "Pinned by": "",
51
- "Please enable access to your photos and videos so you can share them.": "",
51
+ "Please enable access to your photos and videos so you can share them.": "Por favor, habilita el acceso a tus fotos y videos para poder compartirlos.",
52
52
  "Please select a channel first": "",
53
53
  "Reconnecting...": "",
54
54
  "Reply": "",
55
- "Reply to Message": "",
55
+ "Reply to Message": "Responder al mensaje",
56
56
  "Resend": "",
57
- "Search GIFs": "",
58
- "Select More Photos": "",
57
+ "Search GIFs": "Buscar GIFs",
58
+ "Select More Photos": "Seleccionar más fotos",
59
59
  "Send Anyway": "",
60
- "Send a message": "",
60
+ "Send a message": "Enviar un mensaje",
61
61
  "Sending links is not allowed in this conversation": "",
62
- "Slow mode ON": "",
62
+ "Slow mode ON": "Modo lento ACTIVADO",
63
63
  "The message has been reported to a moderator.": "",
64
64
  "Thread Reply": "",
65
65
  "Unblock User": "",
66
- "Unknown User": "",
66
+ "Unknown User": "Usuario desconocido",
67
67
  "Unmute User": "",
68
68
  "Unpin from Conversation": "",
69
69
  "Unread Messages": "",
70
- "Video": "",
70
+ "Video": "Video",
71
71
  "You": "",
72
- "You can't send messages in this channel": "No puedes enviar mensajes en este canal",
72
+ "You can't send messages in this channel": "",
73
73
  "{{ firstUser }} and {{ nonSelfUserLength }} more are typing": "",
74
- "{{ index }} of {{ photoLength }}": "",
75
- "{{ replyCount }} Replies": "",
74
+ "{{ index }} of {{ photoLength }}": "{{ index }} de {{ photoLength }}",
75
+ "{{ replyCount }} Replies": "{{ replyCount }} Respuestas",
76
76
  "{{ replyCount }} Thread Replies": "",
77
77
  "{{ user }} is typing": "",
78
78
  "🏙 Attachment...": ""