stream-chat-react-native-core 4.12.0-beta.4 → 4.12.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.
- package/lib/commonjs/components/Attachment/AudioAttachment.js +27 -56
- package/lib/commonjs/components/Attachment/AudioAttachment.js.map +1 -1
- package/lib/commonjs/components/Attachment/FileAttachmentGroup.js +31 -14
- package/lib/commonjs/components/Attachment/FileAttachmentGroup.js.map +1 -1
- package/lib/commonjs/components/Channel/Channel.js +14 -14
- package/lib/commonjs/components/Channel/Channel.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js +0 -2
- package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useCreateMessagesContext.js +2 -0
- package/lib/commonjs/components/Channel/hooks/useCreateMessagesContext.js.map +1 -1
- package/lib/commonjs/components/MessageInput/FileUploadPreview.js +31 -16
- package/lib/commonjs/components/MessageInput/FileUploadPreview.js.map +1 -1
- package/lib/commonjs/components/MessageOverlay/MessageOverlay.js +10 -9
- package/lib/commonjs/components/MessageOverlay/MessageOverlay.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js +2 -2
- package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +0 -2
- package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
- package/lib/commonjs/contexts/messagesContext/MessagesContext.js +2 -2
- package/lib/commonjs/contexts/messagesContext/MessagesContext.js.map +1 -1
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/Attachment/AudioAttachment.js +27 -56
- package/lib/module/components/Attachment/AudioAttachment.js.map +1 -1
- package/lib/module/components/Attachment/FileAttachmentGroup.js +31 -14
- package/lib/module/components/Attachment/FileAttachmentGroup.js.map +1 -1
- package/lib/module/components/Channel/Channel.js +14 -14
- package/lib/module/components/Channel/Channel.js.map +1 -1
- package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js +0 -2
- package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
- package/lib/module/components/Channel/hooks/useCreateMessagesContext.js +2 -0
- package/lib/module/components/Channel/hooks/useCreateMessagesContext.js.map +1 -1
- package/lib/module/components/MessageInput/FileUploadPreview.js +31 -16
- package/lib/module/components/MessageInput/FileUploadPreview.js.map +1 -1
- package/lib/module/components/MessageOverlay/MessageOverlay.js +10 -9
- package/lib/module/components/MessageOverlay/MessageOverlay.js.map +1 -1
- package/lib/module/contexts/messageInputContext/MessageInputContext.js +2 -2
- package/lib/module/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +0 -2
- package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
- package/lib/module/contexts/messagesContext/MessagesContext.js +2 -2
- package/lib/module/contexts/messagesContext/MessagesContext.js.map +1 -1
- package/lib/module/version.json +1 -1
- package/lib/typescript/components/Attachment/AudioAttachment.d.ts +4 -7
- package/lib/typescript/components/Attachment/FileAttachmentGroup.d.ts +1 -2
- package/lib/typescript/components/Channel/Channel.d.ts +1 -1
- package/lib/typescript/components/Channel/hooks/useCreateInputMessageInputContext.d.ts +1 -1
- package/lib/typescript/components/Channel/hooks/useCreateMessagesContext.d.ts +1 -1
- package/lib/typescript/components/MessageInput/FileUploadPreview.d.ts +1 -1
- package/lib/typescript/contexts/messageContext/MessageContext.d.ts +1 -1
- package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts +1 -4
- package/lib/typescript/contexts/messageInputContext/hooks/useCreateMessageInputContext.d.ts +1 -1
- package/lib/typescript/contexts/messagesContext/MessagesContext.d.ts +3 -0
- package/package.json +1 -1
- package/src/components/Attachment/AudioAttachment.tsx +72 -116
- package/src/components/Attachment/FileAttachmentGroup.tsx +32 -11
- package/src/components/Channel/Channel.tsx +2 -1
- package/src/components/Channel/hooks/useCreateInputMessageInputContext.ts +0 -2
- package/src/components/Channel/hooks/useCreateMessagesContext.ts +2 -0
- package/src/components/MessageInput/FileUploadPreview.tsx +29 -12
- package/src/components/MessageInput/__tests__/AudioAttachmentUploadPreviewExpo.test.tsx +13 -3
- package/src/components/MessageInput/__tests__/AudioAttachmentUploadPreviewNative.test.tsx +13 -3
- package/src/components/MessageOverlay/MessageOverlay.tsx +1 -0
- package/src/contexts/messageInputContext/MessageInputContext.tsx +0 -4
- package/src/contexts/messageInputContext/hooks/useCreateMessageInputContext.ts +0 -2
- package/src/contexts/messagesContext/MessagesContext.tsx +3 -0
- package/src/version.json +1 -1
|
@@ -19,8 +19,6 @@ var _Attachment = require("./Attachment");
|
|
|
19
19
|
|
|
20
20
|
var _MessageContext = require("../../contexts/messageContext/MessageContext");
|
|
21
21
|
|
|
22
|
-
var _MessageInputContext = require("../../contexts/messageInputContext/MessageInputContext");
|
|
23
|
-
|
|
24
22
|
var _MessagesContext = require("../../contexts/messagesContext/MessagesContext");
|
|
25
23
|
|
|
26
24
|
var _ThemeContext = require("../../contexts/themeContext/ThemeContext");
|
|
@@ -34,9 +32,20 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
34
32
|
|
|
35
33
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
36
34
|
|
|
35
|
+
var FILE_PREVIEW_HEIGHT = 60;
|
|
36
|
+
|
|
37
37
|
var styles = _reactNative.StyleSheet.create({
|
|
38
38
|
container: {
|
|
39
39
|
padding: 4
|
|
40
|
+
},
|
|
41
|
+
fileContainer: {
|
|
42
|
+
borderRadius: 12,
|
|
43
|
+
borderWidth: 1,
|
|
44
|
+
flexDirection: 'row',
|
|
45
|
+
height: FILE_PREVIEW_HEIGHT,
|
|
46
|
+
justifyContent: 'space-between',
|
|
47
|
+
paddingLeft: 8,
|
|
48
|
+
paddingRight: 8
|
|
40
49
|
}
|
|
41
50
|
});
|
|
42
51
|
|
|
@@ -104,14 +113,18 @@ var FileAttachmentGroupWithContext = function FileAttachmentGroupWithContext(pro
|
|
|
104
113
|
};
|
|
105
114
|
|
|
106
115
|
var _useTheme = (0, _ThemeContext.useTheme)(),
|
|
107
|
-
|
|
116
|
+
_useTheme$theme = _useTheme.theme,
|
|
117
|
+
_useTheme$theme$color = _useTheme$theme.colors,
|
|
118
|
+
grey_whisper = _useTheme$theme$color.grey_whisper,
|
|
119
|
+
white = _useTheme$theme$color.white,
|
|
120
|
+
container = _useTheme$theme.messageSimple.fileAttachmentGroup.container;
|
|
108
121
|
|
|
109
122
|
return _react["default"].createElement(_reactNative.View, {
|
|
110
123
|
style: [styles.container, container, stylesProp.container],
|
|
111
124
|
__self: _this,
|
|
112
125
|
__source: {
|
|
113
126
|
fileName: _jsxFileName,
|
|
114
|
-
lineNumber:
|
|
127
|
+
lineNumber: 131,
|
|
115
128
|
columnNumber: 5
|
|
116
129
|
}
|
|
117
130
|
}, filesToDisplay.map(function (file, index) {
|
|
@@ -123,19 +136,25 @@ var FileAttachmentGroupWithContext = function FileAttachmentGroupWithContext(pro
|
|
|
123
136
|
__self: _this,
|
|
124
137
|
__source: {
|
|
125
138
|
fileName: _jsxFileName,
|
|
126
|
-
lineNumber:
|
|
139
|
+
lineNumber: 133,
|
|
127
140
|
columnNumber: 9
|
|
128
141
|
}
|
|
129
142
|
}, file.type === 'audio' && (0, _native.isAudioPackageAvailable)() ? _react["default"].createElement(_reactNative.View, {
|
|
130
143
|
accessibilityLabel: "audio-attachment-preview",
|
|
144
|
+
style: [styles.fileContainer, index === filesToDisplay.length - 1 ? {
|
|
145
|
+
marginBottom: 0
|
|
146
|
+
} : {}, {
|
|
147
|
+
backgroundColor: white,
|
|
148
|
+
borderColor: grey_whisper,
|
|
149
|
+
width: -16
|
|
150
|
+
}],
|
|
131
151
|
__self: _this,
|
|
132
152
|
__source: {
|
|
133
153
|
fileName: _jsxFileName,
|
|
134
|
-
lineNumber:
|
|
154
|
+
lineNumber: 141,
|
|
135
155
|
columnNumber: 13
|
|
136
156
|
}
|
|
137
157
|
}, _react["default"].createElement(AudioAttachment, {
|
|
138
|
-
index: index,
|
|
139
158
|
item: {
|
|
140
159
|
duration: file.duration,
|
|
141
160
|
file: {
|
|
@@ -153,7 +172,7 @@ var FileAttachmentGroupWithContext = function FileAttachmentGroupWithContext(pro
|
|
|
153
172
|
__self: _this,
|
|
154
173
|
__source: {
|
|
155
174
|
fileName: _jsxFileName,
|
|
156
|
-
lineNumber:
|
|
175
|
+
lineNumber: 157,
|
|
157
176
|
columnNumber: 15
|
|
158
177
|
}
|
|
159
178
|
})) : _react["default"].createElement(Attachment, {
|
|
@@ -161,7 +180,7 @@ var FileAttachmentGroupWithContext = function FileAttachmentGroupWithContext(pro
|
|
|
161
180
|
__self: _this,
|
|
162
181
|
__source: {
|
|
163
182
|
fileName: _jsxFileName,
|
|
164
|
-
lineNumber:
|
|
183
|
+
lineNumber: 172,
|
|
165
184
|
columnNumber: 13
|
|
166
185
|
}
|
|
167
186
|
}));
|
|
@@ -185,10 +204,8 @@ var FileAttachmentGroup = function FileAttachmentGroup(props) {
|
|
|
185
204
|
|
|
186
205
|
var _useMessagesContext = (0, _MessagesContext.useMessagesContext)(),
|
|
187
206
|
_useMessagesContext$A = _useMessagesContext.Attachment,
|
|
188
|
-
Attachment = _useMessagesContext$A === void 0 ? _Attachment.Attachment : _useMessagesContext$A
|
|
189
|
-
|
|
190
|
-
var _useMessageInputConte = (0, _MessageInputContext.useMessageInputContext)(),
|
|
191
|
-
AudioAttachment = _useMessageInputConte.AudioAttachment;
|
|
207
|
+
Attachment = _useMessagesContext$A === void 0 ? _Attachment.Attachment : _useMessagesContext$A,
|
|
208
|
+
AudioAttachment = _useMessagesContext.AudioAttachment;
|
|
192
209
|
|
|
193
210
|
var files = propFiles || contextFiles;
|
|
194
211
|
if (!files.length) return null;
|
|
@@ -200,7 +217,7 @@ var FileAttachmentGroup = function FileAttachmentGroup(props) {
|
|
|
200
217
|
__self: _this,
|
|
201
218
|
__source: {
|
|
202
219
|
fileName: _jsxFileName,
|
|
203
|
-
lineNumber:
|
|
220
|
+
lineNumber: 217,
|
|
204
221
|
columnNumber: 5
|
|
205
222
|
}
|
|
206
223
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["FileAttachmentGroup.tsx"],"names":["styles","StyleSheet","create","container","padding","FileAttachmentGroupWithContext","props","Attachment","AudioAttachment","files","messageId","stylesProp","filesToDisplay","setFilesToDisplay","map","file","duration","paused","progress","onLoad","index","prevFilesToDisplay","fileToDisplay","id","toString","onProgress","currentTime","hasEnd","prevFileUploads","fileUpload","onPlayPause","pausedStatus","theme","messageSimple","fileAttachmentGroup","paddingBottom","length","attachmentContainer","type","name","title","uri","asset_url","areEqual","prevProps","nextProps","prevFiles","nextFiles","MemoizedFileAttachmentGroup","React","memo","FileAttachmentGroup","propFiles","contextFiles","AttachmentDefault","displayName"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AAIA;;AAEA;;AAIA;;AAIA;;AAIA;;AACA;;;;;;;;;AAIA,IAAMA,MAAM,GAAGC,wBAAWC,MAAX,CAAkB;AAC/BC,EAAAA,SAAS,EAAE;AACTC,IAAAA,OAAO,EAAE;AADA;AADoB,CAAlB,CAAf;;AA6BA,IAAM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A,MAAesC,SAAf,GAA6BF,SAA7B,CAAQpC,KAAR;AAEA,SAAOqC,SAAS,CAACV,MAAV,KAAqBW,SAAS,CAACX,MAAtC;AACD,CARD;;AAUA,IAAMY,2BAA2B,GAAGC,kBAAMC,IAAN,CAClC7C,8BADkC,EAElCsC,QAFkC,CAApC;;AAUO,IAAMQ,mBAAmB,GAAG,SAAtBA,mBAAsB,CAGjC7C,KAHiC,EAI9B;AACH,MAAe8C,SAAf,GAAwC9C,KAAxC,CAAQG,KAAR;AAAA,MAA0BC,SAA1B,GAAwCJ,KAAxC,CAA0BI,SAA1B;;AAEA,2BAAgC,wCAAhC;AAAA,MAAe2C,YAAf,sBAAQ5C,KAAR;;AAEA,4BAA2C,0CAA3C;AAAA,kDAAQF,UAAR;AAAA,MAAQA,UAAR,sCAAqB+C,sBAArB;;AAEA,8BAA4B,kDAA5B;AAAA,MAAQ9C,eAAR,yBAAQA,eAAR;;AAEA,MAAMC,KAAK,GAAG2C,SAAS,IAAIC,YAA3B;AAEA,MAAI,CAAC5C,KAAK,CAAC2B,MAAX,EAAmB,OAAO,IAAP;AAEnB,SACE,gCAAC,2BAAD;AAEI7B,IAAAA,UAAU,EAAVA,UAFJ;AAGIC,IAAAA,eAAe,EAAfA,eAHJ;AAIIC,IAAAA,KAAK,EAALA,KAJJ;AAKIC,IAAAA,SAAS,EAATA,SALJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IADF;AAUD,CA3BM;;;AA6BPyC,mBAAmB,CAACI,WAApB,GAAkC,yDAAlC","sourcesContent":["import React, { useEffect, useState } from 'react';\nimport { StyleProp, StyleSheet, View, ViewStyle } from 'react-native';\n\nimport type { Attachment } from 'stream-chat';\n\nimport { Attachment as AttachmentDefault } from './Attachment';\n\nimport {\n MessageContextValue,\n useMessageContext,\n} from '../../contexts/messageContext/MessageContext';\nimport {\n MessageInputContextValue,\n useMessageInputContext,\n} from '../../contexts/messageInputContext/MessageInputContext';\nimport {\n MessagesContextValue,\n useMessagesContext,\n} from '../../contexts/messagesContext/MessagesContext';\nimport { useTheme } from '../../contexts/themeContext/ThemeContext';\nimport { isAudioPackageAvailable } from '../../native';\n\nimport type { DefaultStreamChatGenerics } from '../../types/types';\n\nconst styles = StyleSheet.create({\n container: {\n padding: 4,\n },\n});\n\nexport type FileAttachmentGroupPropsWithContext<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = Pick<MessageContextValue<StreamChatGenerics>, 'files'> &\n Pick<MessageInputContextValue<StreamChatGenerics>, 'AudioAttachment'> &\n Pick<MessagesContextValue<StreamChatGenerics>, 'Attachment'> & {\n /**\n * The unique id for the message with file attachments\n */\n messageId: string;\n styles?: Partial<{\n attachmentContainer: StyleProp<ViewStyle>;\n container: StyleProp<ViewStyle>;\n }>;\n };\n\ntype FilesToDisplayType<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = Attachment<StreamChatGenerics> & {\n duration: number;\n paused: boolean;\n progress: number;\n};\n\nconst FileAttachmentGroupWithContext = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n props: FileAttachmentGroupPropsWithContext<StreamChatGenerics>,\n) => {\n const { Attachment, AudioAttachment, files, messageId, styles: stylesProp = {} } = props;\n const [filesToDisplay, setFilesToDisplay] = useState<FilesToDisplayType[]>([]);\n\n useEffect(() => {\n setFilesToDisplay(files.map((file) => ({ ...file, duration: 0, paused: true, progress: 0 })));\n }, [files]);\n\n // Handler triggered when an audio is loaded in the message input. The initial state is defined for the audio here and the duration is set.\n const onLoad = (index: string, duration: number) => {\n setFilesToDisplay((prevFilesToDisplay) =>\n prevFilesToDisplay.map((fileToDisplay, id) => ({\n ...fileToDisplay,\n duration: id.toString() === index ? duration : fileToDisplay.duration,\n })),\n );\n };\n\n // The handler which is triggered when the audio progresses/ the thumb is dragged in the progress control. The progressed duration is set here.\n const onProgress = (index: string, currentTime?: number, hasEnd?: boolean) => {\n setFilesToDisplay((prevFileUploads) =>\n prevFileUploads.map((fileUpload, id) => ({\n ...fileUpload,\n progress:\n id.toString() === index\n ? hasEnd\n ? 1\n : currentTime\n ? currentTime / (fileUpload.duration as number)\n : 0\n : fileUpload.progress,\n })),\n );\n };\n\n // The handler which controls or sets the paused/played state of the audio.\n const onPlayPause = (index: string, pausedStatus?: boolean) => {\n if (pausedStatus === false) {\n // If the status is false we set the audio with the index as playing and the others as paused.\n setFilesToDisplay((prevFileUploads) =>\n prevFileUploads.map((fileUpload, id) => ({\n ...fileUpload,\n paused: id.toString() === index ? false : true,\n })),\n );\n } else {\n // If the status is true we simply set all the audio's paused state as true.\n setFilesToDisplay((prevFileUploads) =>\n prevFileUploads.map((fileUpload) => ({\n ...fileUpload,\n paused: true,\n })),\n );\n }\n };\n\n const {\n theme: {\n messageSimple: {\n fileAttachmentGroup: { container },\n },\n },\n } = useTheme();\n\n return (\n <View style={[styles.container, container, stylesProp.container]}>\n {filesToDisplay.map((file, index) => (\n <View\n key={`${messageId}-${index}`}\n style={[\n { paddingBottom: index !== files.length - 1 ? 4 : 0 },\n stylesProp.attachmentContainer,\n ]}\n >\n {file.type === 'audio' && isAudioPackageAvailable() ? (\n <View accessibilityLabel='audio-attachment-preview'>\n <AudioAttachment\n index={index}\n item={{\n duration: file.duration,\n file: { name: file.title as string, uri: file.asset_url },\n id: index.toString(),\n paused: file.paused,\n progress: file.progress,\n }}\n onLoad={onLoad}\n onPlayPause={onPlayPause}\n onProgress={onProgress}\n testID='audio-attachment-preview'\n />\n </View>\n ) : (\n <Attachment attachment={file} />\n )}\n </View>\n ))}\n </View>\n );\n};\n\nconst areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(\n prevProps: FileAttachmentGroupPropsWithContext<StreamChatGenerics>,\n nextProps: FileAttachmentGroupPropsWithContext<StreamChatGenerics>,\n) => {\n const { files: prevFiles } = prevProps;\n const { files: nextFiles } = nextProps;\n\n return prevFiles.length === nextFiles.length;\n};\n\nconst MemoizedFileAttachmentGroup = React.memo(\n FileAttachmentGroupWithContext,\n areEqual,\n) as typeof FileAttachmentGroupWithContext;\n\nexport type FileAttachmentGroupProps<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = Partial<Omit<FileAttachmentGroupPropsWithContext<StreamChatGenerics>, 'messageId'>> &\n Pick<FileAttachmentGroupPropsWithContext<StreamChatGenerics>, 'messageId'>;\n\nexport const FileAttachmentGroup = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n props: FileAttachmentGroupProps<StreamChatGenerics>,\n) => {\n const { files: propFiles, messageId } = props;\n\n const { files: contextFiles } = useMessageContext<StreamChatGenerics>();\n\n const { Attachment = AttachmentDefault } = useMessagesContext<StreamChatGenerics>();\n\n const { AudioAttachment } = useMessageInputContext<StreamChatGenerics>();\n\n const files = propFiles || contextFiles;\n\n if (!files.length) return null;\n\n return (\n <MemoizedFileAttachmentGroup\n {...{\n Attachment,\n AudioAttachment,\n files,\n messageId,\n }}\n />\n );\n};\n\nFileAttachmentGroup.displayName = 'FileAttachmentGroup{messageSimple{fileAttachmentGroup}}';\n"]}
|
|
1
|
+
{"version":3,"sources":["FileAttachmentGroup.tsx"],"names":["FILE_PREVIEW_HEIGHT","styles","StyleSheet","create","container","padding","fileContainer","borderRadius","borderWidth","flexDirection","height","justifyContent","paddingLeft","paddingRight","FileAttachmentGroupWithContext","props","Attachment","AudioAttachment","files","messageId","stylesProp","filesToDisplay","setFilesToDisplay","map","file","duration","paused","progress","onLoad","index","prevFilesToDisplay","fileToDisplay","id","toString","onProgress","currentTime","hasEnd","prevFileUploads","fileUpload","onPlayPause","pausedStatus","theme","colors","grey_whisper","white","messageSimple","fileAttachmentGroup","paddingBottom","length","attachmentContainer","type","marginBottom","backgroundColor","borderColor","width","name","title","uri","asset_url","areEqual","prevProps","nextProps","prevFiles","nextFiles","MemoizedFileAttachmentGroup","React","memo","FileAttachmentGroup","propFiles","cont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A1B,GAAwCJ,KAAxC,CAA0BI,SAA1B;;AAEA,2BAAgC,wCAAhC;AAAA,MAAekD,YAAf,sBAAQnD,KAAR;;AAEA,4BACE,0CADF;AAAA,kDAAQF,UAAR;AAAA,MAAQA,UAAR,sCAAqBsD,sBAArB;AAAA,MAAwCrD,eAAxC,uBAAwCA,eAAxC;;AAGA,MAAMC,KAAK,GAAGkD,SAAS,IAAIC,YAA3B;AAEA,MAAI,CAACnD,KAAK,CAAC8B,MAAX,EAAmB,OAAO,IAAP;AAEnB,SACE,gCAAC,2BAAD;AAEIhC,IAAAA,UAAU,EAAVA,UAFJ;AAGIC,IAAAA,eAAe,EAAfA,eAHJ;AAIIC,IAAAA,KAAK,EAALA,KAJJ;AAKIC,IAAAA,SAAS,EAATA,SALJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IADF;AAUD,CA1BM;;;AA4BPgD,mBAAmB,CAACI,WAApB,GAAkC,yDAAlC","sourcesContent":["import React, { useEffect, useState } from 'react';\nimport { StyleProp, StyleSheet, View, ViewStyle } from 'react-native';\n\nimport type { Attachment } from 'stream-chat';\n\nimport { Attachment as AttachmentDefault } from './Attachment';\n\nimport {\n MessageContextValue,\n useMessageContext,\n} from '../../contexts/messageContext/MessageContext';\n\nimport {\n MessagesContextValue,\n useMessagesContext,\n} from '../../contexts/messagesContext/MessagesContext';\nimport { useTheme } from '../../contexts/themeContext/ThemeContext';\nimport { isAudioPackageAvailable } from '../../native';\n\nimport type { DefaultStreamChatGenerics } from '../../types/types';\n\nconst FILE_PREVIEW_HEIGHT = 60;\n\nconst styles = StyleSheet.create({\n container: {\n padding: 4,\n },\n fileContainer: {\n borderRadius: 12,\n borderWidth: 1,\n flexDirection: 'row',\n height: FILE_PREVIEW_HEIGHT,\n justifyContent: 'space-between',\n paddingLeft: 8,\n paddingRight: 8,\n },\n});\n\nexport type FileAttachmentGroupPropsWithContext<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = Pick<MessageContextValue<StreamChatGenerics>, 'files'> &\n Pick<MessagesContextValue<StreamChatGenerics>, 'Attachment' | 'AudioAttachment'> & {\n /**\n * The unique id for the message with file attachments\n */\n messageId: string;\n styles?: Partial<{\n attachmentContainer: StyleProp<ViewStyle>;\n container: StyleProp<ViewStyle>;\n }>;\n };\n\ntype FilesToDisplayType<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = Attachment<StreamChatGenerics> & {\n duration: number;\n paused: boolean;\n progress: number;\n};\n\nconst FileAttachmentGroupWithContext = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n props: FileAttachmentGroupPropsWithContext<StreamChatGenerics>,\n) => {\n const { Attachment, AudioAttachment, files, messageId, styles: stylesProp = {} } = props;\n const [filesToDisplay, setFilesToDisplay] = useState<FilesToDisplayType[]>([]);\n\n useEffect(() => {\n setFilesToDisplay(files.map((file) => ({ ...file, duration: 0, paused: true, progress: 0 })));\n }, [files]);\n\n // Handler triggered when an audio is loaded in the message input. The initial state is defined for the audio here and the duration is set.\n const onLoad = (index: string, duration: number) => {\n setFilesToDisplay((prevFilesToDisplay) =>\n prevFilesToDisplay.map((fileToDisplay, id) => ({\n ...fileToDisplay,\n duration: id.toString() === index ? duration : fileToDisplay.duration,\n })),\n );\n };\n\n // The handler which is triggered when the audio progresses/ the thumb is dragged in the progress control. The progressed duration is set here.\n const onProgress = (index: string, currentTime?: number, hasEnd?: boolean) => {\n setFilesToDisplay((prevFileUploads) =>\n prevFileUploads.map((fileUpload, id) => ({\n ...fileUpload,\n progress:\n id.toString() === index\n ? hasEnd\n ? 1\n : currentTime\n ? currentTime / (fileUpload.duration as number)\n : 0\n : fileUpload.progress,\n })),\n );\n };\n\n // The handler which controls or sets the paused/played state of the audio.\n const onPlayPause = (index: string, pausedStatus?: boolean) => {\n if (pausedStatus === false) {\n // If the status is false we set the audio with the index as playing and the others as paused.\n setFilesToDisplay((prevFileUploads) =>\n prevFileUploads.map((fileUpload, id) => ({\n ...fileUpload,\n paused: id.toString() === index ? false : true,\n })),\n );\n } else {\n // If the status is true we simply set all the audio's paused state as true.\n setFilesToDisplay((prevFileUploads) =>\n prevFileUploads.map((fileUpload) => ({\n ...fileUpload,\n paused: true,\n })),\n );\n }\n };\n\n const {\n theme: {\n colors: { grey_whisper, white },\n messageSimple: {\n fileAttachmentGroup: { container },\n },\n },\n } = useTheme();\n\n return (\n <View style={[styles.container, container, stylesProp.container]}>\n {filesToDisplay.map((file, index) => (\n <View\n key={`${messageId}-${index}`}\n style={[\n { paddingBottom: index !== files.length - 1 ? 4 : 0 },\n stylesProp.attachmentContainer,\n ]}\n >\n {file.type === 'audio' && isAudioPackageAvailable() ? (\n <View\n accessibilityLabel='audio-attachment-preview'\n style={[\n styles.fileContainer,\n index === filesToDisplay.length - 1\n ? {\n marginBottom: 0,\n }\n : {},\n {\n backgroundColor: white,\n borderColor: grey_whisper,\n width: -16,\n },\n ]}\n >\n <AudioAttachment\n item={{\n duration: file.duration,\n file: { name: file.title as string, uri: file.asset_url },\n id: index.toString(),\n paused: file.paused,\n progress: file.progress,\n }}\n onLoad={onLoad}\n onPlayPause={onPlayPause}\n onProgress={onProgress}\n testID='audio-attachment-preview'\n />\n </View>\n ) : (\n <Attachment attachment={file} />\n )}\n </View>\n ))}\n </View>\n );\n};\n\nconst areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(\n prevProps: FileAttachmentGroupPropsWithContext<StreamChatGenerics>,\n nextProps: FileAttachmentGroupPropsWithContext<StreamChatGenerics>,\n) => {\n const { files: prevFiles } = prevProps;\n const { files: nextFiles } = nextProps;\n\n return prevFiles.length === nextFiles.length;\n};\n\nconst MemoizedFileAttachmentGroup = React.memo(\n FileAttachmentGroupWithContext,\n areEqual,\n) as typeof FileAttachmentGroupWithContext;\n\nexport type FileAttachmentGroupProps<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = Partial<Omit<FileAttachmentGroupPropsWithContext<StreamChatGenerics>, 'messageId'>> &\n Pick<FileAttachmentGroupPropsWithContext<StreamChatGenerics>, 'messageId'>;\n\nexport const FileAttachmentGroup = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n props: FileAttachmentGroupProps<StreamChatGenerics>,\n) => {\n const { files: propFiles, messageId } = props;\n\n const { files: contextFiles } = useMessageContext<StreamChatGenerics>();\n\n const { Attachment = AttachmentDefault, AudioAttachment } =\n useMessagesContext<StreamChatGenerics>();\n\n const files = propFiles || contextFiles;\n\n if (!files.length) return null;\n\n return (\n <MemoizedFileAttachmentGroup\n {...{\n Attachment,\n AudioAttachment,\n files,\n messageId,\n }}\n />\n );\n};\n\nFileAttachmentGroup.displayName = 'FileAttachmentGroup{messageSimple{fileAttachmentGroup}}';\n"]}
|
|
@@ -1905,7 +1905,6 @@ var ChannelWithContext = function ChannelWithContext(props) {
|
|
|
1905
1905
|
var inputMessageInputContext = (0, _useCreateInputMessageInputContext.useCreateInputMessageInputContext)({
|
|
1906
1906
|
additionalTextInputProps: additionalTextInputProps,
|
|
1907
1907
|
AttachButton: AttachButton,
|
|
1908
|
-
AudioAttachment: AudioAttachment,
|
|
1909
1908
|
autoCompleteSuggestionsLimit: autoCompleteSuggestionsLimit,
|
|
1910
1909
|
autoCompleteTriggerSettings: autoCompleteTriggerSettings,
|
|
1911
1910
|
channelId: channelId,
|
|
@@ -1961,6 +1960,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
|
|
|
1961
1960
|
additionalTouchableProps: additionalTouchableProps,
|
|
1962
1961
|
Attachment: Attachment,
|
|
1963
1962
|
AttachmentActions: AttachmentActions,
|
|
1963
|
+
AudioAttachment: AudioAttachment,
|
|
1964
1964
|
Card: Card,
|
|
1965
1965
|
CardCover: CardCover,
|
|
1966
1966
|
CardFooter: CardFooter,
|
|
@@ -2066,7 +2066,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
|
|
|
2066
2066
|
__self: _this,
|
|
2067
2067
|
__source: {
|
|
2068
2068
|
fileName: _jsxFileName,
|
|
2069
|
-
lineNumber:
|
|
2069
|
+
lineNumber: 1786,
|
|
2070
2070
|
columnNumber: 12
|
|
2071
2071
|
}
|
|
2072
2072
|
});
|
|
@@ -2081,7 +2081,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
|
|
|
2081
2081
|
__self: _this,
|
|
2082
2082
|
__source: {
|
|
2083
2083
|
fileName: _jsxFileName,
|
|
2084
|
-
lineNumber:
|
|
2084
|
+
lineNumber: 1791,
|
|
2085
2085
|
columnNumber: 7
|
|
2086
2086
|
}
|
|
2087
2087
|
}, t('Please select a channel first'));
|
|
@@ -2095,7 +2095,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
|
|
|
2095
2095
|
__self: _this,
|
|
2096
2096
|
__source: {
|
|
2097
2097
|
fileName: _jsxFileName,
|
|
2098
|
-
lineNumber:
|
|
2098
|
+
lineNumber: 1798,
|
|
2099
2099
|
columnNumber: 5
|
|
2100
2100
|
}
|
|
2101
2101
|
}), _react["default"].createElement(_ChannelContext.ChannelProvider, {
|
|
@@ -2103,7 +2103,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
|
|
|
2103
2103
|
__self: _this,
|
|
2104
2104
|
__source: {
|
|
2105
2105
|
fileName: _jsxFileName,
|
|
2106
|
-
lineNumber:
|
|
2106
|
+
lineNumber: 1804,
|
|
2107
2107
|
columnNumber: 7
|
|
2108
2108
|
}
|
|
2109
2109
|
}, _react["default"].createElement(_OwnCapabilitiesContext.OwnCapabilitiesProvider, {
|
|
@@ -2111,7 +2111,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
|
|
|
2111
2111
|
__self: _this,
|
|
2112
2112
|
__source: {
|
|
2113
2113
|
fileName: _jsxFileName,
|
|
2114
|
-
lineNumber:
|
|
2114
|
+
lineNumber: 1805,
|
|
2115
2115
|
columnNumber: 9
|
|
2116
2116
|
}
|
|
2117
2117
|
}, _react["default"].createElement(_TypingContext.TypingProvider, {
|
|
@@ -2119,7 +2119,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
|
|
|
2119
2119
|
__self: _this,
|
|
2120
2120
|
__source: {
|
|
2121
2121
|
fileName: _jsxFileName,
|
|
2122
|
-
lineNumber:
|
|
2122
|
+
lineNumber: 1806,
|
|
2123
2123
|
columnNumber: 11
|
|
2124
2124
|
}
|
|
2125
2125
|
}, _react["default"].createElement(_PaginatedMessageListContext.PaginatedMessageListProvider, {
|
|
@@ -2127,7 +2127,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
|
|
|
2127
2127
|
__self: _this,
|
|
2128
2128
|
__source: {
|
|
2129
2129
|
fileName: _jsxFileName,
|
|
2130
|
-
lineNumber:
|
|
2130
|
+
lineNumber: 1807,
|
|
2131
2131
|
columnNumber: 13
|
|
2132
2132
|
}
|
|
2133
2133
|
}, _react["default"].createElement(_MessagesContext.MessagesProvider, {
|
|
@@ -2135,7 +2135,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
|
|
|
2135
2135
|
__self: _this,
|
|
2136
2136
|
__source: {
|
|
2137
2137
|
fileName: _jsxFileName,
|
|
2138
|
-
lineNumber:
|
|
2138
|
+
lineNumber: 1808,
|
|
2139
2139
|
columnNumber: 15
|
|
2140
2140
|
}
|
|
2141
2141
|
}, _react["default"].createElement(_ThreadContext.ThreadProvider, {
|
|
@@ -2143,7 +2143,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
|
|
|
2143
2143
|
__self: _this,
|
|
2144
2144
|
__source: {
|
|
2145
2145
|
fileName: _jsxFileName,
|
|
2146
|
-
lineNumber:
|
|
2146
|
+
lineNumber: 1809,
|
|
2147
2147
|
columnNumber: 17
|
|
2148
2148
|
}
|
|
2149
2149
|
}, _react["default"].createElement(_SuggestionsContext.SuggestionsProvider, {
|
|
@@ -2151,7 +2151,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
|
|
|
2151
2151
|
__self: _this,
|
|
2152
2152
|
__source: {
|
|
2153
2153
|
fileName: _jsxFileName,
|
|
2154
|
-
lineNumber:
|
|
2154
|
+
lineNumber: 1810,
|
|
2155
2155
|
columnNumber: 19
|
|
2156
2156
|
}
|
|
2157
2157
|
}, _react["default"].createElement(_MessageInputContext.MessageInputProvider, {
|
|
@@ -2159,7 +2159,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
|
|
|
2159
2159
|
__self: _this,
|
|
2160
2160
|
__source: {
|
|
2161
2161
|
fileName: _jsxFileName,
|
|
2162
|
-
lineNumber:
|
|
2162
|
+
lineNumber: 1811,
|
|
2163
2163
|
columnNumber: 21
|
|
2164
2164
|
}
|
|
2165
2165
|
}, _react["default"].createElement(_reactNative.View, {
|
|
@@ -2169,7 +2169,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
|
|
|
2169
2169
|
__self: _this,
|
|
2170
2170
|
__source: {
|
|
2171
2171
|
fileName: _jsxFileName,
|
|
2172
|
-
lineNumber:
|
|
2172
|
+
lineNumber: 1812,
|
|
2173
2173
|
columnNumber: 23
|
|
2174
2174
|
}
|
|
2175
2175
|
}, children))))))))));
|
|
@@ -2224,7 +2224,7 @@ var Channel = function Channel(props) {
|
|
|
2224
2224
|
__self: _this,
|
|
2225
2225
|
__source: {
|
|
2226
2226
|
fileName: _jsxFileName,
|
|
2227
|
-
lineNumber:
|
|
2227
|
+
lineNumber: 1869,
|
|
2228
2228
|
columnNumber: 5
|
|
2229
2229
|
}
|
|
2230
2230
|
}));
|