stream-chat-react-native-core 4.5.1-beta.1 → 4.6.1-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 (155) hide show
  1. package/README.md +3 -3
  2. package/lib/commonjs/components/Attachment/FileIcon.js +9 -1
  3. package/lib/commonjs/components/Attachment/FileIcon.js.map +1 -1
  4. package/lib/commonjs/components/AttachmentPicker/AttachmentPicker.js +208 -31
  5. package/lib/commonjs/components/AttachmentPicker/AttachmentPicker.js.map +1 -1
  6. package/lib/commonjs/components/Channel/Channel.js.map +1 -1
  7. package/lib/commonjs/components/Chat/Chat.js.map +1 -1
  8. package/lib/commonjs/components/Message/Message.js.map +1 -1
  9. package/lib/commonjs/components/Message/MessageSimple/MessageContent.js +67 -24
  10. package/lib/commonjs/components/Message/MessageSimple/MessageContent.js.map +1 -1
  11. package/lib/commonjs/components/Message/MessageSimple/utils/renderText.md +1 -1
  12. package/lib/commonjs/components/MessageInput/FileUploadPreview.js +1 -1
  13. package/lib/commonjs/components/MessageInput/FileUploadPreview.js.map +1 -1
  14. package/lib/commonjs/components/MessageInput/MessageInput.js +129 -44
  15. package/lib/commonjs/components/MessageInput/MessageInput.js.map +1 -1
  16. package/lib/commonjs/components/Reply/Reply.js +25 -9
  17. package/lib/commonjs/components/Reply/Reply.js.map +1 -1
  18. package/lib/commonjs/contexts/attachmentPickerContext/AttachmentPickerContext.js +15 -8
  19. package/lib/commonjs/contexts/attachmentPickerContext/AttachmentPickerContext.js.map +1 -1
  20. package/lib/commonjs/contexts/channelContext/ChannelContext.js.map +1 -1
  21. package/lib/commonjs/contexts/channelContext/ChannelContext.md +1 -1
  22. package/lib/commonjs/contexts/channelsContext/ChannelsContext.js.map +1 -1
  23. package/lib/commonjs/contexts/channelsContext/ChannelsContext.md +1 -1
  24. package/lib/commonjs/contexts/chatContext/ChatContext.md +1 -1
  25. package/lib/commonjs/contexts/imageGalleryContext/ImageGalleryContext.md +1 -1
  26. package/lib/commonjs/contexts/keyboardContext/KeyboardContext.md +1 -1
  27. package/lib/commonjs/contexts/messageContext/MessageContext.js.map +1 -1
  28. package/lib/commonjs/contexts/messageContext/MessageContext.md +1 -1
  29. package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js +10 -7
  30. package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js.map +1 -1
  31. package/lib/commonjs/contexts/messageInputContext/MessageInputContext.md +1 -1
  32. package/lib/commonjs/contexts/messageInputContext/hooks/useMessageDetailsForState.js +16 -1
  33. package/lib/commonjs/contexts/messageInputContext/hooks/useMessageDetailsForState.js.map +1 -1
  34. package/lib/commonjs/contexts/messageOverlayContext/MessageOverlayContext.js.map +1 -1
  35. package/lib/commonjs/contexts/messagesContext/MessagesContext.js.map +1 -1
  36. package/lib/commonjs/contexts/messagesContext/MessagesContext.md +1 -1
  37. package/lib/commonjs/contexts/overlayContext/OverlayContext.md +1 -1
  38. package/lib/commonjs/contexts/paginatedMessageListContext/PaginatedMessageListContext.md +1 -1
  39. package/lib/commonjs/contexts/suggestionsContext/SuggestionsContext.md +1 -1
  40. package/lib/commonjs/contexts/themeContext/utils/theme.js +1 -0
  41. package/lib/commonjs/contexts/themeContext/utils/theme.js.map +1 -1
  42. package/lib/commonjs/contexts/typingContext/TypingContext.md +1 -1
  43. package/lib/commonjs/icons/Recorder.js +47 -0
  44. package/lib/commonjs/icons/Recorder.js.map +1 -0
  45. package/lib/commonjs/icons/Video.js +82 -0
  46. package/lib/commonjs/icons/Video.js.map +1 -0
  47. package/lib/commonjs/icons/index.js +26 -0
  48. package/lib/commonjs/icons/index.js.map +1 -1
  49. package/lib/commonjs/native.js.map +1 -1
  50. package/lib/commonjs/version.json +1 -1
  51. package/lib/module/components/Attachment/FileIcon.js +9 -1
  52. package/lib/module/components/Attachment/FileIcon.js.map +1 -1
  53. package/lib/module/components/AttachmentPicker/AttachmentPicker.js +208 -31
  54. package/lib/module/components/AttachmentPicker/AttachmentPicker.js.map +1 -1
  55. package/lib/module/components/Channel/Channel.js.map +1 -1
  56. package/lib/module/components/Chat/Chat.js.map +1 -1
  57. package/lib/module/components/Message/Message.js.map +1 -1
  58. package/lib/module/components/Message/MessageSimple/MessageContent.js +67 -24
  59. package/lib/module/components/Message/MessageSimple/MessageContent.js.map +1 -1
  60. package/lib/module/components/Message/MessageSimple/utils/renderText.md +1 -1
  61. package/lib/module/components/MessageInput/FileUploadPreview.js +1 -1
  62. package/lib/module/components/MessageInput/FileUploadPreview.js.map +1 -1
  63. package/lib/module/components/MessageInput/MessageInput.js +129 -44
  64. package/lib/module/components/MessageInput/MessageInput.js.map +1 -1
  65. package/lib/module/components/Reply/Reply.js +25 -9
  66. package/lib/module/components/Reply/Reply.js.map +1 -1
  67. package/lib/module/contexts/attachmentPickerContext/AttachmentPickerContext.js +15 -8
  68. package/lib/module/contexts/attachmentPickerContext/AttachmentPickerContext.js.map +1 -1
  69. package/lib/module/contexts/channelContext/ChannelContext.js.map +1 -1
  70. package/lib/module/contexts/channelContext/ChannelContext.md +1 -1
  71. package/lib/module/contexts/channelsContext/ChannelsContext.js.map +1 -1
  72. package/lib/module/contexts/channelsContext/ChannelsContext.md +1 -1
  73. package/lib/module/contexts/chatContext/ChatContext.md +1 -1
  74. package/lib/module/contexts/imageGalleryContext/ImageGalleryContext.md +1 -1
  75. package/lib/module/contexts/keyboardContext/KeyboardContext.md +1 -1
  76. package/lib/module/contexts/messageContext/MessageContext.js.map +1 -1
  77. package/lib/module/contexts/messageContext/MessageContext.md +1 -1
  78. package/lib/module/contexts/messageInputContext/MessageInputContext.js +10 -7
  79. package/lib/module/contexts/messageInputContext/MessageInputContext.js.map +1 -1
  80. package/lib/module/contexts/messageInputContext/MessageInputContext.md +1 -1
  81. package/lib/module/contexts/messageInputContext/hooks/useMessageDetailsForState.js +16 -1
  82. package/lib/module/contexts/messageInputContext/hooks/useMessageDetailsForState.js.map +1 -1
  83. package/lib/module/contexts/messageOverlayContext/MessageOverlayContext.js.map +1 -1
  84. package/lib/module/contexts/messagesContext/MessagesContext.js.map +1 -1
  85. package/lib/module/contexts/messagesContext/MessagesContext.md +1 -1
  86. package/lib/module/contexts/overlayContext/OverlayContext.md +1 -1
  87. package/lib/module/contexts/paginatedMessageListContext/PaginatedMessageListContext.md +1 -1
  88. package/lib/module/contexts/suggestionsContext/SuggestionsContext.md +1 -1
  89. package/lib/module/contexts/themeContext/utils/theme.js +1 -0
  90. package/lib/module/contexts/themeContext/utils/theme.js.map +1 -1
  91. package/lib/module/contexts/typingContext/TypingContext.md +1 -1
  92. package/lib/module/icons/Recorder.js +47 -0
  93. package/lib/module/icons/Recorder.js.map +1 -0
  94. package/lib/module/icons/Video.js +82 -0
  95. package/lib/module/icons/Video.js.map +1 -0
  96. package/lib/module/icons/index.js +26 -0
  97. package/lib/module/icons/index.js.map +1 -1
  98. package/lib/module/native.js.map +1 -1
  99. package/lib/module/version.json +1 -1
  100. package/lib/typescript/components/AttachmentPicker/AttachmentPicker.d.ts +6 -6
  101. package/lib/typescript/components/Channel/Channel.d.ts +2 -2
  102. package/lib/typescript/components/Chat/Chat.d.ts +1 -1
  103. package/lib/typescript/components/Message/Message.d.ts +2 -2
  104. package/lib/typescript/components/MessageInput/MessageInput.d.ts +1 -1
  105. package/lib/typescript/contexts/attachmentPickerContext/AttachmentPickerContext.d.ts +9 -8
  106. package/lib/typescript/contexts/channelContext/ChannelContext.d.ts +2 -2
  107. package/lib/typescript/contexts/channelsContext/ChannelsContext.d.ts +6 -6
  108. package/lib/typescript/contexts/messageContext/MessageContext.d.ts +2 -2
  109. package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts +10 -21
  110. package/lib/typescript/contexts/messageOverlayContext/MessageOverlayContext.d.ts +6 -6
  111. package/lib/typescript/contexts/messagesContext/MessagesContext.d.ts +20 -20
  112. package/lib/typescript/contexts/themeContext/utils/theme.d.ts +2 -1
  113. package/lib/typescript/icons/Recorder.d.ts +3 -0
  114. package/lib/typescript/icons/Video.d.ts +3 -0
  115. package/lib/typescript/icons/index.d.ts +2 -0
  116. package/lib/typescript/native.d.ts +3 -14
  117. package/lib/typescript/types/types.d.ts +24 -0
  118. package/package.json +1 -1
  119. package/src/components/Attachment/FileIcon.tsx +45 -0
  120. package/src/components/AttachmentPicker/AttachmentPicker.tsx +178 -28
  121. package/src/components/Channel/Channel.tsx +2 -2
  122. package/src/components/Chat/Chat.tsx +1 -1
  123. package/src/components/Message/Message.tsx +2 -2
  124. package/src/components/Message/MessageSimple/MessageContent.tsx +57 -12
  125. package/src/components/Message/MessageSimple/utils/renderText.md +1 -1
  126. package/src/components/MessageInput/FileUploadPreview.tsx +1 -1
  127. package/src/components/MessageInput/MessageInput.tsx +106 -19
  128. package/src/components/Reply/Reply.tsx +31 -14
  129. package/src/contexts/attachmentPickerContext/AttachmentPickerContext.tsx +12 -8
  130. package/src/contexts/channelContext/ChannelContext.md +1 -1
  131. package/src/contexts/channelContext/ChannelContext.tsx +2 -2
  132. package/src/contexts/channelsContext/ChannelsContext.md +1 -1
  133. package/src/contexts/channelsContext/ChannelsContext.tsx +6 -6
  134. package/src/contexts/chatContext/ChatContext.md +1 -1
  135. package/src/contexts/imageGalleryContext/ImageGalleryContext.md +1 -1
  136. package/src/contexts/keyboardContext/KeyboardContext.md +1 -1
  137. package/src/contexts/messageContext/MessageContext.md +1 -1
  138. package/src/contexts/messageContext/MessageContext.tsx +2 -2
  139. package/src/contexts/messageInputContext/MessageInputContext.md +1 -1
  140. package/src/contexts/messageInputContext/MessageInputContext.tsx +23 -30
  141. package/src/contexts/messageInputContext/hooks/useMessageDetailsForState.ts +17 -1
  142. package/src/contexts/messageOverlayContext/MessageOverlayContext.tsx +6 -6
  143. package/src/contexts/messagesContext/MessagesContext.md +1 -1
  144. package/src/contexts/messagesContext/MessagesContext.tsx +20 -20
  145. package/src/contexts/overlayContext/OverlayContext.md +1 -1
  146. package/src/contexts/paginatedMessageListContext/PaginatedMessageListContext.md +1 -1
  147. package/src/contexts/suggestionsContext/SuggestionsContext.md +1 -1
  148. package/src/contexts/themeContext/utils/theme.ts +3 -1
  149. package/src/contexts/typingContext/TypingContext.md +1 -1
  150. package/src/icons/Recorder.tsx +16 -0
  151. package/src/icons/Video.tsx +37 -0
  152. package/src/icons/index.ts +2 -0
  153. package/src/native.ts +4 -14
  154. package/src/types/types.ts +27 -0
  155. package/src/version.json +1 -1
@@ -44,22 +44,22 @@ export declare type MessageContentType = 'attachments' | 'files' | 'gallery' | '
44
44
  export declare type MessagesContextValue<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = {
45
45
  /**
46
46
  * UI component for Attachment.
47
- * Defaults to: [Attachment](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/Attachment/Attachment.tsx)
47
+ * Defaults to: [Attachment](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Attachment/Attachment.tsx)
48
48
  */
49
49
  Attachment: React.ComponentType<AttachmentProps<StreamChatGenerics>>;
50
50
  /**
51
51
  * UI component to display AttachmentActions. e.g., send, shuffle, cancel in case of giphy
52
- * Defaults to: [AttachmentActions](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/Attachment/AttachmentActions.tsx)
52
+ * Defaults to: [AttachmentActions](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Attachment/AttachmentActions.tsx)
53
53
  */
54
54
  AttachmentActions: React.ComponentType<AttachmentActionsProps<StreamChatGenerics>>;
55
55
  /**
56
56
  * UI component to display generic media type e.g. giphy, url preview etc
57
- * Defaults to: [Card](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/Attachment/Card.tsx)
57
+ * Defaults to: [Card](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Attachment/Card.tsx)
58
58
  */
59
59
  Card: React.ComponentType<CardProps<StreamChatGenerics>>;
60
60
  /**
61
61
  * UI component for DateHeader
62
- * Defaults to: [DateHeader](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/MessageList/DateHeader.tsx)
62
+ * Defaults to: [DateHeader](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/MessageList/DateHeader.tsx)
63
63
  **/
64
64
  DateHeader: React.ComponentType<DateHeaderProps>;
65
65
  /** Should keyboard be dismissed when messaged is touched */
@@ -67,28 +67,28 @@ export declare type MessagesContextValue<StreamChatGenerics extends DefaultStrea
67
67
  enableMessageGroupingByUser: boolean;
68
68
  /**
69
69
  * UI component to display File type attachment.
70
- * Defaults to: [FileAttachment](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/Attachment/FileAttachment.tsx)
70
+ * Defaults to: [FileAttachment](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Attachment/FileAttachment.tsx)
71
71
  */
72
72
  FileAttachment: React.ComponentType<FileAttachmentProps<StreamChatGenerics>>;
73
73
  /**
74
74
  * UI component to display group of File type attachments or multiple file attachments (in single message).
75
- * Defaults to: [FileAttachmentGroup](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/Attachment/FileAttachmentGroup.tsx)
75
+ * Defaults to: [FileAttachmentGroup](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Attachment/FileAttachmentGroup.tsx)
76
76
  */
77
77
  FileAttachmentGroup: React.ComponentType<FileAttachmentGroupProps<StreamChatGenerics>>;
78
78
  /**
79
79
  * UI component for attachment icon for type 'file' attachment.
80
- * Defaults to: https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/Attachment/FileIcon.tsx
80
+ * Defaults to: https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Attachment/FileIcon.tsx
81
81
  */
82
82
  FileAttachmentIcon: React.ComponentType<FileIconProps>;
83
83
  FlatList: typeof FlatList;
84
84
  /**
85
85
  * UI component to display image attachments
86
- * Defaults to: [Gallery](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/Attachment/Gallery.tsx)
86
+ * Defaults to: [Gallery](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Attachment/Gallery.tsx)
87
87
  */
88
88
  Gallery: React.ComponentType<GalleryProps<StreamChatGenerics>>;
89
89
  /**
90
90
  * UI component for Giphy
91
- * Defaults to: [Giphy](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/Attachment/Giphy.tsx)
91
+ * Defaults to: [Giphy](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Attachment/Giphy.tsx)
92
92
  */
93
93
  Giphy: React.ComponentType<GiphyProps<StreamChatGenerics>>;
94
94
  /**
@@ -101,30 +101,30 @@ export declare type MessagesContextValue<StreamChatGenerics extends DefaultStrea
101
101
  initialScrollToFirstUnreadMessage: boolean;
102
102
  /**
103
103
  * UI component for Message Date Separator Component
104
- * Defaults to: [InlineDateSeparator](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/MessageList/InlineDateSeparator.tsx)
104
+ * Defaults to: [InlineDateSeparator](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/MessageList/InlineDateSeparator.tsx)
105
105
  */
106
106
  InlineDateSeparator: React.ComponentType<InlineDateSeparatorProps>;
107
107
  /**
108
108
  * UI component for InlineUnreadIndicator
109
- * Defaults to: [InlineUnreadIndicator](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/Message/MessageSimple/InlineUnreadIndicator.tsx)
109
+ * Defaults to: [InlineUnreadIndicator](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Message/MessageSimple/InlineUnreadIndicator.tsx)
110
110
  **/
111
111
  InlineUnreadIndicator: React.ComponentType;
112
112
  Message: React.ComponentType<MessageProps<StreamChatGenerics>>;
113
113
  /**
114
114
  * UI component for MessageAvatar
115
- * Defaults to: [MessageAvatar](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/Message/MessageSimple/MessageAvatar.tsx)
115
+ * Defaults to: [MessageAvatar](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Message/MessageSimple/MessageAvatar.tsx)
116
116
  **/
117
117
  MessageAvatar: React.ComponentType<MessageAvatarProps<StreamChatGenerics>>;
118
118
  /**
119
119
  * UI component for MessageContent
120
- * Defaults to: [MessageContent](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/Message/MessageSimple/MessageContent.tsx)
120
+ * Defaults to: [MessageContent](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Message/MessageSimple/MessageContent.tsx)
121
121
  */
122
122
  MessageContent: React.ComponentType<MessageContentProps<StreamChatGenerics>>;
123
123
  /** Order to render the message content */
124
124
  messageContentOrder: MessageContentType[];
125
125
  /**
126
126
  * UI component for MessageDeleted
127
- * Defaults to: [MessageDeleted](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/MessageSimple/MessageDeleted.tsx)
127
+ * Defaults to: [MessageDeleted](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/MessageSimple/MessageDeleted.tsx)
128
128
  */
129
129
  MessageDeleted: React.ComponentType<MessageDeletedProps<StreamChatGenerics>>;
130
130
  /**
@@ -138,22 +138,22 @@ export declare type MessagesContextValue<StreamChatGenerics extends DefaultStrea
138
138
  MessagePinnedHeader: React.ComponentType<MessagePinnedHeaderProps<StreamChatGenerics>>;
139
139
  /**
140
140
  * UI component for MessageReplies
141
- * Defaults to: [MessageReplies](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/MessageSimple/MessageReplies.tsx)
141
+ * Defaults to: [MessageReplies](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/MessageSimple/MessageReplies.tsx)
142
142
  */
143
143
  MessageReplies: React.ComponentType<MessageRepliesProps<StreamChatGenerics>>;
144
144
  /**
145
145
  * UI Component for MessageRepliesAvatars
146
- * Defaults to: [MessageRepliesAvatars](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/MessageSimple/MessageRepliesAvatars.tsx)
146
+ * Defaults to: [MessageRepliesAvatars](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/MessageSimple/MessageRepliesAvatars.tsx)
147
147
  */
148
148
  MessageRepliesAvatars: React.ComponentType<MessageRepliesAvatarsProps<StreamChatGenerics>>;
149
149
  /**
150
150
  * UI component for MessageSimple
151
- * Defaults to: [MessageSimple](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/Message/MessageSimple/MessageSimple.tsx)
151
+ * Defaults to: [MessageSimple](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Message/MessageSimple/MessageSimple.tsx)
152
152
  */
153
153
  MessageSimple: React.ComponentType<MessageSimpleProps<StreamChatGenerics>>;
154
154
  /**
155
155
  * UI component for MessageStatus (delivered/read)
156
- * Defaults to: [MessageStatus](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/Message/MessageSimple/MessageStatus.tsx)
156
+ * Defaults to: [MessageStatus](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Message/MessageSimple/MessageStatus.tsx)
157
157
  */
158
158
  MessageStatus: React.ComponentType<MessageStatusProps<StreamChatGenerics>>;
159
159
  /**
@@ -167,7 +167,7 @@ export declare type MessagesContextValue<StreamChatGenerics extends DefaultStrea
167
167
  OverlayReactionList: React.ComponentType<OverlayReactionListProps<StreamChatGenerics>>;
168
168
  /**
169
169
  * UI component for ReactionList
170
- * Defaults to: [ReactionList](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/Reaction/ReactionList.tsx)
170
+ * Defaults to: [ReactionList](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Reaction/ReactionList.tsx)
171
171
  */
172
172
  ReactionList: React.ComponentType<ReactionListProps<StreamChatGenerics>>;
173
173
  removeMessage: (message: {
@@ -208,7 +208,7 @@ export declare type MessagesContextValue<StreamChatGenerics extends DefaultStrea
208
208
  }) => void;
209
209
  /**
210
210
  * Custom UI component to display enriched url preview.
211
- * Defaults to https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/Attachment/Card.tsx
211
+ * Defaults to https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Attachment/Card.tsx
212
212
  */
213
213
  UrlPreview: React.ComponentType<CardProps<StreamChatGenerics>>;
214
214
  /**
@@ -74,6 +74,7 @@ export declare type MarkdownStyle = Partial<{
74
74
  export declare type Theme = {
75
75
  attachmentPicker: {
76
76
  bottomSheetContentContainer: ViewStyle;
77
+ durationText: TextStyle;
77
78
  errorButtonText: TextStyle;
78
79
  errorContainer: ViewStyle;
79
80
  errorText: TextStyle;
@@ -385,7 +386,7 @@ export declare type Theme = {
385
386
  eyeIcon: IconProps;
386
387
  /**
387
388
  * Available options for styling text:
388
- * https://github.com/andangrd/react-native-markdown-package/blob/master/styles.js
389
+ * https://github.com/andangrd/react-native-markdown-package/blob/main/styles.js
389
390
  */
390
391
  markdown: MarkdownStyle;
391
392
  messageUser: TextStyle;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { IconProps } from './utils/base';
3
+ export declare const Recorder: React.FC<IconProps>;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { IconProps } from './utils/base';
3
+ export declare const Video: React.FC<IconProps>;
@@ -68,11 +68,13 @@ export * from './ThumbsUpReaction';
68
68
  export * from './Time';
69
69
  export * from './TXT';
70
70
  export * from './Unknown';
71
+ export * from './Recorder';
71
72
  export * from './Unpin';
72
73
  export * from './User';
73
74
  export * from './UserAdd';
74
75
  export * from './UserDelete';
75
76
  export * from './UserMinus';
77
+ export * from './Video';
76
78
  export * from './Warning';
77
79
  export * from './WutReaction';
78
80
  export * from './XLS';
@@ -1,5 +1,6 @@
1
1
  import { FlatList as DefaultFlatList } from 'react-native';
2
2
  import type { NetInfoSubscription } from '@react-native-community/netinfo';
3
+ import type { Asset, File } from './types/types';
3
4
  declare type CompressImage = ({ compressImageQuality, height, uri, width, }: {
4
5
  compressImageQuality: number;
5
6
  height: number;
@@ -11,15 +12,8 @@ declare type DeleteFile = ({ uri }: {
11
12
  uri: string;
12
13
  }) => Promise<boolean> | never;
13
14
  export declare let deleteFile: DeleteFile;
14
- declare type GetLocalAssetUri = (uriOrAssetId: string) => Promise<string> | never;
15
+ declare type GetLocalAssetUri = (uriOrAssetId: string) => never;
15
16
  export declare let getLocalAssetUri: GetLocalAssetUri;
16
- export declare type Asset = {
17
- height: number;
18
- source: 'camera' | 'picker';
19
- uri: string;
20
- width: number;
21
- id?: string;
22
- };
23
17
  declare type GetPhotos = ({ after, first }: {
24
18
  first: number;
25
19
  after?: string;
@@ -41,12 +35,7 @@ declare type PickDocument = ({ maxNumberOfFiles }: {
41
35
  maxNumberOfFiles?: number;
42
36
  }) => Promise<{
43
37
  cancelled: boolean;
44
- docs?: {
45
- name: string;
46
- size?: number | string;
47
- type?: string;
48
- uri?: string;
49
- }[];
38
+ docs?: File[];
50
39
  }> | never;
51
40
  export declare let pickDocument: PickDocument;
52
41
  declare type SaveFileOptions = {
@@ -1,4 +1,28 @@
1
1
  import type { ExtendableGenerics, LiteralStringForUnion } from 'stream-chat';
2
+ export declare type Asset = {
3
+ duration: number | null;
4
+ filename: string;
5
+ fileSize: string;
6
+ height: number;
7
+ playableDuration: number | null;
8
+ source: 'camera' | 'picker';
9
+ type: string;
10
+ uri: string;
11
+ width: number;
12
+ id?: string;
13
+ size?: number | string;
14
+ };
15
+ export declare type File = {
16
+ name: string;
17
+ duration?: string | null;
18
+ size?: number | string;
19
+ type?: string;
20
+ uri?: string;
21
+ };
22
+ export declare type DefaultAttachmentType = UnknownType & {
23
+ file_size?: number | string;
24
+ mime_type?: string;
25
+ };
2
26
  interface DefaultUserType extends UnknownType {
3
27
  image?: string;
4
28
  }
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": "4.5.1-beta.1",
4
+ "version": "4.6.1-beta.1",
5
5
  "author": {
6
6
  "company": "Stream.io Inc",
7
7
  "name": "Stream.io Inc"
@@ -19,6 +19,7 @@ import { SEVEN_Z } from '../../icons/SEVEN_Z';
19
19
  import { TAR } from '../../icons/TAR';
20
20
  import { TXT } from '../../icons/TXT';
21
21
  import type { IconProps } from '../../icons/utils/base';
22
+ import { Video } from '../../icons/Video';
22
23
  import { XLS } from '../../icons/XLS';
23
24
  import { XLSX } from '../../icons/XLSX';
24
25
  import { ZIP } from '../../icons/ZIP';
@@ -320,6 +321,46 @@ const zipFileTypes = [
320
321
  'application/zip',
321
322
  ];
322
323
 
324
+ const videoFileTypes = [
325
+ 'video/3g2',
326
+ 'video/3gp',
327
+ 'video/aaf',
328
+ 'video/asf',
329
+ 'video/avchd',
330
+ 'video/avi',
331
+ 'video/drc',
332
+ 'video/flv',
333
+ 'video/m2v',
334
+ 'video/m3u8',
335
+ 'video/m4p',
336
+ 'video/m4v',
337
+ 'video/mkv',
338
+ 'video/mng',
339
+ 'video/mov',
340
+ 'video/mp2',
341
+ 'video/mp4',
342
+ 'video/mpe',
343
+ 'video/mpeg',
344
+ 'video/mpg',
345
+ 'video/mpv',
346
+ 'video/mxf',
347
+ 'video/nsv',
348
+ 'video/ogg',
349
+ 'video/ogv',
350
+ 'video/qt',
351
+ 'video/rm',
352
+ 'video/rmvb',
353
+ 'video/roq',
354
+ 'video/svi',
355
+ 'video/vob',
356
+ 'video/webm',
357
+ 'video/wmv',
358
+ 'video/yuv',
359
+ 'video/quicktime',
360
+ 'video/webm',
361
+ 'video/x-flv',
362
+ ];
363
+
323
364
  const mimeTypeToIconMap: Record<string, React.FC<IconProps>> = {
324
365
  'application/pdf': PDF, // .pdf
325
366
  'application/rtf': RTF, // .rtf
@@ -371,6 +412,10 @@ for (const type of zipFileTypes) {
371
412
  mimeTypeToIconMap[type] = ZIP;
372
413
  }
373
414
 
415
+ for (const type of videoFileTypes) {
416
+ mimeTypeToIconMap[type] = Video;
417
+ }
418
+
374
419
  function mimeTypeToIcon(mimeType?: string): React.FC<IconProps> {
375
420
  if (!mimeType) return GenericFile;
376
421
 
@@ -7,6 +7,7 @@ import {
7
7
  Platform,
8
8
  StatusBar,
9
9
  StyleSheet,
10
+ Text,
10
11
  View,
11
12
  } from 'react-native';
12
13
 
@@ -15,42 +16,161 @@ import BottomSheet, {
15
16
  BottomSheetHandleProps,
16
17
  TouchableOpacity,
17
18
  } from '@gorhom/bottom-sheet';
19
+ import dayjs from 'dayjs';
20
+ import duration from 'dayjs/plugin/duration';
21
+ import { lookup } from 'mime-types';
18
22
 
19
23
  import type { AttachmentPickerErrorProps } from './components/AttachmentPickerError';
20
24
 
21
25
  import { useAttachmentPickerContext } from '../../contexts/attachmentPickerContext/AttachmentPickerContext';
22
26
  import { useTheme } from '../../contexts/themeContext/ThemeContext';
23
- import { Asset, getPhotos } from '../../native';
27
+ import { Recorder } from '../../icons';
28
+ import { getPhotos } from '../../native';
29
+ import type { Asset, File } from '../../types/types';
24
30
  import { vh, vw } from '../../utils/utils';
25
31
 
32
+ dayjs.extend(duration);
33
+
26
34
  const styles = StyleSheet.create({
27
35
  container: {
28
36
  flexGrow: 1,
29
37
  },
38
+ durationText: {
39
+ fontWeight: 'bold',
40
+ },
30
41
  overlay: {
31
42
  alignItems: 'flex-end',
32
43
  flex: 1,
33
44
  },
45
+ videoView: {
46
+ bottom: 5,
47
+ display: 'flex',
48
+ flexDirection: 'row',
49
+ justifyContent: 'space-between',
50
+ paddingHorizontal: 5,
51
+ position: 'absolute',
52
+ width: '100%',
53
+ },
34
54
  });
35
55
 
36
56
  const screenHeight = vh(100);
37
57
  const fullScreenHeight = Dimensions.get('window').height;
38
58
 
39
59
  type AttachmentImageProps = {
60
+ asset: Asset;
61
+ ImageOverlaySelectedComponent: React.ComponentType;
62
+ maxNumberOfFiles: number;
63
+ selected: boolean;
64
+ setSelectedImages: React.Dispatch<React.SetStateAction<Asset[]>>;
65
+ numberOfAttachmentPickerImageColumns?: number;
66
+ };
67
+
68
+ type AttachmentVideoProps = {
69
+ asset: Asset;
40
70
  ImageOverlaySelectedComponent: React.ComponentType;
41
- onPress: () => void;
71
+ maxNumberOfFiles: number;
42
72
  selected: boolean;
43
- uri: string;
73
+ setSelectedFiles: React.Dispatch<React.SetStateAction<File[]>>;
44
74
  numberOfAttachmentPickerImageColumns?: number;
45
75
  };
46
76
 
77
+ const AttachmentVideo: React.FC<AttachmentVideoProps> = (props) => {
78
+ const {
79
+ asset,
80
+ ImageOverlaySelectedComponent,
81
+ maxNumberOfFiles,
82
+ numberOfAttachmentPickerImageColumns,
83
+ selected,
84
+ setSelectedFiles,
85
+ } = props;
86
+
87
+ const {
88
+ theme: {
89
+ attachmentPicker: { durationText, image, imageOverlay },
90
+ colors: { overlay, white },
91
+ },
92
+ } = useTheme();
93
+
94
+ const { duration, playableDuration, uri } = asset;
95
+
96
+ const videoDuration = duration ? duration : playableDuration;
97
+
98
+ const ONE_HOUR_IN_SECONDS = 3600;
99
+
100
+ let durationLabel = '00:00';
101
+
102
+ if (videoDuration) {
103
+ const isDurationLongerThanHour = videoDuration / ONE_HOUR_IN_SECONDS >= 1;
104
+ const formattedDurationParam = isDurationLongerThanHour ? 'HH:mm:ss' : 'mm:ss';
105
+ const formattedVideoDuration = dayjs
106
+ .duration(videoDuration, 'second')
107
+ .format(formattedDurationParam);
108
+ durationLabel = formattedVideoDuration;
109
+ }
110
+
111
+ const size = vw(100) / (numberOfAttachmentPickerImageColumns || 3) - 2;
112
+
113
+ const onPressVideo = () => {
114
+ if (selected) {
115
+ setSelectedFiles((files) => files.filter((file) => file.uri !== asset.uri));
116
+ } else {
117
+ setSelectedFiles((files) => {
118
+ if (files.length >= maxNumberOfFiles) {
119
+ return files;
120
+ }
121
+ return [
122
+ ...files,
123
+ {
124
+ duration: durationLabel,
125
+ name: asset.filename,
126
+ size: asset.fileSize,
127
+ type: 'video',
128
+ uri: asset.uri,
129
+ },
130
+ ];
131
+ });
132
+ }
133
+ };
134
+
135
+ return (
136
+ <TouchableOpacity onPress={onPressVideo}>
137
+ <ImageBackground
138
+ source={{ uri }}
139
+ style={[
140
+ {
141
+ height: size,
142
+ margin: 1,
143
+ width: size,
144
+ },
145
+ image,
146
+ ]}
147
+ >
148
+ {selected && (
149
+ <View style={[styles.overlay, { backgroundColor: overlay }, imageOverlay]}>
150
+ <ImageOverlaySelectedComponent />
151
+ </View>
152
+ )}
153
+ <View style={styles.videoView}>
154
+ <Recorder height={20} pathFill={white} width={25} />
155
+ {videoDuration ? (
156
+ <Text style={[styles.durationText, durationText, { color: white }]}>
157
+ {durationLabel}
158
+ </Text>
159
+ ) : null}
160
+ </View>
161
+ </ImageBackground>
162
+ </TouchableOpacity>
163
+ );
164
+ };
165
+
47
166
  const AttachmentImage: React.FC<AttachmentImageProps> = (props) => {
48
167
  const {
168
+ asset,
49
169
  ImageOverlaySelectedComponent,
170
+ maxNumberOfFiles,
50
171
  numberOfAttachmentPickerImageColumns,
51
- onPress,
52
172
  selected,
53
- uri,
173
+ setSelectedImages,
54
174
  } = props;
55
175
  const {
56
176
  theme: {
@@ -61,8 +181,23 @@ const AttachmentImage: React.FC<AttachmentImageProps> = (props) => {
61
181
 
62
182
  const size = vw(100) / (numberOfAttachmentPickerImageColumns || 3) - 2;
63
183
 
184
+ const { uri } = asset;
185
+
186
+ const onPressImage = () => {
187
+ if (selected) {
188
+ setSelectedImages((images) => images.filter((image) => image.uri !== asset.uri));
189
+ } else {
190
+ setSelectedImages((images) => {
191
+ if (images.length >= maxNumberOfFiles) {
192
+ return images;
193
+ }
194
+ return [...images, asset];
195
+ });
196
+ }
197
+ };
198
+
64
199
  return (
65
- <TouchableOpacity onPress={onPress}>
200
+ <TouchableOpacity onPress={onPressImage}>
66
201
  <ImageBackground
67
202
  source={{ uri }}
68
203
  style={[
@@ -92,6 +227,7 @@ const renderImage = ({
92
227
  ImageOverlaySelectedComponent: React.ComponentType;
93
228
  maxNumberOfFiles: number;
94
229
  selected: boolean;
230
+ setSelectedFiles: React.Dispatch<React.SetStateAction<File[]>>;
95
231
  setSelectedImages: React.Dispatch<React.SetStateAction<Asset[]>>;
96
232
  numberOfAttachmentPickerImageColumns?: number;
97
233
  };
@@ -102,55 +238,64 @@ const renderImage = ({
102
238
  maxNumberOfFiles,
103
239
  numberOfAttachmentPickerImageColumns,
104
240
  selected,
241
+ setSelectedFiles,
105
242
  setSelectedImages,
106
243
  } = item;
107
- const onPress = () => {
108
- if (selected) {
109
- setSelectedImages((images) => images.filter((image) => image.uri !== asset.uri));
110
- } else {
111
- setSelectedImages((images) => {
112
- if (images.length >= maxNumberOfFiles) {
113
- return images;
114
- }
115
- return [...images, asset];
116
- });
117
- }
118
- };
119
244
 
120
- return (
245
+ const contentType = lookup(asset.filename) || 'multipart/form-data';
246
+
247
+ const fileType = asset.filename
248
+ ? contentType.startsWith('image/')
249
+ ? 'image'
250
+ : 'video'
251
+ : asset.type === 'video'
252
+ ? 'video'
253
+ : 'image';
254
+
255
+ return fileType === 'image' ? (
121
256
  <AttachmentImage
257
+ asset={asset}
258
+ ImageOverlaySelectedComponent={ImageOverlaySelectedComponent}
259
+ maxNumberOfFiles={maxNumberOfFiles}
260
+ numberOfAttachmentPickerImageColumns={numberOfAttachmentPickerImageColumns}
261
+ selected={selected}
262
+ setSelectedImages={setSelectedImages}
263
+ />
264
+ ) : (
265
+ <AttachmentVideo
266
+ asset={asset}
122
267
  ImageOverlaySelectedComponent={ImageOverlaySelectedComponent}
268
+ maxNumberOfFiles={maxNumberOfFiles}
123
269
  numberOfAttachmentPickerImageColumns={numberOfAttachmentPickerImageColumns}
124
- onPress={onPress}
125
270
  selected={selected}
126
- uri={asset.uri}
271
+ setSelectedFiles={setSelectedFiles}
127
272
  />
128
273
  );
129
274
  };
130
275
 
131
276
  export type AttachmentPickerProps = {
132
277
  /**
133
- * Custom UI component to render [draggable handle](https://github.com/GetStream/stream-chat-react-native/blob/master/screenshots/docs/1.png) of attachment picker.
278
+ * Custom UI component to render [draggable handle](https://github.com/GetStream/stream-chat-react-native/blob/main/screenshots/docs/1.png) of attachment picker.
134
279
  *
135
- * **Default** [AttachmentPickerBottomSheetHandle](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/AttachmentPicker/components/AttachmentPickerBottomSheetHandle.tsx)
280
+ * **Default** [AttachmentPickerBottomSheetHandle](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/AttachmentPicker/components/AttachmentPickerBottomSheetHandle.tsx)
136
281
  */
137
282
  AttachmentPickerBottomSheetHandle: React.FC<BottomSheetHandleProps>;
138
283
  /**
139
284
  * Custom UI component to render error component while opening attachment picker.
140
285
  *
141
- * **Default** [AttachmentPickerError](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/AttachmentPicker/components/AttachmentPickerError.tsx)
286
+ * **Default** [AttachmentPickerError](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/AttachmentPicker/components/AttachmentPickerError.tsx)
142
287
  */
143
288
  AttachmentPickerError: React.ComponentType<AttachmentPickerErrorProps>;
144
289
  /**
145
290
  * Custom UI component to render error image for attachment picker
146
291
  *
147
- * **Default** [AttachmentPickerErrorImage](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/AttachmentPicker/components/AttachmentPickerErrorImage.tsx)
292
+ * **Default** [AttachmentPickerErrorImage](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/AttachmentPicker/components/AttachmentPickerErrorImage.tsx)
148
293
  */
149
294
  AttachmentPickerErrorImage: React.ComponentType;
150
295
  /**
151
- * Custom UI component to render overlay component, that shows up on top of [selected image](https://github.com/GetStream/stream-chat-react-native/blob/master/screenshots/docs/1.png) (with tick mark)
296
+ * 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)
152
297
  *
153
- * **Default** [ImageOverlaySelectedComponent](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/AttachmentPicker/components/ImageOverlaySelectedComponent.tsx)
298
+ * **Default** [ImageOverlaySelectedComponent](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/AttachmentPicker/components/ImageOverlaySelectedComponent.tsx)
154
299
  */
155
300
  ImageOverlaySelectedComponent: React.ComponentType;
156
301
  attachmentPickerBottomSheetHandleHeight?: number;
@@ -187,8 +332,10 @@ export const AttachmentPicker = React.forwardRef(
187
332
  const {
188
333
  closePicker,
189
334
  maxNumberOfFiles,
335
+ selectedFiles,
190
336
  selectedImages,
191
337
  selectedPicker,
338
+ setSelectedFiles,
192
339
  setSelectedImages,
193
340
  setSelectedPicker,
194
341
  topInset,
@@ -306,7 +453,10 @@ export const AttachmentPicker = React.forwardRef(
306
453
  ImageOverlaySelectedComponent,
307
454
  maxNumberOfFiles,
308
455
  numberOfAttachmentPickerImageColumns,
309
- selected: selectedImages.some((image) => image.uri === asset.uri),
456
+ selected:
457
+ selectedImages.some((image) => image.uri === asset.uri) ||
458
+ selectedFiles.some((file) => file.uri === asset.uri),
459
+ setSelectedFiles,
310
460
  setSelectedImages,
311
461
  }));
312
462
 
@@ -304,7 +304,7 @@ export type ChannelPropsWithContext<
304
304
  /**
305
305
  * When true, disables the KeyboardCompatibleView wrapper
306
306
  *
307
- * Channel internally uses the [KeyboardCompatibleView](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/KeyboardCompatibleView/KeyboardCompatibleView.tsx)
307
+ * Channel internally uses the [KeyboardCompatibleView](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/KeyboardCompatibleView/KeyboardCompatibleView.tsx)
308
308
  * component to adjust the height of Channel when the keyboard is opened or dismissed. This prop provides the ability to disable this functionality in case you
309
309
  * want to use [KeyboardAvoidingView](https://facebook.github.io/react-native/docs/keyboardavoidingview) or handle dismissal yourself.
310
310
  * KeyboardAvoidingView works well when your component occupies 100% of screen height, otherwise it may raise some issues.
@@ -345,7 +345,7 @@ export type ChannelPropsWithContext<
345
345
  keyboardBehavior?: KeyboardAvoidingViewProps['behavior'];
346
346
  /**
347
347
  * Custom wrapper component that handles height adjustment of Channel component when keyboard is opened or dismissed
348
- * Default component (accepts the same props): [KeyboardCompatibleView](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/KeyboardCompatibleView/KeyboardCompatibleView.tsx)
348
+ * Default component (accepts the same props): [KeyboardCompatibleView](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/KeyboardCompatibleView/KeyboardCompatibleView.tsx)
349
349
  *
350
350
  * **Example:**
351
351
  *