stream-chat-react-native-core 5.26.1-beta.3 → 5.27.0-beta.10

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 (122) hide show
  1. package/lib/commonjs/components/Attachment/Gallery.js +6 -7
  2. package/lib/commonjs/components/Attachment/Gallery.js.map +1 -1
  3. package/lib/commonjs/components/AttachmentPicker/AttachmentPicker.js +7 -11
  4. package/lib/commonjs/components/AttachmentPicker/AttachmentPicker.js.map +1 -1
  5. package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerIOSSelectMorePhotos.js +52 -0
  6. package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerIOSSelectMorePhotos.js.map +1 -0
  7. package/lib/commonjs/components/Chat/Chat.js +25 -16
  8. package/lib/commonjs/components/Chat/Chat.js.map +1 -1
  9. package/lib/commonjs/components/Chat/hooks/useAppSettings.js +18 -12
  10. package/lib/commonjs/components/Chat/hooks/useAppSettings.js.map +1 -1
  11. package/lib/commonjs/components/ImageGallery/ImageGallery.js +1 -1
  12. package/lib/commonjs/components/ImageGallery/ImageGallery.js.map +1 -1
  13. package/lib/commonjs/components/Indicators/LoadingIndicator.js +8 -2
  14. package/lib/commonjs/components/Indicators/LoadingIndicator.js.map +1 -1
  15. package/lib/commonjs/components/MessageInput/SendButton.js +1 -1
  16. package/lib/commonjs/components/MessageInput/SendButton.js.map +1 -1
  17. package/lib/commonjs/components/MessageInput/SendMessageDisallowedIndicator.js +3 -1
  18. package/lib/commonjs/components/MessageInput/SendMessageDisallowedIndicator.js.map +1 -1
  19. package/lib/commonjs/components/MessageList/MessageList.js +45 -40
  20. package/lib/commonjs/components/MessageList/MessageList.js.map +1 -1
  21. package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js +73 -56
  22. package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js.map +1 -1
  23. package/lib/commonjs/contexts/overlayContext/OverlayProvider.js +15 -11
  24. package/lib/commonjs/contexts/overlayContext/OverlayProvider.js.map +1 -1
  25. package/lib/commonjs/i18n/es.json +28 -28
  26. package/lib/commonjs/i18n/fr.json +28 -28
  27. package/lib/commonjs/i18n/he.json +28 -28
  28. package/lib/commonjs/i18n/hi.json +28 -28
  29. package/lib/commonjs/i18n/it.json +28 -28
  30. package/lib/commonjs/i18n/ja.json +28 -28
  31. package/lib/commonjs/i18n/ko.json +28 -28
  32. package/lib/commonjs/i18n/nl.json +28 -28
  33. package/lib/commonjs/i18n/pt-BR.json +28 -28
  34. package/lib/commonjs/i18n/ru.json +28 -28
  35. package/lib/commonjs/i18n/tr.json +28 -28
  36. package/lib/commonjs/index.js +7 -0
  37. package/lib/commonjs/index.js.map +1 -1
  38. package/lib/commonjs/utils/addReactionToLocalState.js +3 -2
  39. package/lib/commonjs/utils/addReactionToLocalState.js.map +1 -1
  40. package/lib/commonjs/version.json +1 -1
  41. package/lib/module/components/Attachment/Gallery.js +6 -7
  42. package/lib/module/components/Attachment/Gallery.js.map +1 -1
  43. package/lib/module/components/AttachmentPicker/AttachmentPicker.js +7 -11
  44. package/lib/module/components/AttachmentPicker/AttachmentPicker.js.map +1 -1
  45. package/lib/module/components/AttachmentPicker/components/AttachmentPickerIOSSelectMorePhotos.js +52 -0
  46. package/lib/module/components/AttachmentPicker/components/AttachmentPickerIOSSelectMorePhotos.js.map +1 -0
  47. package/lib/module/components/Chat/Chat.js +25 -16
  48. package/lib/module/components/Chat/Chat.js.map +1 -1
  49. package/lib/module/components/Chat/hooks/useAppSettings.js +18 -12
  50. package/lib/module/components/Chat/hooks/useAppSettings.js.map +1 -1
  51. package/lib/module/components/ImageGallery/ImageGallery.js +1 -1
  52. package/lib/module/components/ImageGallery/ImageGallery.js.map +1 -1
  53. package/lib/module/components/Indicators/LoadingIndicator.js +8 -2
  54. package/lib/module/components/Indicators/LoadingIndicator.js.map +1 -1
  55. package/lib/module/components/MessageInput/SendButton.js +1 -1
  56. package/lib/module/components/MessageInput/SendButton.js.map +1 -1
  57. package/lib/module/components/MessageInput/SendMessageDisallowedIndicator.js +3 -1
  58. package/lib/module/components/MessageInput/SendMessageDisallowedIndicator.js.map +1 -1
  59. package/lib/module/components/MessageList/MessageList.js +45 -40
  60. package/lib/module/components/MessageList/MessageList.js.map +1 -1
  61. package/lib/module/contexts/messageInputContext/MessageInputContext.js +73 -56
  62. package/lib/module/contexts/messageInputContext/MessageInputContext.js.map +1 -1
  63. package/lib/module/contexts/overlayContext/OverlayProvider.js +15 -11
  64. package/lib/module/contexts/overlayContext/OverlayProvider.js.map +1 -1
  65. package/lib/module/i18n/es.json +28 -28
  66. package/lib/module/i18n/fr.json +28 -28
  67. package/lib/module/i18n/he.json +28 -28
  68. package/lib/module/i18n/hi.json +28 -28
  69. package/lib/module/i18n/it.json +28 -28
  70. package/lib/module/i18n/ja.json +28 -28
  71. package/lib/module/i18n/ko.json +28 -28
  72. package/lib/module/i18n/nl.json +28 -28
  73. package/lib/module/i18n/pt-BR.json +28 -28
  74. package/lib/module/i18n/ru.json +28 -28
  75. package/lib/module/i18n/tr.json +28 -28
  76. package/lib/module/index.js +7 -0
  77. package/lib/module/index.js.map +1 -1
  78. package/lib/module/utils/addReactionToLocalState.js +3 -2
  79. package/lib/module/utils/addReactionToLocalState.js.map +1 -1
  80. package/lib/module/version.json +1 -1
  81. package/lib/typescript/components/AttachmentPicker/AttachmentPicker.d.ts +4 -0
  82. package/lib/typescript/components/AttachmentPicker/components/AttachmentPickerIOSSelectMorePhotos.d.ts +2 -0
  83. package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts +3 -1
  84. package/lib/typescript/i18n/es.json +28 -28
  85. package/lib/typescript/i18n/fr.json +28 -28
  86. package/lib/typescript/i18n/he.json +28 -28
  87. package/lib/typescript/i18n/hi.json +28 -28
  88. package/lib/typescript/i18n/it.json +28 -28
  89. package/lib/typescript/i18n/ja.json +28 -28
  90. package/lib/typescript/i18n/ko.json +28 -28
  91. package/lib/typescript/i18n/nl.json +28 -28
  92. package/lib/typescript/i18n/pt-BR.json +28 -28
  93. package/lib/typescript/i18n/ru.json +28 -28
  94. package/lib/typescript/i18n/tr.json +28 -28
  95. package/lib/typescript/index.d.ts +1 -1
  96. package/package.json +1 -1
  97. package/src/components/Attachment/Gallery.tsx +9 -9
  98. package/src/components/AttachmentPicker/AttachmentPicker.tsx +8 -19
  99. package/src/components/AttachmentPicker/components/AttachmentPickerIOSSelectMorePhotos.tsx +32 -0
  100. package/src/components/Chat/Chat.tsx +17 -6
  101. package/src/components/Chat/hooks/useAppSettings.ts +3 -1
  102. package/src/components/ImageGallery/ImageGallery.tsx +1 -1
  103. package/src/components/Indicators/LoadingIndicator.tsx +3 -3
  104. package/src/components/MessageInput/SendButton.tsx +1 -1
  105. package/src/components/MessageInput/SendMessageDisallowedIndicator.tsx +2 -1
  106. package/src/components/MessageList/MessageList.tsx +19 -13
  107. package/src/contexts/messageInputContext/MessageInputContext.tsx +9 -3
  108. package/src/contexts/overlayContext/OverlayProvider.tsx +3 -0
  109. package/src/i18n/es.json +28 -28
  110. package/src/i18n/fr.json +28 -28
  111. package/src/i18n/he.json +28 -28
  112. package/src/i18n/hi.json +28 -28
  113. package/src/i18n/it.json +28 -28
  114. package/src/i18n/ja.json +28 -28
  115. package/src/i18n/ko.json +28 -28
  116. package/src/i18n/nl.json +28 -28
  117. package/src/i18n/pt-BR.json +28 -28
  118. package/src/i18n/ru.json +28 -28
  119. package/src/i18n/tr.json +28 -28
  120. package/src/index.ts +1 -1
  121. package/src/utils/addReactionToLocalState.ts +7 -2
  122. package/src/version.json +1 -1
@@ -1,9 +1,9 @@
1
1
  {
2
- "1 Reply": "1 Ответ",
3
- "1 Thread Reply": "1 тема Ответить",
4
- "Allow access to your Gallery": "Разрешить доступ к вашей галерее",
5
- "Allow camera access in device settings": "Разрешите доступ к камере в настройках устройства.",
6
- "Also send to channel": "",
2
+ "1 Reply": "",
3
+ "1 Thread Reply": "",
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,17 +13,17 @@
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
19
  "Editing Message": "",
20
20
  "Emoji matching": "",
21
21
  "Empty message...": "",
22
- "Error loading": "",
22
+ "Error loading": "Ошибка при загрузке",
23
23
  "Error loading channel list...": "",
24
- "Error loading messages for this channel...": "",
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": "Не удалось отправить жалобу. Возможные причины: проблема с подключением к интернету или ваша жалоба уже была принята.",
@@ -36,44 +36,44 @@
36
36
  "Loading...": "",
37
37
  "Maximum file size upload limit reached. Please upload a file below {{MAX_FILE_SIZE_TO_UPLOAD_IN_MB}} MB.": "",
38
38
  "Message Reactions": "Сообщения Реакции",
39
- "Message deleted": "",
39
+ "Message deleted": "Сообщение удалено",
40
40
  "Message flagged": "Сообщение отмечено",
41
41
  "Mute User": "Отключить пользователя",
42
42
  "Not supported": "",
43
43
  "Nothing yet...": "",
44
44
  "Ok": "Oк",
45
45
  "Only visible to you": "",
46
- "Open Settings": "Открыть настройки",
47
- "Photo": "",
48
- "Photos and Videos": "Фото и видео",
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.": "Разрешите доступ к своим фотографиям и видео, чтобы вы могли ими поделиться.",
52
- "Please select a channel first": "",
53
- "Reconnecting...": "",
51
+ "Please enable access to your photos and videos so you can share them.": "",
52
+ "Please select a channel first": "Пожалуйста, сначала выберите канал",
53
+ "Reconnecting...": "Переподключение...",
54
54
  "Reply": "Ответить",
55
- "Reply to Message": "Ответить на сообщение",
55
+ "Reply to Message": "",
56
56
  "Resend": "Отправить",
57
- "Search GIFs": "Поиск GIF",
58
- "Select More Photos": "Выбрать больше фотографий",
57
+ "Search GIFs": "",
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
72
  "You can't send messages in this channel": "",
73
- "{{ firstUser }} and {{ nonSelfUserLength }} more are typing": "",
74
- "{{ index }} of {{ photoLength }}": "{{ index }} из {{ photoLength }}",
75
- "{{ replyCount }} Replies": "{{ replyCount }} Ответов",
76
- "{{ replyCount }} Thread Replies": "{{replyCount}} Ответы в темах",
77
- "{{ user }} is typing": "",
73
+ "{{ firstUser }} and {{ nonSelfUserLength }} more are typing": "{{ firstUser }} и еще {{ nonSelfUserLength }} пишут",
74
+ "{{ index }} of {{ photoLength }}": "",
75
+ "{{ replyCount }} Replies": "",
76
+ "{{ replyCount }} Thread Replies": "",
77
+ "{{ user }} is typing": "{{ user }} пишет",
78
78
  "🏙 Attachment...": ""
79
79
  }
@@ -1,9 +1,9 @@
1
1
  {
2
- "1 Reply": "1 Cevap",
3
- "1 Thread Reply": "1 Konu Yanıtı",
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": "",
2
+ "1 Reply": "",
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",
7
7
  "Are you sure you want to permanently delete this message?": "Bu mesajı kalıcı olarak silmek istediğinizden emin misiniz?",
8
8
  "Are you sure?": "",
9
9
  "Block User": "Kullanıcıyı engelle",
@@ -13,17 +13,17 @@
13
13
  "Copy Message": "Mesajı Kopyala",
14
14
  "Delete": "Sil",
15
15
  "Delete Message": "Mesajı Sil",
16
- "Device camera is used to take photos or videos.": "Cihaz kamerası fotoğraf veya video çekmek için kullanılır.",
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?": "Detaylı inceleme için bu mesajın kopyasını moderatöre göndermek istiyor musunuz?",
18
18
  "Edit Message": "Mesajı Düzenle",
19
19
  "Editing Message": "",
20
20
  "Emoji matching": "",
21
21
  "Empty message...": "",
22
- "Error loading": "",
22
+ "Error loading": "Yükleme hatası",
23
23
  "Error loading channel list...": "",
24
- "Error loading messages for this channel...": "",
24
+ "Error loading messages for this channel...": "Bu kanal için mesajlar yüklenirken hata oluştu...",
25
25
  "Error while loading, please reload/refresh": "",
26
- "File type not supported": "Dosya türü desteklenmiyor",
26
+ "File type not supported": "",
27
27
  "Flag": "Raporla",
28
28
  "Flag Message": "Mesajı Raporla",
29
29
  "Flag action failed either due to a network issue or the message is already flagged": "Mesajın daha önce raporlanmış olması veya bir ağ bağlantısı sorunu nedeniyle raporlama işlemi başarısız oldu.",
@@ -36,44 +36,44 @@
36
36
  "Loading...": "",
37
37
  "Maximum file size upload limit reached. Please upload a file below {{MAX_FILE_SIZE_TO_UPLOAD_IN_MB}} MB.": "",
38
38
  "Message Reactions": "Mesaj Tepkileri",
39
- "Message deleted": "",
39
+ "Message deleted": "Mesaj silindi",
40
40
  "Message flagged": "Mesaj işaretlendi",
41
41
  "Mute User": "Kullanıcıyı sessize al",
42
42
  "Not supported": "",
43
43
  "Nothing yet...": "",
44
44
  "Ok": "Tamam",
45
45
  "Only visible to you": "",
46
- "Open Settings": "Ayarları aç",
47
- "Photo": "",
48
- "Photos and Videos": "Fotoğraflar ve Videolar",
46
+ "Open Settings": "",
47
+ "Photo": "Fotoğraf",
48
+ "Photos and Videos": "",
49
49
  "Pin to Conversation": "Konuşmaya sabitle",
50
50
  "Pinned by": "",
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
- "Please select a channel first": "",
53
- "Reconnecting...": "",
51
+ "Please enable access to your photos and videos so you can share them.": "",
52
+ "Please select a channel first": "Lütfen önce bir kanal seçiniz",
53
+ "Reconnecting...": "Yeniden Bağlanılıyor...",
54
54
  "Reply": "Yanıtla",
55
- "Reply to Message": "Mesajı Yanıtla",
55
+ "Reply to Message": "",
56
56
  "Resend": "Yeniden gönder",
57
- "Search GIFs": "GIF Ara",
58
- "Select More Photos": "Daha Fazla Fotoğraf Seçin",
57
+ "Search GIFs": "",
58
+ "Select More Photos": "",
59
59
  "Send Anyway": "",
60
- "Send a message": "Mesaj gönder",
60
+ "Send a message": "",
61
61
  "Sending links is not allowed in this conversation": "",
62
- "Slow mode ON": "Yavaş Mod Açık",
62
+ "Slow mode ON": "",
63
63
  "The message has been reported to a moderator.": "Mesaj moderatöre bildirildi.",
64
64
  "Thread Reply": "Konu Yanıtı",
65
65
  "Unblock User": "Kullanıcının engelini kaldır",
66
- "Unknown User": "Bilinmeyen kullanıcı",
66
+ "Unknown User": "",
67
67
  "Unmute User": "Kullanıcının sesini aç",
68
68
  "Unpin from Conversation": "Sabitlemeyi kaldır",
69
69
  "Unread Messages": "",
70
- "Video": "",
70
+ "Video": "Video",
71
71
  "You": "",
72
72
  "You can't send messages in this channel": "",
73
- "{{ firstUser }} and {{ nonSelfUserLength }} more are typing": "",
74
- "{{ index }} of {{ photoLength }}": "{{ index }} / {{ photoLength }}",
75
- "{{ replyCount }} Replies": "{{ replyCount }} Cevap",
76
- "{{ replyCount }} Thread Replies": "{{responseCount}} Konu Cevapı",
77
- "{{ user }} is typing": "",
73
+ "{{ firstUser }} and {{ nonSelfUserLength }} more are typing": "{{ firstUser }} ve {{ nonSelfUserLength }} kişi daha yazıyor",
74
+ "{{ index }} of {{ photoLength }}": "",
75
+ "{{ replyCount }} Replies": "",
76
+ "{{ replyCount }} Thread Replies": "",
77
+ "{{ user }} is typing": "{{ user }} yazıyor",
78
78
  "🏙 Attachment...": ""
79
79
  }
@@ -1,6 +1,6 @@
1
1
  export * from './components';
2
2
  export * from './hooks';
3
- export { registerNativeHandlers, NetInfo } from './native';
3
+ export { registerNativeHandlers, NetInfo, iOS14RefreshGallerySelection } from './native';
4
4
  export * from './contexts';
5
5
  export * from './emoji-data';
6
6
  export * from './icons';
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.1-beta.3",
4
+ "version": "5.27.0-beta.10",
5
5
  "author": {
6
6
  "company": "Stream.io Inc",
7
7
  "name": "Stream.io Inc"
@@ -309,15 +309,15 @@ const GalleryThumbnail = <
309
309
  };
310
310
 
311
311
  const defaultOnPress = () => {
312
- if ((thumbnail.type === 'video' && !thumbnail.thumb_url) || !thumbnail.url) {
313
- return;
314
- }
315
- if (thumbnail.type === 'video' && !isVideoPackageAvailable()) {
316
- // This condition is kinda unreachable, since we render videos as file attachment if the video
317
- // library is not installed. But doesn't hurt to have extra safeguard, in case of some customizations.
318
- openUrlSafely(thumbnail.url);
319
- } else {
320
- openImageViewer();
312
+ // If the url is defined then only try to open the file.
313
+ if (thumbnail.url) {
314
+ if (thumbnail.type === 'video' && !isVideoPackageAvailable()) {
315
+ // This condition is kinda unreachable, since we render videos as file attachment if the video
316
+ // library is not installed. But doesn't hurt to have extra safeguard, in case of some customizations.
317
+ openUrlSafely(thumbnail.url);
318
+ } else {
319
+ openImageViewer();
320
+ }
321
321
  }
322
322
  };
323
323
 
@@ -1,13 +1,5 @@
1
1
  import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
2
- import {
3
- BackHandler,
4
- Button,
5
- Dimensions,
6
- Keyboard,
7
- Platform,
8
- StatusBar,
9
- StyleSheet,
10
- } from 'react-native';
2
+ import { BackHandler, Dimensions, Keyboard, Platform, StatusBar, StyleSheet } from 'react-native';
11
3
 
12
4
  import BottomSheet, { BottomSheetFlatList, BottomSheetHandleProps } from '@gorhom/bottom-sheet';
13
5
  import dayjs from 'dayjs';
@@ -19,13 +11,8 @@ import { renderAttachmentPickerItem } from './components/AttachmentPickerItem';
19
11
 
20
12
  import { useAttachmentPickerContext } from '../../contexts/attachmentPickerContext/AttachmentPickerContext';
21
13
  import { useTheme } from '../../contexts/themeContext/ThemeContext';
22
- import { useTranslationContext } from '../../contexts/translationContext/TranslationContext';
23
14
  import { useViewport } from '../../hooks/useViewport';
24
- import {
25
- getPhotos,
26
- iOS14RefreshGallerySelection,
27
- oniOS14GalleryLibrarySelectionChange,
28
- } from '../../native';
15
+ import { getPhotos, oniOS14GalleryLibrarySelectionChange } from '../../native';
29
16
  import type { Asset } from '../../types/types';
30
17
 
31
18
  dayjs.extend(duration);
@@ -57,6 +44,10 @@ export type AttachmentPickerProps = {
57
44
  * **Default** [AttachmentPickerErrorImage](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/AttachmentPicker/components/AttachmentPickerErrorImage.tsx)
58
45
  */
59
46
  AttachmentPickerErrorImage: React.ComponentType;
47
+ /**
48
+ * Custom UI Component to render select more photos for selected gallery access in iOS.
49
+ */
50
+ AttachmentPickerIOSSelectMorePhotos: React.ComponentType;
60
51
  /**
61
52
  * Custom UI component to render overlay component, that shows up on top of [selected image](https://github.com/GetStream/stream-chat-react-native/blob/main/screenshots/docs/1.png) (with tick mark)
62
53
  *
@@ -82,6 +73,7 @@ export const AttachmentPicker = React.forwardRef(
82
73
  attachmentPickerErrorButtonText,
83
74
  AttachmentPickerErrorImage,
84
75
  attachmentPickerErrorText,
76
+ AttachmentPickerIOSSelectMorePhotos,
85
77
  ImageOverlaySelectedComponent,
86
78
  numberOfAttachmentImagesToLoadPerCall,
87
79
  numberOfAttachmentPickerImageColumns,
@@ -117,7 +109,6 @@ export const AttachmentPicker = React.forwardRef(
117
109
  const [loadingPhotos, setLoadingPhotos] = useState(false);
118
110
  const [photos, setPhotos] = useState<Asset[]>([]);
119
111
  const attemptedToLoadPhotosOnOpenRef = useRef(false);
120
- const { t } = useTranslationContext();
121
112
 
122
113
  const getMorePhotos = useCallback(async () => {
123
114
  if (
@@ -323,9 +314,7 @@ export const AttachmentPicker = React.forwardRef(
323
314
  ref={ref}
324
315
  snapPoints={snapPoints}
325
316
  >
326
- {iOSLimited && (
327
- <Button onPress={iOS14RefreshGallerySelection} title={t('Select More Photos')} />
328
- )}
317
+ {iOSLimited && <AttachmentPickerIOSSelectMorePhotos />}
329
318
  <BottomSheetFlatList
330
319
  contentContainerStyle={[
331
320
  styles.container,
@@ -0,0 +1,32 @@
1
+ import React from 'react';
2
+ import { Pressable, StyleSheet, Text } from 'react-native';
3
+
4
+ import { useTheme } from '../../../contexts/themeContext/ThemeContext';
5
+ import { useTranslationContext } from '../../../contexts/translationContext/TranslationContext';
6
+ import { iOS14RefreshGallerySelection } from '../../../native';
7
+
8
+ export const AttachmentPickerIOSSelectMorePhotos = () => {
9
+ const { t } = useTranslationContext();
10
+ const {
11
+ theme: {
12
+ colors: { accent_blue, white },
13
+ },
14
+ } = useTheme();
15
+ return (
16
+ <Pressable
17
+ onPress={iOS14RefreshGallerySelection}
18
+ style={[styles.container, { backgroundColor: white }]}
19
+ >
20
+ <Text style={[styles.text, { color: accent_blue }]}>{t('Select More Photos')}</Text>
21
+ </Pressable>
22
+ );
23
+ };
24
+
25
+ const styles = StyleSheet.create({
26
+ container: {},
27
+ text: {
28
+ fontSize: 16,
29
+ paddingVertical: 10,
30
+ textAlign: 'center',
31
+ },
32
+ });
@@ -160,7 +160,12 @@ const ChatWithContext = <
160
160
  closeConnectionOnBackground,
161
161
  );
162
162
 
163
- const [initialisedDatabase, setInitialisedDatabase] = useState(false);
163
+ const [initialisedDatabaseConfig, setInitialisedDatabaseConfig] = useState<{
164
+ initialised: boolean;
165
+ userID?: string;
166
+ }>({
167
+ initialised: false,
168
+ });
164
169
 
165
170
  /**
166
171
  * Setup muted user listener
@@ -171,6 +176,8 @@ const ChatWithContext = <
171
176
  const debugRef = useDebugContext();
172
177
  const isDebugModeEnabled = __DEV__ && debugRef && debugRef.current;
173
178
 
179
+ const userID = client.userID;
180
+
174
181
  // Set the `resizableCDNHosts` as per the prop.
175
182
  StreamChatRN.setConfig({ resizableCDNHosts });
176
183
 
@@ -195,13 +202,16 @@ const ChatWithContext = <
195
202
  const setActiveChannel = (newChannel?: Channel<StreamChatGenerics>) => setChannel(newChannel);
196
203
 
197
204
  useEffect(() => {
198
- if (client.user?.id && enableOfflineSupport) {
199
- setInitialisedDatabase(false);
205
+ if (userID && enableOfflineSupport) {
206
+ setInitialisedDatabaseConfig({ initialised: false, userID });
200
207
  QuickSqliteClient.initializeDatabase();
201
208
  DBSyncManager.init(client as unknown as StreamChat);
202
- setInitialisedDatabase(true);
209
+ setInitialisedDatabaseConfig({ initialised: true, userID });
203
210
  }
204
- }, [client?.user?.id, enableOfflineSupport]);
211
+ }, [userID, enableOfflineSupport]);
212
+
213
+ const initialisedDatabase =
214
+ initialisedDatabaseConfig.initialised && userID === initialisedDatabaseConfig.userID;
205
215
 
206
216
  const appSettings = useAppSettings(client, isOnline, enableOfflineSupport, initialisedDatabase);
207
217
 
@@ -224,7 +234,8 @@ const ChatWithContext = <
224
234
  initialisedDatabase,
225
235
  });
226
236
 
227
- if (enableOfflineSupport && !initialisedDatabase) {
237
+ if (userID && enableOfflineSupport && !initialisedDatabase) {
238
+ // if user id has been set and offline support is enabled, we need to wait for database to be initialised
228
239
  return null;
229
240
  }
230
241
 
@@ -19,7 +19,9 @@ export const useAppSettings = <
19
19
  async function enforeAppSettings() {
20
20
  if (!client.userID) return;
21
21
 
22
- if (!isOnline && enableOfflineSupport && initialisedDatabase) {
22
+ if (enableOfflineSupport && !initialisedDatabase) return;
23
+
24
+ if (!isOnline && enableOfflineSupport) {
23
25
  const appSettings = dbApi.getAppSettings({ currentUserId: client.userID });
24
26
  setAppSettings(appSettings);
25
27
  return;
@@ -272,7 +272,7 @@ export const ImageGallery = <
272
272
  !attachment.title_link &&
273
273
  !attachment.og_scrape_url &&
274
274
  getUrlOfImageAttachment(attachment)) ||
275
- ((isVideoPackageAvailable() && attachment.type) === 'video' && attachment.thumb_url),
275
+ (isVideoPackageAvailable() && attachment.type === 'video'),
276
276
  )
277
277
  .reverse() || [];
278
278
 
@@ -21,14 +21,14 @@ const styles = StyleSheet.create({
21
21
  const LoadingIndicatorWrapper: React.FC<{ text: string }> = ({ text }) => {
22
22
  const {
23
23
  theme: {
24
- colors: { black },
24
+ colors: { black, white_snow },
25
25
  loadingIndicator: { container, loadingText },
26
26
  },
27
27
  } = useTheme();
28
28
 
29
29
  return (
30
- <View style={[styles.container, container]}>
31
- <Spinner />
30
+ <View style={[styles.container, { backgroundColor: white_snow }, container]}>
31
+ <Spinner height={20} width={20} />
32
32
  <Text style={[styles.loadingText, { color: black }, loadingText]} testID='loading'>
33
33
  {text}
34
34
  </Text>
@@ -35,7 +35,7 @@ const SendButtonWithContext = <
35
35
  return (
36
36
  <Pressable
37
37
  disabled={disabled}
38
- onPress={disabled ? () => null : () => sendMessage(undefined)}
38
+ onPress={disabled ? () => null : () => sendMessage()}
39
39
  style={[sendButton]}
40
40
  testID='send-button'
41
41
  >
@@ -21,7 +21,7 @@ export const SendMessageDisallowedIndicator = () => {
21
21
  const { t } = useTranslationContext();
22
22
  const {
23
23
  theme: {
24
- colors: { border, grey_dark },
24
+ colors: { border, grey_dark, white },
25
25
  messageInput: {
26
26
  sendMessageDisallowedIndicator: { container, text },
27
27
  },
@@ -33,6 +33,7 @@ export const SendMessageDisallowedIndicator = () => {
33
33
  style={[
34
34
  styles.container,
35
35
  {
36
+ backgroundColor: white,
36
37
  borderTopColor: border,
37
38
  height: 50,
38
39
  },
@@ -525,7 +525,7 @@ const MessageListWithContext = <
525
525
  if (threadList || hasNoMoreRecentMessagesToLoad) {
526
526
  scrollToBottomIfNeeded();
527
527
  } else {
528
- setScrollToBottomButtonVisible(true);
528
+ setScrollToBottomButtonVisible(false);
529
529
  }
530
530
 
531
531
  if (
@@ -805,13 +805,15 @@ const MessageListWithContext = <
805
805
 
806
806
  const handleScroll: ScrollViewProps['onScroll'] = (event) => {
807
807
  const offset = event.nativeEvent.contentOffset.y;
808
+ const messageListHasMessages = processedMessageList.length > 0;
808
809
  // Show scrollToBottom button once scroll position goes beyond 150.
809
810
  const isScrollAtBottom = offset <= 150;
810
811
 
811
812
  const notLatestSet = channel.state.messages !== channel.state.latestMessages;
812
813
 
813
814
  const showScrollToBottomButton =
814
- (!threadList && notLatestSet) || !isScrollAtBottom || !hasNoMoreRecentMessagesToLoad;
815
+ messageListHasMessages &&
816
+ ((!threadList && notLatestSet) || !isScrollAtBottom || !hasNoMoreRecentMessagesToLoad);
815
817
 
816
818
  /**
817
819
  * 1. If I scroll up -> show scrollToBottom button.
@@ -1072,7 +1074,11 @@ const MessageListWithContext = <
1072
1074
  const renderListEmptyComponent = useCallback(
1073
1075
  () => (
1074
1076
  <View
1075
- style={[styles.flex, shouldApplyAndroidWorkaround ? styles.invertAndroid : styles.invert]}
1077
+ style={[
1078
+ styles.flex,
1079
+ { backgroundColor: white_snow },
1080
+ shouldApplyAndroidWorkaround ? styles.invertAndroid : styles.invert,
1081
+ ]}
1076
1082
  testID='empty-state'
1077
1083
  >
1078
1084
  <EmptyStateIndicator listType='message' />
@@ -1099,16 +1105,6 @@ const MessageListWithContext = <
1099
1105
  [shouldApplyAndroidWorkaround, HeaderComponent],
1100
1106
  );
1101
1107
 
1102
- if (!FlatList) return null;
1103
-
1104
- if (loading) {
1105
- return (
1106
- <View style={styles.flex}>
1107
- <LoadingIndicator listType='message' />
1108
- </View>
1109
- );
1110
- }
1111
-
1112
1108
  const StickyHeaderComponent = () => {
1113
1109
  if (!stickyHeaderDateString) return null;
1114
1110
  if (StickyHeader) return <StickyHeader dateString={stickyHeaderDateString} />;
@@ -1127,6 +1123,16 @@ const MessageListWithContext = <
1127
1123
  additionalFlatListPropsExcludingStyle = rest;
1128
1124
  }
1129
1125
 
1126
+ if (!FlatList) return null;
1127
+
1128
+ if (loading) {
1129
+ return (
1130
+ <View style={[styles.container, { backgroundColor: white_snow }, container]}>
1131
+ <LoadingIndicator listType='message' />
1132
+ </View>
1133
+ );
1134
+ }
1135
+
1130
1136
  return (
1131
1137
  <View
1132
1138
  style={[styles.container, { backgroundColor: white_snow }, container]}
@@ -165,7 +165,9 @@ export type LocalMessageInputContext<
165
165
  resetInput: (pendingAttachments?: Attachment<StreamChatGenerics>[]) => void;
166
166
  selectedPicker: string | undefined;
167
167
  sending: React.MutableRefObject<boolean>;
168
- sendMessage: (customMessageData?: Partial<Message<StreamChatGenerics>>) => Promise<void>;
168
+ sendMessage: (params?: {
169
+ customMessageData?: Partial<Message<StreamChatGenerics>>;
170
+ }) => Promise<void>;
169
171
  sendMessageAsync: (id: string) => void;
170
172
  sendThreadMessageInChannel: boolean;
171
173
  setAsyncIds: React.Dispatch<React.SetStateAction<string[]>>;
@@ -706,8 +708,12 @@ export const MessageInputProvider = <
706
708
  };
707
709
 
708
710
  // TODO: Figure out why this is async, as it doesn't await any promise.
709
- // eslint-disable-next-line require-await
710
- const sendMessage = async (customMessageData?: Partial<Message<StreamChatGenerics>>) => {
711
+ const sendMessage = async ({
712
+ customMessageData,
713
+ }: {
714
+ customMessageData?: Partial<Message<StreamChatGenerics>>;
715
+ // eslint-disable-next-line require-await
716
+ } = {}) => {
711
717
  if (sending.current) {
712
718
  return;
713
719
  }
@@ -18,6 +18,7 @@ import { AttachmentPicker } from '../../components/AttachmentPicker/AttachmentPi
18
18
  import { AttachmentPickerBottomSheetHandle as DefaultAttachmentPickerBottomSheetHandle } from '../../components/AttachmentPicker/components/AttachmentPickerBottomSheetHandle';
19
19
  import { AttachmentPickerError as DefaultAttachmentPickerError } from '../../components/AttachmentPicker/components/AttachmentPickerError';
20
20
  import { AttachmentPickerErrorImage as DefaultAttachmentPickerErrorImage } from '../../components/AttachmentPicker/components/AttachmentPickerErrorImage';
21
+ import { AttachmentPickerIOSSelectMorePhotos as DefaultAttachmentPickerIOSSelectMorePhotos } from '../../components/AttachmentPicker/components/AttachmentPickerIOSSelectMorePhotos';
21
22
  import { CameraSelectorIcon as DefaultCameraSelectorIcon } from '../../components/AttachmentPicker/components/CameraSelectorIcon';
22
23
  import { FileSelectorIcon as DefaultFileSelectorIcon } from '../../components/AttachmentPicker/components/FileSelectorIcon';
23
24
  import { ImageOverlaySelectedComponent as DefaultImageOverlaySelectedComponent } from '../../components/AttachmentPicker/components/ImageOverlaySelectedComponent';
@@ -73,6 +74,7 @@ export const OverlayProvider = <
73
74
  AttachmentPickerErrorImage = DefaultAttachmentPickerErrorImage,
74
75
  attachmentPickerErrorText,
75
76
  attachmentSelectionBarHeight,
77
+ AttachmentPickerIOSSelectMorePhotos = DefaultAttachmentPickerIOSSelectMorePhotos,
76
78
  bottomInset,
77
79
  CameraSelectorIcon = DefaultCameraSelectorIcon,
78
80
  children,
@@ -132,6 +134,7 @@ export const OverlayProvider = <
132
134
  attachmentPickerErrorButtonText,
133
135
  AttachmentPickerErrorImage,
134
136
  attachmentPickerErrorText,
137
+ AttachmentPickerIOSSelectMorePhotos,
135
138
  attachmentSelectionBarHeight,
136
139
  ImageOverlaySelectedComponent,
137
140
  numberOfAttachmentImagesToLoadPerCall,