stream-chat-react-native-core 4.12.0-beta.2 → 4.12.0-beta.5

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 (98) hide show
  1. package/lib/commonjs/components/{MessageInput/AudioAttachmentUploadPreview.js → Attachment/AudioAttachment.js} +38 -64
  2. package/lib/commonjs/components/Attachment/AudioAttachment.js.map +1 -0
  3. package/lib/commonjs/components/Attachment/FileAttachmentGroup.js +132 -12
  4. package/lib/commonjs/components/Attachment/FileAttachmentGroup.js.map +1 -1
  5. package/lib/commonjs/components/Attachment/Gallery.js +22 -18
  6. package/lib/commonjs/components/Attachment/Gallery.js.map +1 -1
  7. package/lib/commonjs/components/Attachment/VideoThumbnail.js +12 -6
  8. package/lib/commonjs/components/Attachment/VideoThumbnail.js.map +1 -1
  9. package/lib/commonjs/components/Channel/Channel.js +18 -18
  10. package/lib/commonjs/components/Channel/Channel.js.map +1 -1
  11. package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js +0 -2
  12. package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
  13. package/lib/commonjs/components/Channel/hooks/useCreateMessagesContext.js +2 -0
  14. package/lib/commonjs/components/Channel/hooks/useCreateMessagesContext.js.map +1 -1
  15. package/lib/commonjs/components/ImageGallery/components/ImageGalleryVideoControl.js +11 -10
  16. package/lib/commonjs/components/ImageGallery/components/ImageGalleryVideoControl.js.map +1 -1
  17. package/lib/commonjs/components/MessageInput/FileUploadPreview.js +38 -44
  18. package/lib/commonjs/components/MessageInput/FileUploadPreview.js.map +1 -1
  19. package/lib/commonjs/components/MessageOverlay/MessageOverlay.js +14 -13
  20. package/lib/commonjs/components/MessageOverlay/MessageOverlay.js.map +1 -1
  21. package/lib/commonjs/components/index.js +13 -13
  22. package/lib/commonjs/components/index.js.map +1 -1
  23. package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js +2 -2
  24. package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js.map +1 -1
  25. package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +0 -2
  26. package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
  27. package/lib/commonjs/contexts/messagesContext/MessagesContext.js +2 -2
  28. package/lib/commonjs/contexts/messagesContext/MessagesContext.js.map +1 -1
  29. package/lib/commonjs/contexts/themeContext/utils/theme.js +2 -2
  30. package/lib/commonjs/contexts/themeContext/utils/theme.js.map +1 -1
  31. package/lib/commonjs/version.json +1 -1
  32. package/lib/module/components/{MessageInput/AudioAttachmentUploadPreview.js → Attachment/AudioAttachment.js} +38 -64
  33. package/lib/module/components/Attachment/AudioAttachment.js.map +1 -0
  34. package/lib/module/components/Attachment/FileAttachmentGroup.js +132 -12
  35. package/lib/module/components/Attachment/FileAttachmentGroup.js.map +1 -1
  36. package/lib/module/components/Attachment/Gallery.js +22 -18
  37. package/lib/module/components/Attachment/Gallery.js.map +1 -1
  38. package/lib/module/components/Attachment/VideoThumbnail.js +12 -6
  39. package/lib/module/components/Attachment/VideoThumbnail.js.map +1 -1
  40. package/lib/module/components/Channel/Channel.js +18 -18
  41. package/lib/module/components/Channel/Channel.js.map +1 -1
  42. package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js +0 -2
  43. package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
  44. package/lib/module/components/Channel/hooks/useCreateMessagesContext.js +2 -0
  45. package/lib/module/components/Channel/hooks/useCreateMessagesContext.js.map +1 -1
  46. package/lib/module/components/ImageGallery/components/ImageGalleryVideoControl.js +11 -10
  47. package/lib/module/components/ImageGallery/components/ImageGalleryVideoControl.js.map +1 -1
  48. package/lib/module/components/MessageInput/FileUploadPreview.js +38 -44
  49. package/lib/module/components/MessageInput/FileUploadPreview.js.map +1 -1
  50. package/lib/module/components/MessageOverlay/MessageOverlay.js +14 -13
  51. package/lib/module/components/MessageOverlay/MessageOverlay.js.map +1 -1
  52. package/lib/module/components/index.js +13 -13
  53. package/lib/module/components/index.js.map +1 -1
  54. package/lib/module/contexts/messageInputContext/MessageInputContext.js +2 -2
  55. package/lib/module/contexts/messageInputContext/MessageInputContext.js.map +1 -1
  56. package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +0 -2
  57. package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
  58. package/lib/module/contexts/messagesContext/MessagesContext.js +2 -2
  59. package/lib/module/contexts/messagesContext/MessagesContext.js.map +1 -1
  60. package/lib/module/contexts/themeContext/utils/theme.js +2 -2
  61. package/lib/module/contexts/themeContext/utils/theme.js.map +1 -1
  62. package/lib/module/version.json +1 -1
  63. package/lib/typescript/components/Attachment/AudioAttachment.d.ts +23 -0
  64. package/lib/typescript/components/Attachment/FileAttachmentGroup.d.ts +1 -1
  65. package/lib/typescript/components/Channel/Channel.d.ts +1 -1
  66. package/lib/typescript/components/Channel/hooks/useCreateInputMessageInputContext.d.ts +1 -1
  67. package/lib/typescript/components/Channel/hooks/useCreateMessagesContext.d.ts +1 -1
  68. package/lib/typescript/components/MessageInput/FileUploadPreview.d.ts +1 -1
  69. package/lib/typescript/components/index.d.ts +1 -1
  70. package/lib/typescript/contexts/messageContext/MessageContext.d.ts +1 -1
  71. package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts +1 -4
  72. package/lib/typescript/contexts/messageInputContext/hooks/useCreateMessageInputContext.d.ts +1 -1
  73. package/lib/typescript/contexts/messagesContext/MessagesContext.d.ts +3 -0
  74. package/lib/typescript/contexts/themeContext/utils/theme.d.ts +2 -2
  75. package/package.json +1 -1
  76. package/src/components/{MessageInput/AudioAttachmentUploadPreview.tsx → Attachment/AudioAttachment.tsx} +82 -131
  77. package/src/components/Attachment/FileAttachmentGroup.tsx +119 -9
  78. package/src/components/Attachment/Gallery.tsx +7 -1
  79. package/src/components/Attachment/VideoThumbnail.tsx +3 -2
  80. package/src/components/Channel/Channel.tsx +4 -3
  81. package/src/components/Channel/hooks/useCreateInputMessageInputContext.ts +0 -2
  82. package/src/components/Channel/hooks/useCreateMessagesContext.ts +2 -0
  83. package/src/components/ImageGallery/components/ImageGalleryVideoControl.tsx +12 -7
  84. package/src/components/Message/MessageSimple/__tests__/MessageContent.test.js +4 -2
  85. package/src/components/MessageInput/FileUploadPreview.tsx +34 -26
  86. package/src/components/MessageInput/__tests__/AudioAttachmentUploadPreviewExpo.test.tsx +15 -8
  87. package/src/components/MessageInput/__tests__/AudioAttachmentUploadPreviewNative.test.tsx +15 -8
  88. package/src/components/MessageInput/__tests__/FileUploadPreview.test.js +5 -5
  89. package/src/components/MessageOverlay/MessageOverlay.tsx +1 -0
  90. package/src/components/index.ts +1 -1
  91. package/src/contexts/messageInputContext/MessageInputContext.tsx +0 -6
  92. package/src/contexts/messageInputContext/hooks/useCreateMessageInputContext.ts +0 -2
  93. package/src/contexts/messagesContext/MessagesContext.tsx +3 -0
  94. package/src/contexts/themeContext/utils/theme.ts +4 -4
  95. package/src/version.json +1 -1
  96. package/lib/commonjs/components/MessageInput/AudioAttachmentUploadPreview.js.map +0 -1
  97. package/lib/module/components/MessageInput/AudioAttachmentUploadPreview.js.map +0 -1
  98. package/lib/typescript/components/MessageInput/AudioAttachmentUploadPreview.d.ts +0 -26
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["AudioAttachment.tsx"],"names":["dayjs","extend","duration","FILE_PREVIEW_HEIGHT","styles","StyleSheet","create","fileContainer","borderRadius","borderWidth","flexDirection","height","paddingLeft","paddingRight","fileContentContainer","filenameText","fontSize","fontWeight","fileTextContainer","justifyContent","flatList","marginBottom","maxHeight","overlay","marginLeft","marginRight","progressControlView","flex","progressDurationText","roundedView","alignItems","alignSelf","display","elevation","shadowOffset","width","shadowOpacity","shadowRadius","AudioAttachmentWithContext","props","soundRef","React","useRef","item","onLoad","onPlayPause","onProgress","handleLoad","payload","id","handleProgress","data","currentTime","seekableDuration","handlePlayPause","isPausedStatusAvailable","current","undefined","progress","seek","setPositionAsync","paused","playAsync","pauseAsync","handleProgressDrag","position","handleEnd","onPlaybackStatusUpdate","playbackStatus","isLoaded","error","console","log","durationMillis","positionMillis","isPlaying","isBuffering","didJustFinish","isLooping","Sound","Player","initiateSound","file","uri","initializeSound","stopAsync","unloadAsync","initalPlayPause","theme","colors","accent_blue","black","grey_dark","static_black","static_white","messageInput","fileUploadPreview","audioAttachment","progressValueInSeconds","progressDuration","format","lastIndexOfDot","name","lastIndexOf","backgroundColor","shadowColor","color","I18nManager","isRTL","writingDirection","slice","AudioAttachment","displayName"],"mappings":";;;;;;;;;;;;;;;AAAA;;AACA;;AAEA;;AACA;;AAEA;;AACA;;AACA;;AAOA;;;;;;;;;AAEAA,kBAAMC,MAAN,CAAaC,oBAAb;;AAEA,IAAMC,mBAAmB,GAAG,EAA5B;;AAEA,IAAMC,MAAM,GAAGC,wBAAWC,MAAX,CAAkB;AAC/BC,EAAAA,aAAa,EAAE;AACbC,IAAAA,YAAY,EAAE,EADD;AAEbC,IAAAA,WAAW,EAAE,CAFA;AAGbC,IAAAA,aAAa,EAAE,KAHF;AAIbC,IAAAA,MAAM,EAAER,mBAJK;AAKbS,IAAAA,WAAW,EAAE,CALA;AAMbC,IAAAA,YAAY,EAAE;AAND,GADgB;AAS/BC,EAAAA,oBAAoB,EAAE;AAAEJ,IAAAA,aAAa,EAAE,KAAjB;AAAwBG,IAAAA,YAAY,EAAE;AAAtC,GATS;AAU/BE,EAAAA,YAAY,EAAE;AACZC,IAAAA,QAAQ,EAAE,EADE;AAEZC,IAAAA,UAAU,EAAE,MAFA;AAGZL,IAAAA,WAAW,EAAE;AAHD,GAViB;AAe/BM,EAAAA,iBAAiB,EAAE;AACjBC,IAAAA,cAAc,EAAE;AADC,GAfY;AAkB/BC,EAAAA,QAAQ,EAAE;AAAEC,IAAAA,YAAY,EAAE,EAAhB;AAAoBC,IAAAA,SAAS,EAAEnB,mBAAmB,GAAG,GAAtB,GAA4B;AAA3D,GAlBqB;AAmB/BoB,EAAA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AAM,EAAC,cANT;AAOE,IAAA,GAAG,EAAEG,IAAI,CAACuC,IAAL,CAAUC,GAPjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IATJ,EAmBE,gCAAC,iBAAD;AAAM,IAAA,KAAK,EAAE,CAAC/E,MAAM,CAACwB,oBAAR,EAA8B;AAAE8E,MAAAA,KAAK,EAAEd;AAAT,KAA9B,EAAoDhE,oBAApD,CAAb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACGuE,gBADH,CAnBF,EAsBE,gCAAC,iBAAD;AAAM,IAAA,KAAK,EAAE,CAAC/F,MAAM,CAACsB,mBAAR,EAA6BA,mBAA7B,CAAb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACE,gCAAC,gCAAD;AACE,IAAA,QAAQ,EAAEiB,IAAI,CAACzC,QADjB;AAEE,IAAA,WAAW,EAAEwF,WAFf;AAGE,IAAA,WAAW,EAAEpC,eAHf;AAIE,IAAA,cAAc,EAAEU,kBAJlB;AAKE,IAAA,QAAQ,EAAErB,IAAI,CAACe,QALjB;AAME,IAAA,MAAM,EAAC,kBANT;AAOE,IAAA,KAAK,EAAE,GAPT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IADF,CAtBF,CApBF,CAhBF,CADF;AA0ED,CAtND;;AAoOO,IAAMqD,eAAe,GAAG,SAAlBA,eAAkB,CAACxE,KAAD;AAAA,SAC7B,gCAAC,0BAAD,gCAAgCA,KAAhC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAD6B;AAAA,CAAxB;;;AAIPwE,eAAe,CAACC,WAAhB,GAA8B,+CAA9B","sourcesContent":["import React, { useEffect } from 'react';\nimport { I18nManager, StyleSheet, Text, TouchableOpacity, View } from 'react-native';\n\nimport dayjs from 'dayjs';\nimport duration from 'dayjs/plugin/duration';\n\nimport { FileUpload, useTheme } from '../../contexts';\nimport { Pause, Play } from '../../icons';\nimport {\n PlaybackStatus,\n Sound,\n SoundReturnType,\n VideoPayloadData,\n VideoProgressData,\n} from '../../native';\nimport { ProgressControl } from '../ProgressControl/ProgressControl';\n\ndayjs.extend(duration);\n\nconst FILE_PREVIEW_HEIGHT = 70;\n\nconst styles = StyleSheet.create({\n fileContainer: {\n borderRadius: 12,\n borderWidth: 1,\n flexDirection: 'row',\n height: FILE_PREVIEW_HEIGHT,\n paddingLeft: 8,\n paddingRight: 8,\n },\n fileContentContainer: { flexDirection: 'row', paddingRight: 40 },\n filenameText: {\n fontSize: 14,\n fontWeight: 'bold',\n paddingLeft: 10,\n },\n fileTextContainer: {\n justifyContent: 'space-around',\n },\n flatList: { marginBottom: 12, maxHeight: FILE_PREVIEW_HEIGHT * 2.5 + 16 },\n overlay: {\n borderRadius: 12,\n marginLeft: 8,\n marginRight: 8,\n },\n progressControlView: {\n flex: 8,\n },\n progressDurationText: {\n flex: 4,\n fontSize: 12,\n paddingLeft: 10,\n paddingRight: 8,\n },\n roundedView: {\n alignItems: 'center',\n alignSelf: 'center',\n borderRadius: 50,\n display: 'flex',\n elevation: 4,\n height: 36,\n justifyContent: 'center',\n shadowOffset: {\n height: 2,\n width: 0,\n },\n shadowOpacity: 0.23,\n shadowRadius: 2.62,\n width: 36,\n },\n});\n\nexport type AudioAttachmentPropsWithContext = {\n item: Omit<FileUpload, 'state'>;\n onLoad: (index: string, duration: number) => void;\n onPlayPause: (index: string, pausedStatus?: boolean) => void;\n onProgress: (index: string, currentTime?: number, hasEnd?: boolean) => void;\n testID?: string;\n};\n\nconst AudioAttachmentWithContext = (props: AudioAttachmentPropsWithContext) => {\n const soundRef = React.useRef<SoundReturnType | null>(null);\n const { item, onLoad, onPlayPause, onProgress } = props;\n\n const handleLoad = (payload: VideoPayloadData) => {\n onLoad(item.id, payload.duration);\n };\n\n const handleProgress = (data: VideoProgressData) => {\n if (data.currentTime && data.seekableDuration) {\n onProgress(item.id, data.currentTime);\n }\n };\n\n const handlePlayPause = async (isPausedStatusAvailable?: boolean) => {\n if (soundRef.current) {\n if (isPausedStatusAvailable === undefined) {\n if (item.progress === 1) {\n // For native CLI\n if (soundRef.current.seek) soundRef.current.seek(0);\n // For expo CLI\n if (soundRef.current.setPositionAsync) soundRef.current.setPositionAsync(0);\n }\n if (item.paused) {\n if (soundRef.current.playAsync) await soundRef.current.playAsync();\n onPlayPause(item.id, false);\n } else {\n if (soundRef.current.pauseAsync) await soundRef.current.pauseAsync();\n onPlayPause(item.id, true);\n }\n } else {\n onPlayPause(item.id, isPausedStatusAvailable);\n }\n }\n };\n\n const handleProgressDrag = async (position: number) => {\n onProgress(item.id, position);\n if (soundRef.current?.seek) soundRef.current.seek(position);\n if (soundRef.current?.setPositionAsync) {\n await soundRef.current.setPositionAsync(position * 1000);\n }\n };\n\n const handleEnd = () => {\n onPlayPause(item.id, true);\n onProgress(item.id, item.duration, true);\n };\n\n const onPlaybackStatusUpdate = (playbackStatus: PlaybackStatus) => {\n if (!playbackStatus.isLoaded) {\n // Update your UI for the unloaded state\n if (playbackStatus.error) {\n console.log(`Encountered a fatal error during playback: ${playbackStatus.error}`);\n }\n } else {\n const { durationMillis, positionMillis } = playbackStatus;\n onLoad(item.id, durationMillis / 1000);\n // Update your UI for the loaded state\n if (playbackStatus.isPlaying) {\n // Update your UI for the playing state\n onProgress(item.id, positionMillis / 1000);\n } else {\n // Update your UI for the paused state\n }\n\n if (playbackStatus.isBuffering) {\n // Update your UI for the buffering state\n }\n\n if (playbackStatus.didJustFinish && !playbackStatus.isLooping) {\n // The player has just finished playing and will stop. Maybe you want to play something else?\n // status: opposite of pause,says i am playing\n handleEnd();\n }\n }\n };\n\n useEffect(() => {\n if (Sound.Player === null) {\n const initiateSound = async () => {\n if (item && item.file && item.file.uri) {\n soundRef.current = await Sound.initializeSound(\n { uri: item.file.uri },\n {},\n onPlaybackStatusUpdate,\n );\n }\n };\n initiateSound();\n }\n\n return () => {\n if (soundRef.current?.stopAsync && soundRef.current.unloadAsync) {\n soundRef.current.stopAsync();\n soundRef.current.unloadAsync();\n }\n };\n }, []);\n\n // This is needed for expo applications where the rerender doesn't occur on time thefore you need to update the state of the sound.\n useEffect(() => {\n const initalPlayPause = async () => {\n if (soundRef.current) {\n if (item.paused) {\n if (soundRef.current.pauseAsync) await soundRef.current.pauseAsync();\n } else {\n if (soundRef.current.playAsync) await soundRef.current.playAsync();\n }\n }\n };\n if (!Sound.Player) {\n initalPlayPause();\n }\n }, [item.paused]);\n\n const {\n theme: {\n colors: { accent_blue, black, grey_dark, static_black, static_white },\n messageInput: {\n fileUploadPreview: {\n audioAttachment: { progressControlView, progressDurationText, roundedView },\n fileContentContainer,\n filenameText,\n fileTextContainer,\n },\n },\n },\n } = useTheme();\n\n const progressValueInSeconds = (item.duration as number) * (item.progress as number);\n\n const progressDuration = progressValueInSeconds\n ? progressValueInSeconds / 3600 >= 1\n ? dayjs.duration(progressValueInSeconds, 'second').format('HH:mm:ss')\n : dayjs.duration(progressValueInSeconds, 'second').format('mm:ss')\n : '00:00';\n\n const lastIndexOfDot = item.file.name.lastIndexOf('.');\n\n return (\n <View style={[styles.fileContentContainer, fileContentContainer]}>\n <TouchableOpacity\n accessibilityLabel='Play Pause Button'\n onPress={() => handlePlayPause()}\n style={[\n styles.roundedView,\n roundedView,\n { backgroundColor: static_white, shadowColor: black },\n ]}\n >\n {item.paused ? (\n <Play height={24} pathFill={static_black} width={24} />\n ) : (\n <Pause height={24} pathFill={static_black} width={24} />\n )}\n </TouchableOpacity>\n <View style={[styles.fileTextContainer, fileTextContainer]}>\n <Text\n accessibilityLabel='File Name'\n numberOfLines={1}\n style={[\n styles.filenameText,\n {\n color: black,\n width:\n 16 - // 16 = horizontal padding\n 40 - // 40 = file icon size\n 24 - // 24 = close icon size\n 24, // 24 = internal padding\n },\n I18nManager.isRTL ? { writingDirection: 'rtl' } : { writingDirection: 'ltr' },\n filenameText,\n ]}\n >\n {item.file.name.slice(0, 12) + '...' + item.file.name.slice(lastIndexOfDot)}\n </Text>\n <View\n style={{\n alignItems: 'center',\n display: 'flex',\n flexDirection: 'row',\n }}\n >\n {/* <ExpoSoundPlayer filePaused={!!item.paused} soundRef={soundRef} /> */}\n {Sound.Player && (\n <Sound.Player\n onEnd={handleEnd}\n onLoad={handleLoad}\n onProgress={handleProgress}\n paused={item.paused as boolean}\n soundRef={soundRef}\n testID='sound-player'\n uri={item.file.uri}\n />\n )}\n <Text style={[styles.progressDurationText, { color: grey_dark }, progressDurationText]}>\n {progressDuration}\n </Text>\n <View style={[styles.progressControlView, progressControlView]}>\n <ProgressControl\n duration={item.duration as number}\n filledColor={accent_blue}\n onPlayPause={handlePlayPause}\n onProgressDrag={handleProgressDrag}\n progress={item.progress as number}\n testID='progress-control'\n width={120}\n />\n </View>\n </View>\n </View>\n </View>\n );\n};\n\nexport type AudioAttachmentProps = Partial<AudioAttachmentPropsWithContext> & {\n item: Omit<FileUpload, 'state'>;\n onLoad: (index: string, duration: number) => void;\n onPlayPause: (index: string, pausedStatus?: boolean) => void;\n onProgress: (index: string, currentTime?: number, hasEnd?: boolean) => void;\n testID: string;\n};\n\n/**\n * AudioAttachment\n * UI Component to preview the audio files\n */\nexport const AudioAttachment = (props: AudioAttachmentProps) => (\n <AudioAttachmentWithContext {...props} />\n);\n\nAudioAttachment.displayName = 'AudioAttachment{messageInput{autoAttachment}}';\n"]}
@@ -1,11 +1,17 @@
1
1
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
2
2
 
3
+ var _typeof = require("@babel/runtime/helpers/typeof");
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
6
8
  exports.FileAttachmentGroup = void 0;
7
9
 
8
- var _react = _interopRequireDefault(require("react"));
10
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
+
12
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
13
+
14
+ var _react = _interopRequireWildcard(require("react"));
9
15
 
10
16
  var _reactNative = require("react-native");
11
17
 
@@ -17,34 +23,111 @@ var _MessagesContext = require("../../contexts/messagesContext/MessagesContext")
17
23
 
18
24
  var _ThemeContext = require("../../contexts/themeContext/ThemeContext");
19
25
 
26
+ var _native = require("../../native");
27
+
20
28
  var _this = this,
21
29
  _jsxFileName = "/home/runner/work/stream-chat-react-native/stream-chat-react-native/package/src/components/Attachment/FileAttachmentGroup.tsx";
22
30
 
31
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
32
+
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; }
34
+
35
+ var FILE_PREVIEW_HEIGHT = 60;
36
+
23
37
  var styles = _reactNative.StyleSheet.create({
24
38
  container: {
25
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
26
49
  }
27
50
  });
28
51
 
29
52
  var FileAttachmentGroupWithContext = function FileAttachmentGroupWithContext(props) {
30
53
  var Attachment = props.Attachment,
54
+ AudioAttachment = props.AudioAttachment,
31
55
  files = props.files,
32
56
  messageId = props.messageId,
33
57
  _props$styles = props.styles,
34
58
  stylesProp = _props$styles === void 0 ? {} : _props$styles;
35
59
 
60
+ var _useState = (0, _react.useState)([]),
61
+ _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
62
+ filesToDisplay = _useState2[0],
63
+ setFilesToDisplay = _useState2[1];
64
+
65
+ (0, _react.useEffect)(function () {
66
+ setFilesToDisplay(files.map(function (file) {
67
+ return (0, _extends2["default"])({}, file, {
68
+ duration: 0,
69
+ paused: true,
70
+ progress: 0
71
+ });
72
+ }));
73
+ }, [files]);
74
+
75
+ var onLoad = function onLoad(index, duration) {
76
+ setFilesToDisplay(function (prevFilesToDisplay) {
77
+ return prevFilesToDisplay.map(function (fileToDisplay, id) {
78
+ return (0, _extends2["default"])({}, fileToDisplay, {
79
+ duration: id.toString() === index ? duration : fileToDisplay.duration
80
+ });
81
+ });
82
+ });
83
+ };
84
+
85
+ var onProgress = function onProgress(index, currentTime, hasEnd) {
86
+ setFilesToDisplay(function (prevFileUploads) {
87
+ return prevFileUploads.map(function (fileUpload, id) {
88
+ return (0, _extends2["default"])({}, fileUpload, {
89
+ progress: id.toString() === index ? hasEnd ? 1 : currentTime ? currentTime / fileUpload.duration : 0 : fileUpload.progress
90
+ });
91
+ });
92
+ });
93
+ };
94
+
95
+ var onPlayPause = function onPlayPause(index, pausedStatus) {
96
+ if (pausedStatus === false) {
97
+ setFilesToDisplay(function (prevFileUploads) {
98
+ return prevFileUploads.map(function (fileUpload, id) {
99
+ return (0, _extends2["default"])({}, fileUpload, {
100
+ paused: id.toString() === index ? false : true
101
+ });
102
+ });
103
+ });
104
+ } else {
105
+ setFilesToDisplay(function (prevFileUploads) {
106
+ return prevFileUploads.map(function (fileUpload) {
107
+ return (0, _extends2["default"])({}, fileUpload, {
108
+ paused: true
109
+ });
110
+ });
111
+ });
112
+ }
113
+ };
114
+
36
115
  var _useTheme = (0, _ThemeContext.useTheme)(),
37
- container = _useTheme.theme.messageSimple.fileAttachmentGroup.container;
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;
38
121
 
39
122
  return _react["default"].createElement(_reactNative.View, {
40
123
  style: [styles.container, container, stylesProp.container],
41
124
  __self: _this,
42
125
  __source: {
43
126
  fileName: _jsxFileName,
44
- lineNumber: 54,
127
+ lineNumber: 131,
45
128
  columnNumber: 5
46
129
  }
47
- }, files.map(function (file, index) {
130
+ }, filesToDisplay.map(function (file, index) {
48
131
  return _react["default"].createElement(_reactNative.View, {
49
132
  key: messageId + "-" + index,
50
133
  style: [{
@@ -53,16 +136,52 @@ var FileAttachmentGroupWithContext = function FileAttachmentGroupWithContext(pro
53
136
  __self: _this,
54
137
  __source: {
55
138
  fileName: _jsxFileName,
56
- lineNumber: 56,
139
+ lineNumber: 133,
57
140
  columnNumber: 9
58
141
  }
59
- }, _react["default"].createElement(Attachment, {
142
+ }, file.type === 'audio' && (0, _native.isAudioPackageAvailable)() ? _react["default"].createElement(_reactNative.View, {
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
+ }],
151
+ __self: _this,
152
+ __source: {
153
+ fileName: _jsxFileName,
154
+ lineNumber: 141,
155
+ columnNumber: 13
156
+ }
157
+ }, _react["default"].createElement(AudioAttachment, {
158
+ item: {
159
+ duration: file.duration,
160
+ file: {
161
+ name: file.title,
162
+ uri: file.asset_url
163
+ },
164
+ id: index.toString(),
165
+ paused: file.paused,
166
+ progress: file.progress
167
+ },
168
+ onLoad: onLoad,
169
+ onPlayPause: onPlayPause,
170
+ onProgress: onProgress,
171
+ testID: "audio-attachment-preview",
172
+ __self: _this,
173
+ __source: {
174
+ fileName: _jsxFileName,
175
+ lineNumber: 157,
176
+ columnNumber: 15
177
+ }
178
+ })) : _react["default"].createElement(Attachment, {
60
179
  attachment: file,
61
180
  __self: _this,
62
181
  __source: {
63
182
  fileName: _jsxFileName,
64
- lineNumber: 63,
65
- columnNumber: 11
183
+ lineNumber: 172,
184
+ columnNumber: 13
66
185
  }
67
186
  }));
68
187
  }));
@@ -71,8 +190,7 @@ var FileAttachmentGroupWithContext = function FileAttachmentGroupWithContext(pro
71
190
  var areEqual = function areEqual(prevProps, nextProps) {
72
191
  var prevFiles = prevProps.files;
73
192
  var nextFiles = nextProps.files;
74
- var filesEqual = prevFiles.length === nextFiles.length;
75
- return filesEqual;
193
+ return prevFiles.length === nextFiles.length;
76
194
  };
77
195
 
78
196
  var MemoizedFileAttachmentGroup = _react["default"].memo(FileAttachmentGroupWithContext, areEqual);
@@ -86,18 +204,20 @@ var FileAttachmentGroup = function FileAttachmentGroup(props) {
86
204
 
87
205
  var _useMessagesContext = (0, _MessagesContext.useMessagesContext)(),
88
206
  _useMessagesContext$A = _useMessagesContext.Attachment,
89
- Attachment = _useMessagesContext$A === void 0 ? _Attachment.Attachment : _useMessagesContext$A;
207
+ Attachment = _useMessagesContext$A === void 0 ? _Attachment.Attachment : _useMessagesContext$A,
208
+ AudioAttachment = _useMessagesContext.AudioAttachment;
90
209
 
91
210
  var files = propFiles || contextFiles;
92
211
  if (!files.length) return null;
93
212
  return _react["default"].createElement(MemoizedFileAttachmentGroup, {
94
213
  Attachment: Attachment,
214
+ AudioAttachment: AudioAttachment,
95
215
  files: files,
96
216
  messageId: messageId,
97
217
  __self: _this,
98
218
  __source: {
99
219
  fileName: _jsxFileName,
100
- lineNumber: 108,
220
+ lineNumber: 217,
101
221
  columnNumber: 5
102
222
  }
103
223
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["FileAttachmentGroup.tsx"],"names":["styles","StyleSheet","create","container","padding","FileAttachmentGroupWithContext","props","Attachment","files","messageId","stylesProp","theme","messageSimple","fileAttachmentGroup","map","file","index","paddingBottom","length","attachmentContainer","areEqual","prevProps","nextProps","prevFiles","nextFiles","filesEqual","MemoizedFileAttachmentGroup","React","memo","FileAttachmentGroup","propFiles","contextFiles","AttachmentDefault","displayName"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AAEA;;AAIA;;AAIA;;;;;AAIA,IAAMA,MAAM,GAAGC,wBAAWC,MAAX,CAAkB;AAC/BC,EAAAA,SAAS,EAAE;AACTC,IAAAA,OAAO,EAAE;AADA;AADoB,CAAlB,CAAf;;AAoBA,IAAMC,8BAA8B,GAAG,SAAjCA,8BAAiC,CAGrCC,KAHqC,EAIlC;AACH,MAAQC,UAAR,GAAkED,KAAlE,CAAQC,UAAR;AAAA,MAAoBC,KAApB,GAAkEF,KAAlE,CAAoBE,KAApB;AAAA,MAA2BC,SAA3B,GAAkEH,KAAlE,CAA2BG,SAA3B;AAAA,sBAAkEH,KAAlE,CAAsCN,MAAtC;AAAA,MAA8CU,UAA9C,8BAA2D,EAA3D;;AAEA,kBAMI,6BANJ;AAAA,MAG6BP,SAH7B,aACEQ,KADF,CAEIC,aAFJ,CAGMC,mBAHN,CAG6BV,SAH7B;;AAQA,SACE,gCAAC,iBAAD;AAAM,IAAA,KAAK,EAAE,CAACH,MAAM,CAACG,SAAR,EAAmBA,SAAnB,EAA8BO,UAAU,CAACP,SAAzC,CAAb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACGK,KAAK,CAACM,GAAN,CAAU,UAACC,IAAD,EAAOC,KAAP;AAAA,WACT,gCAAC,iBAAD;AACE,MAAA,GAAG,EAAKP,SAAL,SAAkBO,KADvB;AAEE,MAAA,KAAK,EAAE,CACL;AAAEC,QAAAA,aAAa,EAAED,KAAK,KAAKR,KAAK,CAACU,MAAN,GAAe,CAAzB,GAA6B,CAA7B,GAAiC;AAAlD,OADK,EAELR,UAAU,CAACS,mBAFN,CAFT;AAAA;AAAA;AAAA;AAAA;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attachment as AttachmentDefault } from './Attachment';\n\nimport {\n MessageContextValue,\n useMessageContext,\n} from '../../contexts/messageContext/MessageContext';\nimport {\n MessagesContextValue,\n useMessagesContext,\n} from '../../contexts/messagesContext/MessagesContext';\nimport { useTheme } from '../../contexts/themeContext/ThemeContext';\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<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\nconst FileAttachmentGroupWithContext = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n props: FileAttachmentGroupPropsWithContext<StreamChatGenerics>,\n) => {\n const { Attachment, files, messageId, styles: stylesProp = {} } = props;\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 {files.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 <Attachment attachment={file} />\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 const filesEqual = prevFiles.length === nextFiles.length;\n\n return filesEqual;\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 files = propFiles || contextFiles;\n\n if (!files.length) return null;\n\n return (\n <MemoizedFileAttachmentGroup\n {...{\n Attachment,\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","contextFiles","AttachmentDefault","displayName"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AAIA;;AAEA;;AAKA;;AAIA;;AACA;;;;;;;;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EA,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"]}
@@ -78,6 +78,12 @@ var styles = _reactNative.StyleSheet.create({
78
78
  left: 4,
79
79
  position: 'absolute'
80
80
  },
81
+ imageLoadingIndicatorContainer: {
82
+ height: '100%',
83
+ justifyContent: 'center',
84
+ position: 'absolute',
85
+ width: '100%'
86
+ },
81
87
  imageLoadingIndicatorStyle: {
82
88
  alignItems: 'center',
83
89
  justifyContent: 'center',
@@ -161,7 +167,7 @@ var GalleryWithContext = function GalleryWithContext(props) {
161
167
  __self: _this,
162
168
  __source: {
163
169
  fileName: _jsxFileName,
164
- lineNumber: 186,
170
+ lineNumber: 192,
165
171
  columnNumber: 5
166
172
  }
167
173
  }, thumbnailGrid.map(function (rows, colIndex) {
@@ -175,7 +181,7 @@ var GalleryWithContext = function GalleryWithContext(props) {
175
181
  __self: _this,
176
182
  __source: {
177
183
  fileName: _jsxFileName,
178
- lineNumber: 203,
184
+ lineNumber: 209,
179
185
  columnNumber: 11
180
186
  }
181
187
  }, rows.map(function (thumbnail, rowIndex) {
@@ -225,7 +231,7 @@ var GalleryWithContext = function GalleryWithContext(props) {
225
231
  __self: _this,
226
232
  __source: {
227
233
  fileName: _jsxFileName,
228
- lineNumber: 235,
234
+ lineNumber: 241,
229
235
  columnNumber: 17
230
236
  }
231
237
  });
@@ -329,7 +335,7 @@ var GalleryThumbnail = function GalleryThumbnail(_ref) {
329
335
  __self: _this,
330
336
  __source: {
331
337
  fileName: _jsxFileName,
332
- lineNumber: 359,
338
+ lineNumber: 365,
333
339
  columnNumber: 5
334
340
  }
335
341
  }), thumbnail.type === 'video' ? _react["default"].createElement(VideoThumbnail, {
@@ -341,7 +347,7 @@ var GalleryThumbnail = function GalleryThumbnail(_ref) {
341
347
  __self: _this,
342
348
  __source: {
343
349
  fileName: _jsxFileName,
344
- lineNumber: 401,
350
+ lineNumber: 407,
345
351
  columnNumber: 9
346
352
  }
347
353
  }) : _react["default"].createElement(_reactNative.View, {
@@ -349,7 +355,7 @@ var GalleryThumbnail = function GalleryThumbnail(_ref) {
349
355
  __self: _this,
350
356
  __source: {
351
357
  fileName: _jsxFileName,
352
- lineNumber: 413,
358
+ lineNumber: 419,
353
359
  columnNumber: 9
354
360
  }
355
361
  }, _react["default"].createElement(GalleryImageThumbnail, {
@@ -360,7 +366,7 @@ var GalleryThumbnail = function GalleryThumbnail(_ref) {
360
366
  __self: _this,
361
367
  __source: {
362
368
  fileName: _jsxFileName,
363
- lineNumber: 414,
369
+ lineNumber: 420,
364
370
  columnNumber: 11
365
371
  }
366
372
  })), colIndex === numOfColumns - 1 && rowIndex === numOfRows - 1 && imagesAndVideos.length > 4 ? _react["default"].createElement(_reactNative.View, {
@@ -370,7 +376,7 @@ var GalleryThumbnail = function GalleryThumbnail(_ref) {
370
376
  __self: _this,
371
377
  __source: {
372
378
  fileName: _jsxFileName,
373
- lineNumber: 423,
379
+ lineNumber: 429,
374
380
  columnNumber: 9
375
381
  }
376
382
  }, _react["default"].createElement(_reactNative.Text, {
@@ -378,7 +384,7 @@ var GalleryThumbnail = function GalleryThumbnail(_ref) {
378
384
  __self: _this,
379
385
  __source: {
380
386
  fileName: _jsxFileName,
381
- lineNumber: 431,
387
+ lineNumber: 437,
382
388
  columnNumber: 11
383
389
  }
384
390
  }, "+" + (imagesAndVideos.length - 4))) : null);
@@ -407,7 +413,7 @@ var GalleryImageThumbnail = function GalleryImageThumbnail(_ref2) {
407
413
  __self: _this,
408
414
  __source: {
409
415
  fileName: _jsxFileName,
410
- lineNumber: 463,
416
+ lineNumber: 469,
411
417
  columnNumber: 5
412
418
  }
413
419
  }, isLoadingImageError ? _react["default"].createElement(ImageLoadingFailedIndicator, {
@@ -415,7 +421,7 @@ var GalleryImageThumbnail = function GalleryImageThumbnail(_ref2) {
415
421
  __self: _this,
416
422
  __source: {
417
423
  fileName: _jsxFileName,
418
- lineNumber: 470,
424
+ lineNumber: 476,
419
425
  columnNumber: 9
420
426
  }
421
427
  }) : _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement(MemoizedGalleryImage, {
@@ -439,17 +445,15 @@ var GalleryImageThumbnail = function GalleryImageThumbnail(_ref2) {
439
445
  __self: _this,
440
446
  __source: {
441
447
  fileName: _jsxFileName,
442
- lineNumber: 473,
448
+ lineNumber: 479,
443
449
  columnNumber: 11
444
450
  }
445
451
  }), isLoadingImage && _react["default"].createElement(_reactNative.View, {
446
- style: {
447
- position: 'absolute'
448
- },
452
+ style: [styles.imageLoadingIndicatorContainer],
449
453
  __self: _this,
450
454
  __source: {
451
455
  fileName: _jsxFileName,
452
- lineNumber: 493,
456
+ lineNumber: 499,
453
457
  columnNumber: 13
454
458
  }
455
459
  }, _react["default"].createElement(ImageLoadingIndicator, {
@@ -457,7 +461,7 @@ var GalleryImageThumbnail = function GalleryImageThumbnail(_ref2) {
457
461
  __self: _this,
458
462
  __source: {
459
463
  fileName: _jsxFileName,
460
- lineNumber: 494,
464
+ lineNumber: 500,
461
465
  columnNumber: 15
462
466
  }
463
467
  }))));
@@ -577,7 +581,7 @@ var Gallery = function Gallery(props) {
577
581
  __self: _this,
578
582
  __source: {
579
583
  fileName: _jsxFileName,
580
- lineNumber: 630,
584
+ lineNumber: 636,
581
585
  columnNumber: 5
582
586
  }
583
587
  });