stream-chat-react-native-core 4.5.0 → 4.6.0

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 (156) 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 +232 -48
  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 +39 -21
  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 +232 -48
  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 +39 -21
  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 +210 -60
  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 +23 -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/components/Thread/__tests__/__snapshots__/Thread.test.js.snap +12 -0
  130. package/src/contexts/attachmentPickerContext/AttachmentPickerContext.tsx +12 -8
  131. package/src/contexts/channelContext/ChannelContext.md +1 -1
  132. package/src/contexts/channelContext/ChannelContext.tsx +2 -2
  133. package/src/contexts/channelsContext/ChannelsContext.md +1 -1
  134. package/src/contexts/channelsContext/ChannelsContext.tsx +6 -6
  135. package/src/contexts/chatContext/ChatContext.md +1 -1
  136. package/src/contexts/imageGalleryContext/ImageGalleryContext.md +1 -1
  137. package/src/contexts/keyboardContext/KeyboardContext.md +1 -1
  138. package/src/contexts/messageContext/MessageContext.md +1 -1
  139. package/src/contexts/messageContext/MessageContext.tsx +2 -2
  140. package/src/contexts/messageInputContext/MessageInputContext.md +1 -1
  141. package/src/contexts/messageInputContext/MessageInputContext.tsx +23 -30
  142. package/src/contexts/messageInputContext/hooks/useMessageDetailsForState.ts +17 -1
  143. package/src/contexts/messageOverlayContext/MessageOverlayContext.tsx +6 -6
  144. package/src/contexts/messagesContext/MessagesContext.md +1 -1
  145. package/src/contexts/messagesContext/MessagesContext.tsx +20 -20
  146. package/src/contexts/overlayContext/OverlayContext.md +1 -1
  147. package/src/contexts/paginatedMessageListContext/PaginatedMessageListContext.md +1 -1
  148. package/src/contexts/suggestionsContext/SuggestionsContext.md +1 -1
  149. package/src/contexts/themeContext/utils/theme.ts +3 -1
  150. package/src/contexts/typingContext/TypingContext.md +1 -1
  151. package/src/icons/Recorder.tsx +16 -0
  152. package/src/icons/Video.tsx +37 -0
  153. package/src/icons/index.ts +2 -0
  154. package/src/native.ts +4 -14
  155. package/src/types/types.ts +27 -0
  156. package/src/version.json +1 -1
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Official React Native SDK for Stream Chat
2
2
 
3
3
  <p align="center">
4
- <a href="https://getstream.io/chat/react-native-chat/tutorial/"><img src="https://github.com/GetStream/stream-chat-react-native/blob/master/screenshots/readme/cover.png" alt="react native chat" width="100%" /></a>
4
+ <a href="https://getstream.io/chat/react-native-chat/tutorial/"><img src="https://github.com/GetStream/stream-chat-react-native/blob/main/screenshots/readme/cover.png" alt="react native chat" width="100%" /></a>
5
5
  </p>
6
6
 
7
7
  > The official React Native and Expo components for Stream Chat, a service for
@@ -9,7 +9,7 @@
9
9
 
10
10
 
11
11
  [![NPM](https://img.shields.io/npm/v/stream-chat-react-native.svg)](https://www.npmjs.com/package/stream-chat-react-native)
12
- [![Build Status](https://github.com/GetStream/stream-chat-react-native/workflows/test/badge.svg?branch=master)](https://github.com/GetStream/stream-chat-react-native/actions)
12
+ [![Build Status](https://github.com/GetStream/stream-chat-react-native/workflows/test/badge.svg?branch=main)](https://github.com/GetStream/stream-chat-react-native/actions)
13
13
  [![Component Reference](https://img.shields.io/badge/docs-component%20reference-blue.svg)](https://getstream.io/chat/docs/sdk/reactnative)
14
14
 
15
15
  <img align="right" src="https://getstream.imgix.net/images/ios-chat-tutorial/iphone_chat_art@3x.png?auto=format,enhance" width="50%" />
@@ -68,7 +68,7 @@ We welcome code changes that improve this library or fix a problem, and please m
68
68
 
69
69
  ## Git flow & Release process
70
70
 
71
- We enforce conventional commits and have an automated releasing process using workspaces and semantic-release. Read our [git flow & release process guide](https://github.com/GetStream/stream-chat-react-native/blob/master/RELEASE_PROCESS.md) for more information
71
+ We enforce conventional commits and have an automated releasing process using workspaces and semantic-release. Read our [git flow & release process guide](https://github.com/GetStream/stream-chat-react-native/blob/main/RELEASE_PROCESS.md) for more information
72
72
 
73
73
  ## We are hiring
74
74
 
@@ -43,6 +43,8 @@ var _TAR = require("../../icons/TAR");
43
43
 
44
44
  var _TXT = require("../../icons/TXT");
45
45
 
46
+ var _Video = require("../../icons/Video");
47
+
46
48
  var _XLS = require("../../icons/XLS");
47
49
 
48
50
  var _XLSX = require("../../icons/XLSX");
@@ -62,6 +64,7 @@ var powerpointMimeTypes = ['application/vnd.ms-powerpoint', 'application/vnd.oas
62
64
  var powerpointXMimeTypes = ['application/vnd.openxmlformats-officedocument.presentationml.presentation', 'application/vnd.openxmlformats-officedocument.presentationml.template', 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', 'application/vnd.ms-powerpoint.addin.macroEnabled.12', 'application/vnd.ms-powerpoint.presentation.macroEnabled.12', 'application/vnd.ms-powerpoint.template.macroEnabled.12', 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12'];
63
65
  var tarFileTypes = ['application/x-archive', 'application/x-tar', 'application/gzip', 'application/x-compress', 'application/x-bzip', 'application/x-lzip', 'application/x-lz4', 'application/x-lzma', 'application/x-lzop', 'application/x-xz', 'application/x-webarchive'];
64
66
  var zipFileTypes = ['application/gzip', 'application/zip'];
67
+ var videoFileTypes = ['video/3g2', 'video/3gp', 'video/aaf', 'video/asf', 'video/avchd', 'video/avi', 'video/drc', 'video/flv', 'video/m2v', 'video/m3u8', 'video/m4p', 'video/m4v', 'video/mkv', 'video/mng', 'video/mov', 'video/mp2', 'video/mp4', 'video/mpe', 'video/mpeg', 'video/mpg', 'video/mpv', 'video/mxf', 'video/nsv', 'video/ogg', 'video/ogv', 'video/qt', 'video/rm', 'video/rmvb', 'video/roq', 'video/svi', 'video/vob', 'video/webm', 'video/wmv', 'video/yuv', 'video/quicktime', 'video/webm', 'video/x-flv'];
65
68
  var mimeTypeToIconMap = {
66
69
  'application/pdf': _PDF.PDF,
67
70
  'application/rtf': _RTF.RTF,
@@ -123,6 +126,11 @@ for (var _i10 = 0, _zipFileTypes = zipFileTypes; _i10 < _zipFileTypes.length; _i
123
126
  mimeTypeToIconMap[_type9] = _ZIP.ZIP;
124
127
  }
125
128
 
129
+ for (var _i11 = 0, _videoFileTypes = videoFileTypes; _i11 < _videoFileTypes.length; _i11++) {
130
+ var _type10 = _videoFileTypes[_i11];
131
+ mimeTypeToIconMap[_type10] = _Video.Video;
132
+ }
133
+
126
134
  function mimeTypeToIcon(mimeType) {
127
135
  if (!mimeType) return _GenericFile.GenericFile;
128
136
  var Icon = mimeTypeToIconMap[mimeType];
@@ -145,7 +153,7 @@ var FileIcon = function FileIcon(_ref) {
145
153
  __self: _this,
146
154
  __source: {
147
155
  fileName: _jsxFileName,
148
- lineNumber: 399,
156
+ lineNumber: 444,
149
157
  columnNumber: 10
150
158
  }
151
159
  }));
@@ -1 +1 @@
1
- {"version":3,"sources":["FileIcon.tsx"],"names":["audioFileTypes","docMimeTypes","docXMimeTypes","excelMimeTypes","excelXMimeTypes","odtMimeTypes","powerpointMimeTypes","powerpointXMimeTypes","tarFileTypes","zipFileTypes","mimeTypeToIconMap","PDF","RTF","RAR","SEVEN_Z","CSV","HTML","MD","TXT","type","Audio","DOC","DOCX","XLS","XLSX","ODT","PPT","PPTX","TAR","ZIP","mimeTypeToIcon","mimeType","GenericFile","Icon","FileIcon","size","icon","theme","messageSimple","file","height","width","displayName"],"mappings":";;;;;;;;;AAAA;;AAEA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;;;;AAGA,IAAMA,cAAc,GAAG,CACrB,gCADqB,EAErB,gBAFqB,EAGrB,YAHqB,EAIrB,aAJqB,EAKrB,WALqB,EAMrB,WANqB,EAOrB,WAPqB,EAQrB,cARqB,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AAiB,CAACS,MAAD,CAAjB,GAA0BU,QAA1B;AACD;;AAED,SAASC,cAAT,CAAwBC,QAAxB,EAAgE;AAC9D,MAAI,CAACA,QAAL,EAAe,OAAOC,wBAAP;AAEf,MAAMC,IAAI,GAAGvB,iBAAiB,CAACqB,QAAD,CAA9B;AACA,MAAIE,IAAJ,EAAU,OAAOA,IAAP;AAEV,SAAOD,wBAAP;AACD;;AAOM,IAAME,QAAiC,GAAG,SAApCA,QAAoC,OAAwB;AAAA,MAArBH,QAAqB,QAArBA,QAAqB;AAAA,MAAXI,IAAW,QAAXA,IAAW;;AACvE,kBAMI,6BANJ;AAAA,MAGcC,IAHd,aACEC,KADF,CAEIC,aAFJ,CAGMC,IAHN,CAGcH,IAHd;;AAQA,MAAMH,IAAI,GAAGH,cAAc,CAACC,QAAD,CAA3B;AAEA,SAAO,gCAAC,IAAD,gCAAWI,IAAI,GAAG;AAAEK,IAAAA,MAAM,EAAEL,IAAV;AAAgBM,IAAAA,KAAK,EAAEN;AAAvB,GAAH,GAAmC,EAAlD,EAA2DC,IAA3D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAAP;AACD,CAZM;;;AAcPF,QAAQ,CAACQ,WAAT,GAAuB,qCAAvB","sourcesContent":["import React from 'react';\n\nimport { useTheme } from '../../contexts/themeContext/ThemeContext';\n\nimport { Audio } from '../../icons/Audio';\nimport { CSV } from '../../icons/CSV';\nimport { DOC } from '../../icons/DOC';\nimport { DOCX } from '../../icons/DOCX';\nimport { GenericFile } from '../../icons/GenericFile';\nimport { HTML } from '../../icons/HTML';\nimport { MD } from '../../icons/MD';\nimport { ODT } from '../../icons/ODT';\nimport { PDF } from '../../icons/PDF';\nimport { PPT } from '../../icons/PPT';\nimport { PPTX } from '../../icons/PPTX';\nimport { RAR } from '../../icons/RAR';\nimport { RTF } from '../../icons/RTF';\nimport { SEVEN_Z } from '../../icons/SEVEN_Z';\nimport { TAR } from '../../icons/TAR';\nimport { TXT } from '../../icons/TXT';\nimport type { IconProps } from '../../icons/utils/base';\nimport { XLS } from '../../icons/XLS';\nimport { XLSX } from '../../icons/XLSX';\nimport { ZIP } from '../../icons/ZIP';\n\n// https://www.iana.org/assignments/media-types/media-types.xhtml#audio\nconst audioFileTypes = [\n 'audio/1d-interleaved-parityfec',\n 'audio/32kadpcm',\n 'audio/3gpp',\n 'audio/3gpp2',\n 'audio/aac',\n 'audio/ac3',\n 'audio/AMR',\n 'audio/AMR-WB',\n 'audio/amr-wb+',\n 'audio/aptx',\n 'audio/asc',\n 'audio/ATRAC-ADVANCED-LOSSLESS',\n 'audio/ATRAC-X',\n 'audio/ATRAC3',\n 'audio/basic',\n 'audio/BV16',\n 'audio/BV32',\n 'audio/clearmode',\n 'audio/CN',\n 'audio/DAT12',\n 'audio/dls',\n 'audio/dsr-es201108',\n 'audio/dsr-es202050',\n 'audio/dsr-es202211',\n 'audio/dsr-es202212',\n 'audio/DV',\n 'audio/DVI4',\n 'audio/eac3',\n 'audio/encaprtp',\n 'audio/EVRC',\n 'audio/EVRC-QCP',\n 'audio/EVRC0',\n 'audio/EVRC1',\n 'audio/EVRCB',\n 'audio/EVRCB0',\n 'audio/EVRCB1',\n 'audio/EVRCNW',\n 'audio/EVRCNW0',\n 'audio/EVRCNW1',\n 'audio/EVRCWB',\n 'audio/EVRCWB0',\n 'audio/EVRCWB1',\n 'audio/EVS',\n 'audio/example',\n 'audio/flexfec',\n 'audio/fwdred',\n 'audio/G711-0',\n 'audio/G719',\n 'audio/G7221',\n 'audio/G722',\n 'audio/G723',\n 'audio/G726-16',\n 'audio/G726-24',\n 'audio/G726-32',\n 'audio/G726-40',\n 'audio/G728',\n 'audio/G729',\n 'audio/G7291',\n 'audio/G729D',\n 'audio/G729E',\n 'audio/GSM',\n 'audio/GSM-EFR',\n 'audio/GSM-HR-08',\n 'audio/iLBC',\n 'audio/ip-mr_v2.5',\n 'audio/L8',\n 'audio/L16',\n 'audio/L20',\n 'audio/L24',\n 'audio/LPC',\n 'audio/MELP',\n 'audio/MELP600',\n 'audio/MELP1200',\n 'audio/MELP2400',\n 'audio/mhas',\n 'audio/mobile-xmf',\n 'audio/MPA',\n 'audio/mp4',\n 'audio/MP4A-LATM',\n 'audio/mpa-robust',\n 'audio/mpeg',\n 'audio/mpeg4-generic',\n 'audio/ogg',\n 'audio/opus',\n 'audio/parityfec',\n 'audio/PCMA',\n 'audio/PCMA-WB',\n 'audio/PCMU',\n 'audio/PCMU-WB',\n 'audio/prs.sid',\n 'audio/raptorfec',\n 'audio/RED',\n 'audio/rtp-enc-aescm128',\n 'audio/rtploopback',\n 'audio/rtp-midi',\n 'audio/rtx',\n 'audio/SMV',\n 'audio/SMV0',\n 'audio/SMV-QCP',\n 'audio/sofa',\n 'audio/sp-midi',\n 'audio/speex',\n 'audio/t140c',\n 'audio/t38',\n 'audio/telephone-event',\n 'audio/TETRA_ACELP',\n 'audio/TETRA_ACELP_BB',\n 'audio/tone',\n 'audio/TSVCIS',\n 'audio/UEMCLIP',\n 'audio/ulpfec',\n 'audio/usac',\n 'audio/VDVI',\n 'audio/VMR-WB',\n 'audio/vnd.3gpp.iufp',\n 'audio/vnd.4SB',\n 'audio/vnd.audiokoz',\n 'audio/vnd.CELP',\n 'audio/vnd.cisco.nse',\n 'audio/vnd.cmles.radio-events',\n 'audio/vnd.cns.anp1',\n 'audio/vnd.cns.inf1',\n 'audio/vnd.dece.audio',\n 'audio/vnd.digital-winds',\n 'audio/vnd.dlna.adts',\n 'audio/vnd.dolby.heaac.1',\n 'audio/vnd.dolby.heaac.2',\n 'audio/vnd.dolby.mlp',\n 'audio/vnd.dolby.mps',\n 'audio/vnd.dolby.pl2',\n 'audio/vnd.dolby.pl2x',\n 'audio/vnd.dolby.pl2z',\n 'audio/vnd.dolby.pulse.1',\n 'audio/vnd.dra',\n 'audio/vnd.dts',\n 'audio/vnd.dts.hd',\n 'audio/vnd.dts.uhd',\n 'audio/vnd.dvb.file',\n 'audio/vnd.everad.plj',\n 'audio/vnd.hns.audio',\n 'audio/vnd.lucent.voice',\n 'audio/vnd.ms-playready.media.pya',\n 'audio/vnd.nokia.mobile-xmf',\n 'audio/vnd.nortel.vbk',\n 'audio/vnd.nuera.ecelp4800',\n 'audio/vnd.nuera.ecelp7470',\n 'audio/vnd.nuera.ecelp9600',\n 'audio/vnd.octel.sbc',\n 'audio/vnd.presonus.multitrack',\n 'audio/vnd.qcelp',\n 'audio/vnd.rhetorex.32kadpcm',\n 'audio/vnd.rip',\n 'audio/vnd.sealedmedia.softseal.mpeg',\n 'audio/vnd.vmx.cvsd',\n 'audio/vorbis',\n 'audio/vorbis-config',\n];\n\n// Partially based on:\n// https://stackoverflow.com/a/4212908/2570866\n\nconst docMimeTypes = [\n // Microsoft Word\n // .doc .dot\n 'application/msword',\n // .doc .dot\n 'application/msword-template',\n\n // LibreOffice/OpenOffice Writer\n // .odt\n 'application/vnd.oasis.opendocument.text',\n // .ott\n 'application/vnd.oasis.opendocument.text-template',\n // .fodt\n 'application/vnd.oasis.opendocument.text-flat-xml',\n // .uot\n // NOTE: firefox doesn't know mimetype so maybe ignore\n];\n\nconst docXMimeTypes = [\n // Microsoft Word\n // .docx\n 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',\n // .dotx (no test)\n 'application/vnd.openxmlformats-officedocument.wordprocessingml.template',\n // .docm\n 'application/vnd.ms-word.document.macroEnabled.12',\n // .dotm (no test)\n 'application/vnd.ms-word.template.macroEnabled.12',\n];\n\nconst excelMimeTypes = [\n // Microsoft Excel\n // .xls .xlt .xla (no test for .xla)\n 'application/vnd.ms-excel',\n\n // LibreOffice/OpenOffice Calc\n // .ods\n 'application/vnd.oasis.opendocument.spreadsheet',\n // .ots\n 'application/vnd.oasis.opendocument.spreadsheet-template',\n // .fods\n 'application/vnd.oasis.opendocument.spreadsheet-flat-xml',\n];\n\nconst excelXMimeTypes = [\n // .xlsx\n 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\n // .xltx (no test)\n 'application/vnd.openxmlformats-officedocument.spreadsheetml.template',\n // .xlsm\n 'application/vnd.ms-excel.sheet.macroEnabled.12',\n // .xltm (no test)\n 'application/vnd.ms-excel.template.macroEnabled.12',\n // .xlam (no test)\n 'application/vnd.ms-excel.addin.macroEnabled.12',\n // .xlsb (no test)\n 'application/vnd.ms-excel.addin.macroEnabled.12',\n];\n\nconst odtMimeTypes = [\n // LibreOffice/OpenOffice Writer\n // .odt\n 'application/vnd.oasis.opendocument.text',\n // .ott\n 'application/vnd.oasis.opendocument.text-template',\n // .fodt\n 'application/vnd.oasis.opendocument.text-flat-xml',\n];\n\nconst powerpointMimeTypes = [\n // Microsoft Word\n // .ppt .pot .pps .ppa (no test for .ppa)\n 'application/vnd.ms-powerpoint',\n\n // LibreOffice/OpenOffice Writer\n // .odp\n 'application/vnd.oasis.opendocument.presentation',\n // .otp\n 'application/vnd.oasis.opendocument.presentation-template',\n // .fodp\n 'application/vnd.oasis.opendocument.presentation-flat-xml',\n // .uop\n // NOTE: firefox doesn't know mimetype so maybe ignore\n];\n\nconst powerpointXMimeTypes = [\n // .pptx\n 'application/vnd.openxmlformats-officedocument.presentationml.presentation',\n // .potx (no test)\n 'application/vnd.openxmlformats-officedocument.presentationml.template',\n // .ppsx\n 'application/vnd.openxmlformats-officedocument.presentationml.slideshow',\n // .ppam\n 'application/vnd.ms-powerpoint.addin.macroEnabled.12',\n // .pptm\n 'application/vnd.ms-powerpoint.presentation.macroEnabled.12',\n // .potm\n 'application/vnd.ms-powerpoint.template.macroEnabled.12',\n // .ppsm\n 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12',\n];\n\nconst tarFileTypes = [\n // .ar\n 'application/x-archive',\n // .tar\n 'application/x-tar',\n // .tar.gz\n 'application/gzip',\n // .tar.Z\n 'application/x-compress',\n // .tar.bz2\n 'application/x-bzip',\n // .tar.lz\n 'application/x-lzip',\n // .tar.lz4\n 'application/x-lz4',\n // .tar.lzma\n 'application/x-lzma',\n // .tar.lzo (no test)\n 'application/x-lzop',\n // .tar.xz\n 'application/x-xz',\n // .war\n 'application/x-webarchive',\n];\n\nconst zipFileTypes = [\n // .gzip\n 'application/gzip',\n // .zip\n 'application/zip',\n];\n\nconst mimeTypeToIconMap: Record<string, React.FC<IconProps>> = {\n 'application/pdf': PDF, // .pdf\n 'application/rtf': RTF, // .rtf\n 'application/vnd.rar': RAR, // .rar\n 'application/x-7z-compressed': SEVEN_Z, // .z7\n 'text/csv': CSV, // .csv\n 'text/html': HTML, // .html .htm\n 'text/markdown': MD, // .md\n 'text/plain': TXT, // .txt\n};\n\nfor (const type of audioFileTypes) {\n mimeTypeToIconMap[type] = Audio;\n}\n\nfor (const type of docMimeTypes) {\n mimeTypeToIconMap[type] = DOC;\n}\n\nfor (const type of docXMimeTypes) {\n mimeTypeToIconMap[type] = DOCX;\n}\n\nfor (const type of excelMimeTypes) {\n mimeTypeToIconMap[type] = XLS;\n}\n\nfor (const type of excelXMimeTypes) {\n mimeTypeToIconMap[type] = XLSX;\n}\n\nfor (const type of odtMimeTypes) {\n mimeTypeToIconMap[type] = ODT;\n}\n\nfor (const type of powerpointMimeTypes) {\n mimeTypeToIconMap[type] = PPT;\n}\n\nfor (const type of powerpointXMimeTypes) {\n mimeTypeToIconMap[type] = PPTX;\n}\n\nfor (const type of tarFileTypes) {\n mimeTypeToIconMap[type] = TAR;\n}\n\nfor (const type of zipFileTypes) {\n mimeTypeToIconMap[type] = ZIP;\n}\n\nfunction mimeTypeToIcon(mimeType?: string): React.FC<IconProps> {\n if (!mimeType) return GenericFile;\n\n const Icon = mimeTypeToIconMap[mimeType];\n if (Icon) return Icon;\n\n return GenericFile;\n}\n\nexport type FileIconProps = {\n mimeType?: string;\n size?: number;\n};\n\nexport const FileIcon: React.FC<FileIconProps> = ({ mimeType, size }) => {\n const {\n theme: {\n messageSimple: {\n file: { icon },\n },\n },\n } = useTheme();\n\n const Icon = mimeTypeToIcon(mimeType);\n\n return <Icon {...(size ? { height: size, width: size } : {})} {...icon} />;\n};\n\nFileIcon.displayName = 'FileIcon{messageSimple{file{icon}}}';\n"]}
1
+ {"version":3,"sources":["FileIcon.tsx"],"names":["audioFileTypes","docMimeTypes","docXMimeTypes","excelMimeTypes","excelXMimeTypes","odtMimeTypes","powerpointMimeTypes","powerpointXMimeTypes","tarFileTypes","zipFileTypes","videoFileTypes","mimeTypeToIconMap","PDF","RTF","RAR","SEVEN_Z","CSV","HTML","MD","TXT","type","Audio","DOC","DOCX","XLS","XLSX","ODT","PPT","PPTX","TAR","ZIP","Video","mimeTypeToIcon","mimeType","GenericFile","Icon","FileIcon","size","icon","theme","messageSimple","file","height","width","displayName"],"mappings":";;;;;;;;;AAAA;;AAEA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;;;;AAGA,IAAMA,cAAc,GAAG,CACrB,gCADqB,EAErB,gBAFqB,EAGrB,YAHqB,EAIrB,aAJqB,EAKrB,WALqB,EAMrB,WANqB,EAOrB,WAPqB,EAQrB,cARqB,EASrB,eATqB,EAUrB,YAVqB,EAWrB,WAXqB,EAYrB,+BAZqB,EAarB,eAbqB,EAcrB,cAdqB,EAerB,aAfqB,EAgBrB,YAhBqB,EAiBrB,YAjBqB,EAkBrB,iBAlBqB,EAmBrB,UAnBqB,EAoBrB,aApBqB,EAqBrB,WArBqB,EAsBrB,oBAtBqB,EAuBrB,oBAvBqB,EAwBrB,oBAxBqB,EAyBrB,oBAzBqB,EA0BrB,UA1BqB,EA2BrB,YA3BqB,EA4BrB,YA5BqB,EA6BrB,gBA7BqB,EA8BrB,YA9BqB,EA+BrB,gBA/BqB,EAgCrB,aAhCqB,EAiCrB,aAjCqB,EAkCrB,aAlCqB,EAmCrB,cAnCqB,EAoCrB,cApCqB,EAqCrB,cArCqB,EAsCrB,eAtCqB,EAuCrB,eAvCqB,EAwCrB,cAxCqB,EAyCrB,eAzCqB,EA0CrB,eA1CqB,EA2CrB,W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A5B,MAAMW,MAAI,sBAAV;AACHT,EAAAA,iBAAiB,CAACS,MAAD,CAAjB,GAA0BU,QAA1B;AACD;;AAED,qCAAmBpB,cAAnB,yCAAmC;AAA9B,MAAMU,OAAI,wBAAV;AACHT,EAAAA,iBAAiB,CAACS,OAAD,CAAjB,GAA0BW,YAA1B;AACD;;AAED,SAASC,cAAT,CAAwBC,QAAxB,EAAgE;AAC9D,MAAI,CAACA,QAAL,EAAe,OAAOC,wBAAP;AAEf,MAAMC,IAAI,GAAGxB,iBAAiB,CAACsB,QAAD,CAA9B;AACA,MAAIE,IAAJ,EAAU,OAAOA,IAAP;AAEV,SAAOD,wBAAP;AACD;;AAOM,IAAME,QAAiC,GAAG,SAApCA,QAAoC,OAAwB;AAAA,MAArBH,QAAqB,QAArBA,QAAqB;AAAA,MAAXI,IAAW,QAAXA,IAAW;;AACvE,kBAMI,6BANJ;AAAA,MAGcC,IAHd,aACEC,KADF,CAEIC,aAFJ,CAGMC,IAHN,CAGcH,IAHd;;AAQA,MAAMH,IAAI,GAAGH,cAAc,CAACC,QAAD,CAA3B;AAEA,SAAO,gCAAC,IAAD,gCAAWI,IAAI,GAAG;AAAEK,IAAAA,MAAM,EAAEL,IAAV;AAAgBM,IAAAA,KAAK,EAAEN;AAAvB,GAAH,GAAmC,EAAlD,EAA2DC,IAA3D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAAP;AACD,CAZM;;;AAcPF,QAAQ,CAACQ,WAAT,GAAuB,qCAAvB","sourcesContent":["import React from 'react';\n\nimport { useTheme } from '../../contexts/themeContext/ThemeContext';\n\nimport { Audio } from '../../icons/Audio';\nimport { CSV } from '../../icons/CSV';\nimport { DOC } from '../../icons/DOC';\nimport { DOCX } from '../../icons/DOCX';\nimport { GenericFile } from '../../icons/GenericFile';\nimport { HTML } from '../../icons/HTML';\nimport { MD } from '../../icons/MD';\nimport { ODT } from '../../icons/ODT';\nimport { PDF } from '../../icons/PDF';\nimport { PPT } from '../../icons/PPT';\nimport { PPTX } from '../../icons/PPTX';\nimport { RAR } from '../../icons/RAR';\nimport { RTF } from '../../icons/RTF';\nimport { SEVEN_Z } from '../../icons/SEVEN_Z';\nimport { TAR } from '../../icons/TAR';\nimport { TXT } from '../../icons/TXT';\nimport type { IconProps } from '../../icons/utils/base';\nimport { Video } from '../../icons/Video';\nimport { XLS } from '../../icons/XLS';\nimport { XLSX } from '../../icons/XLSX';\nimport { ZIP } from '../../icons/ZIP';\n\n// https://www.iana.org/assignments/media-types/media-types.xhtml#audio\nconst audioFileTypes = [\n 'audio/1d-interleaved-parityfec',\n 'audio/32kadpcm',\n 'audio/3gpp',\n 'audio/3gpp2',\n 'audio/aac',\n 'audio/ac3',\n 'audio/AMR',\n 'audio/AMR-WB',\n 'audio/amr-wb+',\n 'audio/aptx',\n 'audio/asc',\n 'audio/ATRAC-ADVANCED-LOSSLESS',\n 'audio/ATRAC-X',\n 'audio/ATRAC3',\n 'audio/basic',\n 'audio/BV16',\n 'audio/BV32',\n 'audio/clearmode',\n 'audio/CN',\n 'audio/DAT12',\n 'audio/dls',\n 'audio/dsr-es201108',\n 'audio/dsr-es202050',\n 'audio/dsr-es202211',\n 'audio/dsr-es202212',\n 'audio/DV',\n 'audio/DVI4',\n 'audio/eac3',\n 'audio/encaprtp',\n 'audio/EVRC',\n 'audio/EVRC-QCP',\n 'audio/EVRC0',\n 'audio/EVRC1',\n 'audio/EVRCB',\n 'audio/EVRCB0',\n 'audio/EVRCB1',\n 'audio/EVRCNW',\n 'audio/EVRCNW0',\n 'audio/EVRCNW1',\n 'audio/EVRCWB',\n 'audio/EVRCWB0',\n 'audio/EVRCWB1',\n 'audio/EVS',\n 'audio/example',\n 'audio/flexfec',\n 'audio/fwdred',\n 'audio/G711-0',\n 'audio/G719',\n 'audio/G7221',\n 'audio/G722',\n 'audio/G723',\n 'audio/G726-16',\n 'audio/G726-24',\n 'audio/G726-32',\n 'audio/G726-40',\n 'audio/G728',\n 'audio/G729',\n 'audio/G7291',\n 'audio/G729D',\n 'audio/G729E',\n 'audio/GSM',\n 'audio/GSM-EFR',\n 'audio/GSM-HR-08',\n 'audio/iLBC',\n 'audio/ip-mr_v2.5',\n 'audio/L8',\n 'audio/L16',\n 'audio/L20',\n 'audio/L24',\n 'audio/LPC',\n 'audio/MELP',\n 'audio/MELP600',\n 'audio/MELP1200',\n 'audio/MELP2400',\n 'audio/mhas',\n 'audio/mobile-xmf',\n 'audio/MPA',\n 'audio/mp4',\n 'audio/MP4A-LATM',\n 'audio/mpa-robust',\n 'audio/mpeg',\n 'audio/mpeg4-generic',\n 'audio/ogg',\n 'audio/opus',\n 'audio/parityfec',\n 'audio/PCMA',\n 'audio/PCMA-WB',\n 'audio/PCMU',\n 'audio/PCMU-WB',\n 'audio/prs.sid',\n 'audio/raptorfec',\n 'audio/RED',\n 'audio/rtp-enc-aescm128',\n 'audio/rtploopback',\n 'audio/rtp-midi',\n 'audio/rtx',\n 'audio/SMV',\n 'audio/SMV0',\n 'audio/SMV-QCP',\n 'audio/sofa',\n 'audio/sp-midi',\n 'audio/speex',\n 'audio/t140c',\n 'audio/t38',\n 'audio/telephone-event',\n 'audio/TETRA_ACELP',\n 'audio/TETRA_ACELP_BB',\n 'audio/tone',\n 'audio/TSVCIS',\n 'audio/UEMCLIP',\n 'audio/ulpfec',\n 'audio/usac',\n 'audio/VDVI',\n 'audio/VMR-WB',\n 'audio/vnd.3gpp.iufp',\n 'audio/vnd.4SB',\n 'audio/vnd.audiokoz',\n 'audio/vnd.CELP',\n 'audio/vnd.cisco.nse',\n 'audio/vnd.cmles.radio-events',\n 'audio/vnd.cns.anp1',\n 'audio/vnd.cns.inf1',\n 'audio/vnd.dece.audio',\n 'audio/vnd.digital-winds',\n 'audio/vnd.dlna.adts',\n 'audio/vnd.dolby.heaac.1',\n 'audio/vnd.dolby.heaac.2',\n 'audio/vnd.dolby.mlp',\n 'audio/vnd.dolby.mps',\n 'audio/vnd.dolby.pl2',\n 'audio/vnd.dolby.pl2x',\n 'audio/vnd.dolby.pl2z',\n 'audio/vnd.dolby.pulse.1',\n 'audio/vnd.dra',\n 'audio/vnd.dts',\n 'audio/vnd.dts.hd',\n 'audio/vnd.dts.uhd',\n 'audio/vnd.dvb.file',\n 'audio/vnd.everad.plj',\n 'audio/vnd.hns.audio',\n 'audio/vnd.lucent.voice',\n 'audio/vnd.ms-playready.media.pya',\n 'audio/vnd.nokia.mobile-xmf',\n 'audio/vnd.nortel.vbk',\n 'audio/vnd.nuera.ecelp4800',\n 'audio/vnd.nuera.ecelp7470',\n 'audio/vnd.nuera.ecelp9600',\n 'audio/vnd.octel.sbc',\n 'audio/vnd.presonus.multitrack',\n 'audio/vnd.qcelp',\n 'audio/vnd.rhetorex.32kadpcm',\n 'audio/vnd.rip',\n 'audio/vnd.sealedmedia.softseal.mpeg',\n 'audio/vnd.vmx.cvsd',\n 'audio/vorbis',\n 'audio/vorbis-config',\n];\n\n// Partially based on:\n// https://stackoverflow.com/a/4212908/2570866\n\nconst docMimeTypes = [\n // Microsoft Word\n // .doc .dot\n 'application/msword',\n // .doc .dot\n 'application/msword-template',\n\n // LibreOffice/OpenOffice Writer\n // .odt\n 'application/vnd.oasis.opendocument.text',\n // .ott\n 'application/vnd.oasis.opendocument.text-template',\n // .fodt\n 'application/vnd.oasis.opendocument.text-flat-xml',\n // .uot\n // NOTE: firefox doesn't know mimetype so maybe ignore\n];\n\nconst docXMimeTypes = [\n // Microsoft Word\n // .docx\n 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',\n // .dotx (no test)\n 'application/vnd.openxmlformats-officedocument.wordprocessingml.template',\n // .docm\n 'application/vnd.ms-word.document.macroEnabled.12',\n // .dotm (no test)\n 'application/vnd.ms-word.template.macroEnabled.12',\n];\n\nconst excelMimeTypes = [\n // Microsoft Excel\n // .xls .xlt .xla (no test for .xla)\n 'application/vnd.ms-excel',\n\n // LibreOffice/OpenOffice Calc\n // .ods\n 'application/vnd.oasis.opendocument.spreadsheet',\n // .ots\n 'application/vnd.oasis.opendocument.spreadsheet-template',\n // .fods\n 'application/vnd.oasis.opendocument.spreadsheet-flat-xml',\n];\n\nconst excelXMimeTypes = [\n // .xlsx\n 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\n // .xltx (no test)\n 'application/vnd.openxmlformats-officedocument.spreadsheetml.template',\n // .xlsm\n 'application/vnd.ms-excel.sheet.macroEnabled.12',\n // .xltm (no test)\n 'application/vnd.ms-excel.template.macroEnabled.12',\n // .xlam (no test)\n 'application/vnd.ms-excel.addin.macroEnabled.12',\n // .xlsb (no test)\n 'application/vnd.ms-excel.addin.macroEnabled.12',\n];\n\nconst odtMimeTypes = [\n // LibreOffice/OpenOffice Writer\n // .odt\n 'application/vnd.oasis.opendocument.text',\n // .ott\n 'application/vnd.oasis.opendocument.text-template',\n // .fodt\n 'application/vnd.oasis.opendocument.text-flat-xml',\n];\n\nconst powerpointMimeTypes = [\n // Microsoft Word\n // .ppt .pot .pps .ppa (no test for .ppa)\n 'application/vnd.ms-powerpoint',\n\n // LibreOffice/OpenOffice Writer\n // .odp\n 'application/vnd.oasis.opendocument.presentation',\n // .otp\n 'application/vnd.oasis.opendocument.presentation-template',\n // .fodp\n 'application/vnd.oasis.opendocument.presentation-flat-xml',\n // .uop\n // NOTE: firefox doesn't know mimetype so maybe ignore\n];\n\nconst powerpointXMimeTypes = [\n // .pptx\n 'application/vnd.openxmlformats-officedocument.presentationml.presentation',\n // .potx (no test)\n 'application/vnd.openxmlformats-officedocument.presentationml.template',\n // .ppsx\n 'application/vnd.openxmlformats-officedocument.presentationml.slideshow',\n // .ppam\n 'application/vnd.ms-powerpoint.addin.macroEnabled.12',\n // .pptm\n 'application/vnd.ms-powerpoint.presentation.macroEnabled.12',\n // .potm\n 'application/vnd.ms-powerpoint.template.macroEnabled.12',\n // .ppsm\n 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12',\n];\n\nconst tarFileTypes = [\n // .ar\n 'application/x-archive',\n // .tar\n 'application/x-tar',\n // .tar.gz\n 'application/gzip',\n // .tar.Z\n 'application/x-compress',\n // .tar.bz2\n 'application/x-bzip',\n // .tar.lz\n 'application/x-lzip',\n // .tar.lz4\n 'application/x-lz4',\n // .tar.lzma\n 'application/x-lzma',\n // .tar.lzo (no test)\n 'application/x-lzop',\n // .tar.xz\n 'application/x-xz',\n // .war\n 'application/x-webarchive',\n];\n\nconst zipFileTypes = [\n // .gzip\n 'application/gzip',\n // .zip\n 'application/zip',\n];\n\nconst videoFileTypes = [\n 'video/3g2',\n 'video/3gp',\n 'video/aaf',\n 'video/asf',\n 'video/avchd',\n 'video/avi',\n 'video/drc',\n 'video/flv',\n 'video/m2v',\n 'video/m3u8',\n 'video/m4p',\n 'video/m4v',\n 'video/mkv',\n 'video/mng',\n 'video/mov',\n 'video/mp2',\n 'video/mp4',\n 'video/mpe',\n 'video/mpeg',\n 'video/mpg',\n 'video/mpv',\n 'video/mxf',\n 'video/nsv',\n 'video/ogg',\n 'video/ogv',\n 'video/qt',\n 'video/rm',\n 'video/rmvb',\n 'video/roq',\n 'video/svi',\n 'video/vob',\n 'video/webm',\n 'video/wmv',\n 'video/yuv',\n 'video/quicktime',\n 'video/webm',\n 'video/x-flv',\n];\n\nconst mimeTypeToIconMap: Record<string, React.FC<IconProps>> = {\n 'application/pdf': PDF, // .pdf\n 'application/rtf': RTF, // .rtf\n 'application/vnd.rar': RAR, // .rar\n 'application/x-7z-compressed': SEVEN_Z, // .z7\n 'text/csv': CSV, // .csv\n 'text/html': HTML, // .html .htm\n 'text/markdown': MD, // .md\n 'text/plain': TXT, // .txt\n};\n\nfor (const type of audioFileTypes) {\n mimeTypeToIconMap[type] = Audio;\n}\n\nfor (const type of docMimeTypes) {\n mimeTypeToIconMap[type] = DOC;\n}\n\nfor (const type of docXMimeTypes) {\n mimeTypeToIconMap[type] = DOCX;\n}\n\nfor (const type of excelMimeTypes) {\n mimeTypeToIconMap[type] = XLS;\n}\n\nfor (const type of excelXMimeTypes) {\n mimeTypeToIconMap[type] = XLSX;\n}\n\nfor (const type of odtMimeTypes) {\n mimeTypeToIconMap[type] = ODT;\n}\n\nfor (const type of powerpointMimeTypes) {\n mimeTypeToIconMap[type] = PPT;\n}\n\nfor (const type of powerpointXMimeTypes) {\n mimeTypeToIconMap[type] = PPTX;\n}\n\nfor (const type of tarFileTypes) {\n mimeTypeToIconMap[type] = TAR;\n}\n\nfor (const type of zipFileTypes) {\n mimeTypeToIconMap[type] = ZIP;\n}\n\nfor (const type of videoFileTypes) {\n mimeTypeToIconMap[type] = Video;\n}\n\nfunction mimeTypeToIcon(mimeType?: string): React.FC<IconProps> {\n if (!mimeType) return GenericFile;\n\n const Icon = mimeTypeToIconMap[mimeType];\n if (Icon) return Icon;\n\n return GenericFile;\n}\n\nexport type FileIconProps = {\n mimeType?: string;\n size?: number;\n};\n\nexport const FileIcon: React.FC<FileIconProps> = ({ mimeType, size }) => {\n const {\n theme: {\n messageSimple: {\n file: { icon },\n },\n },\n } = useTheme();\n\n const Icon = mimeTypeToIcon(mimeType);\n\n return <Icon {...(size ? { height: size, width: size } : {})} {...icon} />;\n};\n\nFileIcon.displayName = 'FileIcon{messageSimple{file{icon}}}';\n"]}
@@ -21,10 +21,18 @@ var _reactNative = require("react-native");
21
21
 
22
22
  var _bottomSheet = _interopRequireWildcard(require("@gorhom/bottom-sheet"));
23
23
 
24
+ var _dayjs = _interopRequireDefault(require("dayjs"));
25
+
26
+ var _duration = _interopRequireDefault(require("dayjs/plugin/duration"));
27
+
28
+ var _mimeTypes = require("mime-types");
29
+
24
30
  var _AttachmentPickerContext = require("../../contexts/attachmentPickerContext/AttachmentPickerContext");
25
31
 
26
32
  var _ThemeContext = require("../../contexts/themeContext/ThemeContext");
27
33
 
34
+ var _icons = require("../../icons");
35
+
28
36
  var _native = require("../../native");
29
37
 
30
38
  var _utils = require("../../utils/utils");
@@ -36,13 +44,27 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
36
44
 
37
45
  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; }
38
46
 
47
+ _dayjs["default"].extend(_duration["default"]);
48
+
39
49
  var styles = _reactNative.StyleSheet.create({
40
50
  container: {
41
51
  flexGrow: 1
42
52
  },
53
+ durationText: {
54
+ fontWeight: 'bold'
55
+ },
43
56
  overlay: {
44
57
  alignItems: 'flex-end',
45
58
  flex: 1
59
+ },
60
+ videoView: {
61
+ bottom: 5,
62
+ display: 'flex',
63
+ flexDirection: 'row',
64
+ justifyContent: 'space-between',
65
+ paddingHorizontal: 5,
66
+ position: 'absolute',
67
+ width: '100%'
46
68
  }
47
69
  });
48
70
 
@@ -50,27 +72,72 @@ var screenHeight = (0, _utils.vh)(100);
50
72
 
51
73
  var fullScreenHeight = _reactNative.Dimensions.get('window').height;
52
74
 
53
- var AttachmentImage = function AttachmentImage(props) {
54
- var ImageOverlaySelectedComponent = props.ImageOverlaySelectedComponent,
75
+ var AttachmentVideo = function AttachmentVideo(props) {
76
+ var asset = props.asset,
77
+ ImageOverlaySelectedComponent = props.ImageOverlaySelectedComponent,
78
+ maxNumberOfFiles = props.maxNumberOfFiles,
55
79
  numberOfAttachmentPickerImageColumns = props.numberOfAttachmentPickerImageColumns,
56
- onPress = props.onPress,
57
80
  selected = props.selected,
58
- uri = props.uri;
81
+ setSelectedFiles = props.setSelectedFiles;
59
82
 
60
83
  var _useTheme = (0, _ThemeContext.useTheme)(),
61
84
  _useTheme$theme = _useTheme.theme,
62
85
  _useTheme$theme$attac = _useTheme$theme.attachmentPicker,
86
+ durationText = _useTheme$theme$attac.durationText,
63
87
  image = _useTheme$theme$attac.image,
64
88
  imageOverlay = _useTheme$theme$attac.imageOverlay,
65
- overlay = _useTheme$theme.colors.overlay;
89
+ _useTheme$theme$color = _useTheme$theme.colors,
90
+ overlay = _useTheme$theme$color.overlay,
91
+ white = _useTheme$theme$color.white;
92
+
93
+ var duration = asset.duration,
94
+ playableDuration = asset.playableDuration,
95
+ uri = asset.uri;
96
+ var videoDuration = duration ? duration : playableDuration;
97
+ var ONE_HOUR_IN_SECONDS = 3600;
98
+ var durationLabel = '00:00';
99
+
100
+ if (videoDuration) {
101
+ var isDurationLongerThanHour = videoDuration / ONE_HOUR_IN_SECONDS >= 1;
102
+ var formattedDurationParam = isDurationLongerThanHour ? 'HH:mm:ss' : 'mm:ss';
103
+
104
+ var formattedVideoDuration = _dayjs["default"].duration(videoDuration, 'second').format(formattedDurationParam);
105
+
106
+ durationLabel = formattedVideoDuration;
107
+ }
66
108
 
67
109
  var size = (0, _utils.vw)(100) / (numberOfAttachmentPickerImageColumns || 3) - 2;
110
+
111
+ var onPressVideo = function onPressVideo() {
112
+ if (selected) {
113
+ setSelectedFiles(function (files) {
114
+ return files.filter(function (file) {
115
+ return file.uri !== asset.uri;
116
+ });
117
+ });
118
+ } else {
119
+ setSelectedFiles(function (files) {
120
+ if (files.length >= maxNumberOfFiles) {
121
+ return files;
122
+ }
123
+
124
+ return [].concat((0, _toConsumableArray2["default"])(files), [{
125
+ duration: durationLabel,
126
+ name: asset.filename,
127
+ size: asset.fileSize,
128
+ type: 'video',
129
+ uri: asset.uri
130
+ }]);
131
+ });
132
+ }
133
+ };
134
+
68
135
  return _react["default"].createElement(_bottomSheet.TouchableOpacity, {
69
- onPress: onPress,
136
+ onPress: onPressVideo,
70
137
  __self: _this,
71
138
  __source: {
72
139
  fileName: _jsxFileName,
73
- lineNumber: 65,
140
+ lineNumber: 136,
74
141
  columnNumber: 5
75
142
  }
76
143
  }, _react["default"].createElement(_reactNative.ImageBackground, {
@@ -85,7 +152,7 @@ var AttachmentImage = function AttachmentImage(props) {
85
152
  __self: _this,
86
153
  __source: {
87
154
  fileName: _jsxFileName,
88
- lineNumber: 66,
155
+ lineNumber: 137,
89
156
  columnNumber: 7
90
157
  }
91
158
  }, selected && _react["default"].createElement(_reactNative.View, {
@@ -95,29 +162,66 @@ var AttachmentImage = function AttachmentImage(props) {
95
162
  __self: _this,
96
163
  __source: {
97
164
  fileName: _jsxFileName,
98
- lineNumber: 78,
165
+ lineNumber: 149,
99
166
  columnNumber: 11
100
167
  }
101
168
  }, _react["default"].createElement(ImageOverlaySelectedComponent, {
102
169
  __self: _this,
103
170
  __source: {
104
171
  fileName: _jsxFileName,
105
- lineNumber: 79,
172
+ lineNumber: 150,
106
173
  columnNumber: 13
107
174
  }
108
- }))));
175
+ })), _react["default"].createElement(_reactNative.View, {
176
+ style: styles.videoView,
177
+ __self: _this,
178
+ __source: {
179
+ fileName: _jsxFileName,
180
+ lineNumber: 153,
181
+ columnNumber: 9
182
+ }
183
+ }, _react["default"].createElement(_icons.Recorder, {
184
+ height: 20,
185
+ pathFill: white,
186
+ width: 25,
187
+ __self: _this,
188
+ __source: {
189
+ fileName: _jsxFileName,
190
+ lineNumber: 154,
191
+ columnNumber: 11
192
+ }
193
+ }), videoDuration ? _react["default"].createElement(_reactNative.Text, {
194
+ style: [styles.durationText, durationText, {
195
+ color: white
196
+ }],
197
+ __self: _this,
198
+ __source: {
199
+ fileName: _jsxFileName,
200
+ lineNumber: 156,
201
+ columnNumber: 13
202
+ }
203
+ }, durationLabel) : null)));
109
204
  };
110
205
 
111
- var renderImage = function renderImage(_ref) {
112
- var item = _ref.item;
113
- var asset = item.asset,
114
- ImageOverlaySelectedComponent = item.ImageOverlaySelectedComponent,
115
- maxNumberOfFiles = item.maxNumberOfFiles,
116
- numberOfAttachmentPickerImageColumns = item.numberOfAttachmentPickerImageColumns,
117
- selected = item.selected,
118
- setSelectedImages = item.setSelectedImages;
206
+ var AttachmentImage = function AttachmentImage(props) {
207
+ var asset = props.asset,
208
+ ImageOverlaySelectedComponent = props.ImageOverlaySelectedComponent,
209
+ maxNumberOfFiles = props.maxNumberOfFiles,
210
+ numberOfAttachmentPickerImageColumns = props.numberOfAttachmentPickerImageColumns,
211
+ selected = props.selected,
212
+ setSelectedImages = props.setSelectedImages;
213
+
214
+ var _useTheme2 = (0, _ThemeContext.useTheme)(),
215
+ _useTheme2$theme = _useTheme2.theme,
216
+ _useTheme2$theme$atta = _useTheme2$theme.attachmentPicker,
217
+ image = _useTheme2$theme$atta.image,
218
+ imageOverlay = _useTheme2$theme$atta.imageOverlay,
219
+ overlay = _useTheme2$theme.colors.overlay;
220
+
221
+ var size = (0, _utils.vw)(100) / (numberOfAttachmentPickerImageColumns || 3) - 2;
222
+ var uri = asset.uri;
119
223
 
120
- var onPress = function onPress() {
224
+ var onPressImage = function onPressImage() {
121
225
  if (selected) {
122
226
  setSelectedImages(function (images) {
123
227
  return images.filter(function (image) {
@@ -135,16 +239,84 @@ var renderImage = function renderImage(_ref) {
135
239
  }
136
240
  };
137
241
 
138
- return _react["default"].createElement(AttachmentImage, {
242
+ return _react["default"].createElement(_bottomSheet.TouchableOpacity, {
243
+ onPress: onPressImage,
244
+ __self: _this,
245
+ __source: {
246
+ fileName: _jsxFileName,
247
+ lineNumber: 200,
248
+ columnNumber: 5
249
+ }
250
+ }, _react["default"].createElement(_reactNative.ImageBackground, {
251
+ source: {
252
+ uri: uri
253
+ },
254
+ style: [{
255
+ height: size,
256
+ margin: 1,
257
+ width: size
258
+ }, image],
259
+ __self: _this,
260
+ __source: {
261
+ fileName: _jsxFileName,
262
+ lineNumber: 201,
263
+ columnNumber: 7
264
+ }
265
+ }, selected && _react["default"].createElement(_reactNative.View, {
266
+ style: [styles.overlay, {
267
+ backgroundColor: overlay
268
+ }, imageOverlay],
269
+ __self: _this,
270
+ __source: {
271
+ fileName: _jsxFileName,
272
+ lineNumber: 213,
273
+ columnNumber: 11
274
+ }
275
+ }, _react["default"].createElement(ImageOverlaySelectedComponent, {
276
+ __self: _this,
277
+ __source: {
278
+ fileName: _jsxFileName,
279
+ lineNumber: 214,
280
+ columnNumber: 13
281
+ }
282
+ }))));
283
+ };
284
+
285
+ var renderImage = function renderImage(_ref) {
286
+ var item = _ref.item;
287
+ var asset = item.asset,
288
+ ImageOverlaySelectedComponent = item.ImageOverlaySelectedComponent,
289
+ maxNumberOfFiles = item.maxNumberOfFiles,
290
+ numberOfAttachmentPickerImageColumns = item.numberOfAttachmentPickerImageColumns,
291
+ selected = item.selected,
292
+ setSelectedFiles = item.setSelectedFiles,
293
+ setSelectedImages = item.setSelectedImages;
294
+ var contentType = (0, _mimeTypes.lookup)(asset.filename) || 'multipart/form-data';
295
+ var fileType = asset.filename ? contentType.startsWith('image/') ? 'image' : 'video' : asset.type === 'video' ? 'video' : 'image';
296
+ return fileType === 'image' ? _react["default"].createElement(AttachmentImage, {
297
+ asset: asset,
139
298
  ImageOverlaySelectedComponent: ImageOverlaySelectedComponent,
299
+ maxNumberOfFiles: maxNumberOfFiles,
140
300
  numberOfAttachmentPickerImageColumns: numberOfAttachmentPickerImageColumns,
141
- onPress: onPress,
142
301
  selected: selected,
143
- uri: asset.uri,
302
+ setSelectedImages: setSelectedImages,
144
303
  __self: _this,
145
304
  __source: {
146
305
  fileName: _jsxFileName,
147
- lineNumber: 121,
306
+ lineNumber: 256,
307
+ columnNumber: 5
308
+ }
309
+ }) : _react["default"].createElement(AttachmentVideo, {
310
+ asset: asset,
311
+ ImageOverlaySelectedComponent: ImageOverlaySelectedComponent,
312
+ maxNumberOfFiles: maxNumberOfFiles,
313
+ numberOfAttachmentPickerImageColumns: numberOfAttachmentPickerImageColumns,
314
+ selected: selected,
315
+ setSelectedFiles: setSelectedFiles,
316
+ __self: _this,
317
+ __source: {
318
+ fileName: _jsxFileName,
319
+ lineNumber: 265,
148
320
  columnNumber: 5
149
321
  }
150
322
  });
@@ -165,16 +337,18 @@ var AttachmentPicker = _react["default"].forwardRef(function (props, ref) {
165
337
  numberOfAttachmentPickerImageColumns = props.numberOfAttachmentPickerImageColumns,
166
338
  translucentStatusBar = props.translucentStatusBar;
167
339
 
168
- var _useTheme2 = (0, _ThemeContext.useTheme)(),
169
- _useTheme2$theme = _useTheme2.theme,
170
- bottomSheetContentContainer = _useTheme2$theme.attachmentPicker.bottomSheetContentContainer,
171
- white = _useTheme2$theme.colors.white;
340
+ var _useTheme3 = (0, _ThemeContext.useTheme)(),
341
+ _useTheme3$theme = _useTheme3.theme,
342
+ bottomSheetContentContainer = _useTheme3$theme.attachmentPicker.bottomSheetContentContainer,
343
+ white = _useTheme3$theme.colors.white;
172
344
 
173
345
  var _useAttachmentPickerC = (0, _AttachmentPickerContext.useAttachmentPickerContext)(),
174
346
  closePicker = _useAttachmentPickerC.closePicker,
175
347
  maxNumberOfFiles = _useAttachmentPickerC.maxNumberOfFiles,
348
+ selectedFiles = _useAttachmentPickerC.selectedFiles,
176
349
  selectedImages = _useAttachmentPickerC.selectedImages,
177
350
  selectedPicker = _useAttachmentPickerC.selectedPicker,
351
+ setSelectedFiles = _useAttachmentPickerC.setSelectedFiles,
178
352
  setSelectedImages = _useAttachmentPickerC.setSelectedImages,
179
353
  setSelectedPicker = _useAttachmentPickerC.setSelectedPicker,
180
354
  topInset = _useAttachmentPickerC.topInset;
@@ -209,13 +383,7 @@ var AttachmentPicker = _react["default"].forwardRef(function (props, ref) {
209
383
  photos = _useState12[0],
210
384
  setPhotos = _useState12[1];
211
385
 
212
- var hideAttachmentPicker = function hideAttachmentPicker() {
213
- setSelectedPicker(undefined);
214
-
215
- if (ref != null && ref.current) {
216
- ref.current.close();
217
- }
218
- };
386
+ var bottomSheetCloseOnKeyboardShowTimeout = (0, _react.useRef)();
219
387
 
220
388
  var getMorePhotos = function () {
221
389
  var _ref2 = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee() {
@@ -291,6 +459,19 @@ var AttachmentPicker = _react["default"].forwardRef(function (props, ref) {
291
459
  };
292
460
  }, [selectedPicker]);
293
461
  (0, _react.useEffect)(function () {
462
+ var hideAttachmentPicker = function hideAttachmentPicker() {
463
+ if (bottomSheetCloseOnKeyboardShowTimeout.current) {
464
+ clearTimeout(bottomSheetCloseOnKeyboardShowTimeout.current);
465
+ }
466
+
467
+ setSelectedPicker(undefined);
468
+ bottomSheetCloseOnKeyboardShowTimeout.current = setTimeout(function () {
469
+ var _current;
470
+
471
+ return (_current = ref.current) == null ? void 0 : _current.close();
472
+ }, 150);
473
+ };
474
+
294
475
  var keyboardSubscription = _reactNative.Platform.OS === 'ios' ? _reactNative.Keyboard.addListener('keyboardWillShow', hideAttachmentPicker) : _reactNative.Keyboard.addListener('keyboardDidShow', hideAttachmentPicker);
295
476
  return function () {
296
477
  if (keyboardSubscription != null && keyboardSubscription.remove) {
@@ -303,6 +484,10 @@ var AttachmentPicker = _react["default"].forwardRef(function (props, ref) {
303
484
  } else {
304
485
  _reactNative.Keyboard.removeListener('keyboardDidShow', hideAttachmentPicker);
305
486
  }
487
+
488
+ if (bottomSheetCloseOnKeyboardShowTimeout.current) {
489
+ clearTimeout(bottomSheetCloseOnKeyboardShowTimeout.current);
490
+ }
306
491
  };
307
492
  }, []);
308
493
  (0, _react.useEffect)(function () {
@@ -329,7 +514,10 @@ var AttachmentPicker = _react["default"].forwardRef(function (props, ref) {
329
514
  numberOfAttachmentPickerImageColumns: numberOfAttachmentPickerImageColumns,
330
515
  selected: selectedImages.some(function (image) {
331
516
  return image.uri === asset.uri;
517
+ }) || selectedFiles.some(function (file) {
518
+ return file.uri === asset.uri;
332
519
  }),
520
+ setSelectedFiles: setSelectedFiles,
333
521
  setSelectedImages: setSelectedImages
334
522
  };
335
523
  });
@@ -337,28 +525,24 @@ var AttachmentPicker = _react["default"].forwardRef(function (props, ref) {
337
525
  var statusBarHeight = (_StatusBar$currentHei = _reactNative.StatusBar.currentHeight) != null ? _StatusBar$currentHei : 0;
338
526
  var bottomBarHeight = fullScreenHeight - screenHeight - statusBarHeight;
339
527
  var androidBottomBarHeightAdjustment = _reactNative.Platform.OS === 'android' ? bottomBarHeight === statusBarHeight ? translucentStatusBar ? 0 : (_StatusBar$currentHei2 = _reactNative.StatusBar.currentHeight) != null ? _StatusBar$currentHei2 : 0 : translucentStatusBar ? bottomBarHeight > statusBarHeight ? -bottomBarHeight + statusBarHeight : bottomBarHeight > 0 ? -statusBarHeight : 0 : bottomBarHeight > 0 ? 0 : statusBarHeight : 0;
340
- var initialSnapPoint = (0, _react.useMemo)(function () {
341
- return (attachmentPickerBottomSheetHeight != null ? attachmentPickerBottomSheetHeight : _reactNative.Platform.OS === 'android') ? 308 + (fullScreenHeight - screenHeight + androidBottomBarHeightAdjustment) - handleHeight : 308 + (fullScreenHeight - screenHeight + androidBottomBarHeightAdjustment);
342
- }, [attachmentPickerBottomSheetHeight, androidBottomBarHeightAdjustment, fullScreenHeight, handleHeight, screenHeight]);
343
- var finalSnapPoint = (0, _react.useMemo)(function () {
344
- return _reactNative.Platform.OS === 'android' ? fullScreenHeight - topInset - handleHeight : fullScreenHeight - topInset;
345
- }, [fullScreenHeight, handleHeight, topInset]);
346
- var snapPoints = [initialSnapPoint, finalSnapPoint];
528
+ var initialSnapPoint = (attachmentPickerBottomSheetHeight != null ? attachmentPickerBottomSheetHeight : _reactNative.Platform.OS === 'android') ? 308 + (fullScreenHeight - screenHeight + androidBottomBarHeightAdjustment) - handleHeight : 308 + (fullScreenHeight - screenHeight + androidBottomBarHeightAdjustment);
529
+ var finalSnapPoint = _reactNative.Platform.OS === 'android' ? fullScreenHeight - topInset - handleHeight : fullScreenHeight - topInset;
530
+ var snapPoints = (0, _react.useMemo)(function () {
531
+ return [initialSnapPoint, finalSnapPoint];
532
+ }, [initialSnapPoint, finalSnapPoint]);
347
533
  return _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement(_bottomSheet["default"], {
348
534
  containerHeight: fullScreenHeight,
349
535
  enablePanDownToClose: true,
350
536
  handleComponent: photoError ? null : AttachmentPickerBottomSheetHandle,
351
537
  handleHeight: handleHeight,
352
538
  index: -1,
353
- onChange: function onChange(index) {
354
- return setCurrentIndex(index);
355
- },
539
+ onChange: setCurrentIndex,
356
540
  ref: ref,
357
541
  snapPoints: snapPoints,
358
542
  __self: _this,
359
543
  __source: {
360
544
  fileName: _jsxFileName,
361
- lineNumber: 361,
545
+ lineNumber: 511,
362
546
  columnNumber: 9
363
547
  }
364
548
  }, _react["default"].createElement(_bottomSheet.BottomSheetFlatList, {
@@ -377,7 +561,7 @@ var AttachmentPicker = _react["default"].forwardRef(function (props, ref) {
377
561
  __self: _this,
378
562
  __source: {
379
563
  fileName: _jsxFileName,
380
- lineNumber: 377,
564
+ lineNumber: 527,
381
565
  columnNumber: 11
382
566
  }
383
567
  })), selectedPicker === 'images' && photoError && _react["default"].createElement(AttachmentPickerError, {
@@ -388,7 +572,7 @@ var AttachmentPicker = _react["default"].forwardRef(function (props, ref) {
388
572
  __self: _this,
389
573
  __source: {
390
574
  fileName: _jsxFileName,
391
- lineNumber: 392,
575
+ lineNumber: 542,
392
576
  columnNumber: 11
393
577
  }
394
578
  }));