stream-chat-react-native-core 4.6.1 → 4.7.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/components/Attachment/Attachment.js +22 -13
- package/lib/commonjs/components/Attachment/Attachment.js.map +1 -1
- package/lib/commonjs/components/Attachment/Card.js +23 -14
- package/lib/commonjs/components/Attachment/Card.js.map +1 -1
- package/lib/commonjs/components/Attachment/Gallery.js +72 -37
- package/lib/commonjs/components/Attachment/Gallery.js.map +1 -1
- package/lib/commonjs/components/Attachment/VideoThumbnail.js +83 -0
- package/lib/commonjs/components/Attachment/VideoThumbnail.js.map +1 -0
- package/lib/commonjs/components/Attachment/hooks/useGoToURL.js +1 -1
- package/lib/commonjs/components/Attachment/hooks/useGoToURL.js.map +1 -1
- package/lib/commonjs/components/Attachment/utils/buildGallery/buildThumbnail.js +1 -0
- package/lib/commonjs/components/Attachment/utils/buildGallery/buildThumbnail.js.map +1 -1
- package/lib/commonjs/components/Attachment/utils/getAspectRatio.js +5 -5
- package/lib/commonjs/components/Attachment/utils/getAspectRatio.js.map +1 -1
- package/lib/commonjs/components/Channel/Channel.js +19 -14
- package/lib/commonjs/components/Channel/Channel.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useCreateMessagesContext.js +4 -2
- package/lib/commonjs/components/Channel/hooks/useCreateMessagesContext.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewDisplayName.js +43 -28
- package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewDisplayName.js.map +1 -1
- package/lib/commonjs/components/Chat/hooks/useIsOnline.js +6 -6
- package/lib/commonjs/components/Chat/hooks/useIsOnline.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/ImageGallery.js +167 -345
- package/lib/commonjs/components/ImageGallery/ImageGallery.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryImage.js +4 -4
- package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryImage.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryVideo.js +225 -0
- package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryVideo.js.map +1 -0
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryFooter.js +102 -40
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryFooter.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryVideoControl.js +145 -0
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryVideoControl.js.map +1 -0
- package/lib/commonjs/components/ImageGallery/components/ImageGrid.js +31 -34
- package/lib/commonjs/components/ImageGallery/components/ImageGrid.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/components/ProgressControl.js +153 -0
- package/lib/commonjs/components/ImageGallery/components/ProgressControl.js.map +1 -0
- package/lib/commonjs/components/ImageGallery/hooks/useImageGalleryGestures.js +373 -0
- package/lib/commonjs/components/ImageGallery/hooks/useImageGalleryGestures.js.map +1 -0
- package/lib/commonjs/components/Message/Message.js +23 -13
- package/lib/commonjs/components/Message/Message.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/utils/renderText.js +22 -15
- package/lib/commonjs/components/Message/MessageSimple/utils/renderText.js.map +1 -1
- package/lib/commonjs/components/Message/hooks/useCreateMessageContext.js +4 -2
- package/lib/commonjs/components/Message/hooks/useCreateMessageContext.js.map +1 -1
- package/lib/commonjs/components/MessageOverlay/MessageOverlay.js +25 -23
- package/lib/commonjs/components/MessageOverlay/MessageOverlay.js.map +1 -1
- package/lib/commonjs/components/Reply/Reply.js +32 -12
- package/lib/commonjs/components/Reply/Reply.js.map +1 -1
- package/lib/commonjs/components/Spinner/Spinner.js +12 -4
- package/lib/commonjs/components/Spinner/Spinner.js.map +1 -1
- package/lib/commonjs/components/index.js +26 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/contexts/messageContext/MessageContext.js +2 -2
- package/lib/commonjs/contexts/messageContext/MessageContext.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js +15 -4
- package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/commonjs/contexts/messageOverlayContext/MessageOverlayContext.js +2 -2
- package/lib/commonjs/contexts/messageOverlayContext/MessageOverlayContext.js.map +1 -1
- package/lib/commonjs/contexts/messagesContext/MessagesContext.js +2 -2
- package/lib/commonjs/contexts/messagesContext/MessagesContext.js.map +1 -1
- package/lib/commonjs/contexts/themeContext/utils/theme.js +10 -1
- package/lib/commonjs/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/commonjs/icons/Pause.js +61 -0
- package/lib/commonjs/icons/Pause.js.map +1 -0
- package/lib/commonjs/icons/Play.js +42 -0
- package/lib/commonjs/icons/Play.js.map +1 -0
- package/lib/commonjs/icons/index.js +26 -0
- package/lib/commonjs/icons/index.js.map +1 -1
- package/lib/commonjs/mock-builders/api/queryMembers.js +98 -1
- package/lib/commonjs/mock-builders/api/queryMembers.js.map +1 -1
- package/lib/commonjs/native.js +7 -1
- package/lib/commonjs/native.js.map +1 -1
- package/lib/commonjs/utils/getUrlOfImageAttachment.js +1 -1
- package/lib/commonjs/utils/getUrlOfImageAttachment.js.map +1 -1
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/Attachment/Attachment.js +22 -13
- package/lib/module/components/Attachment/Attachment.js.map +1 -1
- package/lib/module/components/Attachment/Card.js +23 -14
- package/lib/module/components/Attachment/Card.js.map +1 -1
- package/lib/module/components/Attachment/Gallery.js +72 -37
- package/lib/module/components/Attachment/Gallery.js.map +1 -1
- package/lib/module/components/Attachment/VideoThumbnail.js +83 -0
- package/lib/module/components/Attachment/VideoThumbnail.js.map +1 -0
- package/lib/module/components/Attachment/hooks/useGoToURL.js +1 -1
- package/lib/module/components/Attachment/hooks/useGoToURL.js.map +1 -1
- package/lib/module/components/Attachment/utils/buildGallery/buildThumbnail.js +1 -0
- package/lib/module/components/Attachment/utils/buildGallery/buildThumbnail.js.map +1 -1
- package/lib/module/components/Attachment/utils/getAspectRatio.js +5 -5
- package/lib/module/components/Attachment/utils/getAspectRatio.js.map +1 -1
- package/lib/module/components/Channel/Channel.js +19 -14
- package/lib/module/components/Channel/Channel.js.map +1 -1
- package/lib/module/components/Channel/hooks/useCreateMessagesContext.js +4 -2
- package/lib/module/components/Channel/hooks/useCreateMessagesContext.js.map +1 -1
- package/lib/module/components/ChannelPreview/hooks/useChannelPreviewDisplayName.js +43 -28
- package/lib/module/components/ChannelPreview/hooks/useChannelPreviewDisplayName.js.map +1 -1
- package/lib/module/components/Chat/hooks/useIsOnline.js +6 -6
- package/lib/module/components/Chat/hooks/useIsOnline.js.map +1 -1
- package/lib/module/components/ImageGallery/ImageGallery.js +167 -345
- package/lib/module/components/ImageGallery/ImageGallery.js.map +1 -1
- package/lib/module/components/ImageGallery/components/AnimatedGalleryImage.js +4 -4
- package/lib/module/components/ImageGallery/components/AnimatedGalleryImage.js.map +1 -1
- package/lib/module/components/ImageGallery/components/AnimatedGalleryVideo.js +225 -0
- package/lib/module/components/ImageGallery/components/AnimatedGalleryVideo.js.map +1 -0
- package/lib/module/components/ImageGallery/components/ImageGalleryFooter.js +102 -40
- package/lib/module/components/ImageGallery/components/ImageGalleryFooter.js.map +1 -1
- package/lib/module/components/ImageGallery/components/ImageGalleryVideoControl.js +145 -0
- package/lib/module/components/ImageGallery/components/ImageGalleryVideoControl.js.map +1 -0
- package/lib/module/components/ImageGallery/components/ImageGrid.js +31 -34
- package/lib/module/components/ImageGallery/components/ImageGrid.js.map +1 -1
- package/lib/module/components/ImageGallery/components/ProgressControl.js +153 -0
- package/lib/module/components/ImageGallery/components/ProgressControl.js.map +1 -0
- package/lib/module/components/ImageGallery/hooks/useImageGalleryGestures.js +373 -0
- package/lib/module/components/ImageGallery/hooks/useImageGalleryGestures.js.map +1 -0
- package/lib/module/components/Message/Message.js +23 -13
- package/lib/module/components/Message/Message.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/utils/renderText.js +22 -15
- package/lib/module/components/Message/MessageSimple/utils/renderText.js.map +1 -1
- package/lib/module/components/Message/hooks/useCreateMessageContext.js +4 -2
- package/lib/module/components/Message/hooks/useCreateMessageContext.js.map +1 -1
- package/lib/module/components/MessageOverlay/MessageOverlay.js +25 -23
- package/lib/module/components/MessageOverlay/MessageOverlay.js.map +1 -1
- package/lib/module/components/Reply/Reply.js +32 -12
- package/lib/module/components/Reply/Reply.js.map +1 -1
- package/lib/module/components/Spinner/Spinner.js +12 -4
- package/lib/module/components/Spinner/Spinner.js.map +1 -1
- package/lib/module/components/index.js +26 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/contexts/messageContext/MessageContext.js +2 -2
- package/lib/module/contexts/messageContext/MessageContext.js.map +1 -1
- package/lib/module/contexts/messageInputContext/MessageInputContext.js +15 -4
- package/lib/module/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/module/contexts/messageOverlayContext/MessageOverlayContext.js +2 -2
- package/lib/module/contexts/messageOverlayContext/MessageOverlayContext.js.map +1 -1
- package/lib/module/contexts/messagesContext/MessagesContext.js +2 -2
- package/lib/module/contexts/messagesContext/MessagesContext.js.map +1 -1
- package/lib/module/contexts/themeContext/utils/theme.js +10 -1
- package/lib/module/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/module/icons/Pause.js +61 -0
- package/lib/module/icons/Pause.js.map +1 -0
- package/lib/module/icons/Play.js +42 -0
- package/lib/module/icons/Play.js.map +1 -0
- package/lib/module/icons/index.js +26 -0
- package/lib/module/icons/index.js.map +1 -1
- package/lib/module/mock-builders/api/queryMembers.js +98 -1
- package/lib/module/mock-builders/api/queryMembers.js.map +1 -1
- package/lib/module/native.js +7 -1
- package/lib/module/native.js.map +1 -1
- package/lib/module/utils/getUrlOfImageAttachment.js +1 -1
- package/lib/module/utils/getUrlOfImageAttachment.js.map +1 -1
- package/lib/module/version.json +1 -1
- package/lib/typescript/components/Attachment/Gallery.d.ts +1 -1
- package/lib/typescript/components/Attachment/VideoThumbnail.d.ts +4 -0
- package/lib/typescript/components/Attachment/utils/buildGallery/types.d.ts +1 -0
- package/lib/typescript/components/Attachment/utils/getAspectRatio.d.ts +1 -1
- package/lib/typescript/components/Channel/Channel.d.ts +1 -1
- package/lib/typescript/components/Channel/hooks/useCreateMessagesContext.d.ts +1 -1
- package/lib/typescript/components/ChannelPreview/hooks/__tests__/useChannelPreviewDisplayName.test.d.ts +1 -0
- package/lib/typescript/components/ChannelPreview/hooks/useChannelPreviewDisplayName.d.ts +4 -4
- package/lib/typescript/components/Chat/hooks/useIsOnline.d.ts +1 -1
- package/lib/typescript/components/ImageGallery/ImageGallery.d.ts +2 -0
- package/lib/typescript/components/ImageGallery/components/AnimatedGalleryVideo.d.ts +27 -0
- package/lib/typescript/components/ImageGallery/components/ImageGalleryFooter.d.ts +18 -2
- package/lib/typescript/components/ImageGallery/components/ImageGalleryVideoControl.d.ts +3 -0
- package/lib/typescript/components/ImageGallery/components/ProgressControl.d.ts +5 -0
- package/lib/typescript/components/ImageGallery/hooks/useImageGalleryGestures.d.ts +36 -0
- package/lib/typescript/components/Message/Message.d.ts +9 -3
- package/lib/typescript/components/Message/hooks/useCreateMessageContext.d.ts +1 -1
- package/lib/typescript/components/Spinner/Spinner.d.ts +7 -1
- package/lib/typescript/components/index.d.ts +2 -0
- package/lib/typescript/contexts/messageContext/MessageContext.d.ts +3 -1
- package/lib/typescript/contexts/messageOverlayContext/MessageOverlayContext.d.ts +1 -0
- package/lib/typescript/contexts/messagesContext/MessagesContext.d.ts +2 -0
- package/lib/typescript/contexts/themeContext/utils/theme.d.ts +9 -0
- package/lib/typescript/icons/Pause.d.ts +3 -0
- package/lib/typescript/icons/Play.d.ts +3 -0
- package/lib/typescript/icons/index.d.ts +2 -0
- package/lib/typescript/mock-builders/api/queryMembers.d.ts +161 -0
- package/lib/typescript/mock-builders/api/utils.d.ts +7 -0
- package/lib/typescript/mock-builders/generator/user.d.ts +30 -0
- package/lib/typescript/mock-builders/mock.d.ts +3 -0
- package/lib/typescript/native.d.ts +66 -1
- package/package.json +1 -1
- package/src/components/Attachment/Attachment.tsx +11 -7
- package/src/components/Attachment/Card.tsx +3 -0
- package/src/components/Attachment/Gallery.tsx +75 -36
- package/src/components/Attachment/VideoThumbnail.tsx +45 -0
- package/src/components/Attachment/hooks/useGoToURL.ts +1 -1
- package/src/components/Attachment/utils/buildGallery/buildThumbnail.ts +1 -0
- package/src/components/Attachment/utils/buildGallery/types.ts +1 -0
- package/src/components/Attachment/utils/getAspectRatio.ts +7 -5
- package/src/components/Channel/Channel.tsx +4 -0
- package/src/components/Channel/hooks/useCreateMessagesContext.ts +2 -0
- package/src/components/ChannelPreview/hooks/__tests__/useChannelPreviewDisplayName.test.tsx +83 -0
- package/src/components/ChannelPreview/hooks/useChannelPreviewDisplayName.ts +43 -26
- package/src/components/Chat/hooks/useIsOnline.ts +7 -7
- package/src/components/ImageGallery/ImageGallery.tsx +145 -667
- package/src/components/ImageGallery/components/AnimatedGalleryImage.tsx +4 -4
- package/src/components/ImageGallery/components/AnimatedGalleryVideo.tsx +224 -0
- package/src/components/ImageGallery/components/ImageGalleryFooter.tsx +114 -19
- package/src/components/ImageGallery/components/ImageGalleryVideoControl.tsx +103 -0
- package/src/components/ImageGallery/components/ImageGrid.tsx +12 -25
- package/src/components/ImageGallery/components/ProgressControl.tsx +107 -0
- package/src/components/ImageGallery/hooks/useImageGalleryGestures.tsx +722 -0
- package/src/components/Message/Message.tsx +18 -7
- package/src/components/Message/MessageSimple/utils/renderText.tsx +6 -1
- package/src/components/Message/hooks/useCreateMessageContext.ts +2 -0
- package/src/components/MessageOverlay/MessageOverlay.tsx +2 -0
- package/src/components/Reply/Reply.tsx +36 -23
- package/src/components/Spinner/Spinner.tsx +11 -4
- package/src/components/index.ts +2 -0
- package/src/contexts/messageContext/MessageContext.tsx +2 -0
- package/src/contexts/messageInputContext/MessageInputContext.tsx +11 -0
- package/src/contexts/messageOverlayContext/MessageOverlayContext.tsx +1 -0
- package/src/contexts/messagesContext/MessagesContext.tsx +2 -0
- package/src/contexts/themeContext/utils/theme.ts +18 -0
- package/src/icons/Pause.tsx +14 -0
- package/src/icons/Play.tsx +17 -0
- package/src/icons/index.ts +2 -0
- package/src/mock-builders/api/queryMembers.js +98 -0
- package/src/native.ts +59 -1
- package/src/utils/getUrlOfImageAttachment.ts +1 -1
- package/src/version.json +1 -1
|
@@ -82,26 +82,35 @@ var AttachmentWithContext = function AttachmentWithContext(props) {
|
|
|
82
82
|
})));
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
if (attachment.type === '
|
|
86
|
-
return _react["default"].createElement(
|
|
87
|
-
|
|
85
|
+
if (attachment.type === 'video' && !attachment.og_scrape_url) {
|
|
86
|
+
return _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement(Gallery, {
|
|
87
|
+
videos: [attachment],
|
|
88
88
|
__self: _this,
|
|
89
89
|
__source: {
|
|
90
90
|
fileName: _jsxFileName,
|
|
91
|
-
lineNumber:
|
|
92
|
-
columnNumber:
|
|
91
|
+
lineNumber: 81,
|
|
92
|
+
columnNumber: 9
|
|
93
93
|
}
|
|
94
|
-
})
|
|
94
|
+
}), hasAttachmentActions && _react["default"].createElement(AttachmentActions, (0, _extends2["default"])({
|
|
95
|
+
key: "key-actions-" + attachment.id
|
|
96
|
+
}, attachment, {
|
|
97
|
+
__self: _this,
|
|
98
|
+
__source: {
|
|
99
|
+
fileName: _jsxFileName,
|
|
100
|
+
lineNumber: 83,
|
|
101
|
+
columnNumber: 11
|
|
102
|
+
}
|
|
103
|
+
})));
|
|
95
104
|
}
|
|
96
105
|
|
|
97
|
-
if (attachment.type === '
|
|
106
|
+
if (attachment.type === 'file' || attachment.type === 'audio') {
|
|
98
107
|
return _react["default"].createElement(FileAttachment, {
|
|
99
108
|
attachment: attachment,
|
|
100
109
|
__self: _this,
|
|
101
110
|
__source: {
|
|
102
111
|
fileName: _jsxFileName,
|
|
103
|
-
lineNumber:
|
|
104
|
-
columnNumber:
|
|
112
|
+
lineNumber: 90,
|
|
113
|
+
columnNumber: 12
|
|
105
114
|
}
|
|
106
115
|
});
|
|
107
116
|
}
|
|
@@ -111,7 +120,7 @@ var AttachmentWithContext = function AttachmentWithContext(props) {
|
|
|
111
120
|
__self: _this,
|
|
112
121
|
__source: {
|
|
113
122
|
fileName: _jsxFileName,
|
|
114
|
-
lineNumber:
|
|
123
|
+
lineNumber: 96,
|
|
115
124
|
columnNumber: 9
|
|
116
125
|
}
|
|
117
126
|
})), _react["default"].createElement(AttachmentActions, (0, _extends2["default"])({
|
|
@@ -120,7 +129,7 @@ var AttachmentWithContext = function AttachmentWithContext(props) {
|
|
|
120
129
|
__self: _this,
|
|
121
130
|
__source: {
|
|
122
131
|
fileName: _jsxFileName,
|
|
123
|
-
lineNumber:
|
|
132
|
+
lineNumber: 97,
|
|
124
133
|
columnNumber: 9
|
|
125
134
|
}
|
|
126
135
|
})));
|
|
@@ -129,7 +138,7 @@ var AttachmentWithContext = function AttachmentWithContext(props) {
|
|
|
129
138
|
__self: _this,
|
|
130
139
|
__source: {
|
|
131
140
|
fileName: _jsxFileName,
|
|
132
|
-
lineNumber:
|
|
141
|
+
lineNumber: 101,
|
|
133
142
|
columnNumber: 12
|
|
134
143
|
}
|
|
135
144
|
}));
|
|
@@ -198,7 +207,7 @@ var Attachment = function Attachment(props) {
|
|
|
198
207
|
__self: _this,
|
|
199
208
|
__source: {
|
|
200
209
|
fileName: _jsxFileName,
|
|
201
|
-
lineNumber:
|
|
210
|
+
lineNumber: 191,
|
|
202
211
|
columnNumber: 5
|
|
203
212
|
}
|
|
204
213
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Attachment.tsx"],"names":["AttachmentWithContext","props","attachment","AttachmentActions","Card","FileAttachment","Gallery","Giphy","giphyVersion","UrlPreview","hasAttachmentActions","actions","length","type","title_link","og_scrape_url","image_url","thumb_url","id","asset_url","areEqual","prevProps","nextProps","prevAttachment","isAttachmentEqual","nextAttachment","attachmentEqual","MemoizedAttachment","React","memo","Attachment","PropAttachmentActions","PropCard","PropFileAttachment","PropGallery","PropGiphy","PropGiphyVersion","PropUrlPreview","ContextAttachmentActions","ContextCard","ContextFileAttachment","ContextGallery","ContextGiphy","ContextGiphyVersion","ContextUrlPreview","AttachmentActionsDefault","CardDefault","FileAttachmentDefault","GalleryDefault","GiphyDefault"],"mappings":";;;;;;;;;AAAA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;AA4BA,IAAMA,qBAAqB,GAAG,SAAxBA,qBAAwB,CAG5BC,KAH4B,EAIzB;AAAA;;AACH,MACEC,UADF,GASID,KATJ,CACEC,UADF;AAAA,MAEEC,iBAFF,GASIF,KATJ,CAEEE,iBAFF;AAAA,MAGEC,IAHF,GASIH,KATJ,CAGEG,IAHF;AAAA,MAIEC,cAJF,GASIJ,KATJ,CAIEI,cAJF;AAAA,MAKEC,OALF,GASIL,KATJ,CAKEK,OALF;AAAA,MAMEC,KANF,GASIN,KATJ,CAMEM,KANF;AAAA,MAOEC,YAPF,GASIP,KATJ,CAOEO,YAPF;AAAA,MAQEC,UARF,GASIR,KATJ,CAQEQ,UARF;AAWA,MAAMC,oBAAoB,GAAG,CAAC,yBAACR,UAAU,CAACS,OAAZ,aAAC,oBAAoBC,MAArB,CAA9B;;AAEA,MAAIV,UAAU,CAACW,IAAX,KAAoB,OAApB,IAA+BX,UAAU,CAACW,IAAX,KAAoB,OAAvD,EAAgE;AAC9D,WAAO,gCAAC,KAAD;AAAO,MAAA,UAAU,EAAEX,UAAnB;AAA+B,MAAA,YAAY,EAAEM,YAA7C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAAP;AACD;;AAED,MACE,CAACN,UAAU,CAACY,UAAX,IAAyBZ,UAAU,CAACa,aAArC,MACCb,UAAU,CAACc,SAAX,IAAwBd,UAAU,CAACe,SADpC,CADF,EAGE;AACA,WAAO,gCAAC,UAAD,gCAAgBf,UAAhB;AAAA;AAAA;AAAA;AAAA;AAA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F;AAAA,MAKSoC,YALT,uBAKEnC,KALF;AAAA,MAMgBoC,mBANhB,uBAMEnC,YANF;AAAA,MAOEgB,iBAPF,uBAOEA,iBAPF;AAAA,MAQcoB,iBARd,uBAQEnC,UARF;;AAWA,MAAI,CAACP,UAAL,EAAiB;AACf,WAAO,IAAP;AACD;;AAED,MAAMC,iBAAiB,GACrB4B,qBAAqB,IAAIO,wBAAzB,IAAqDO,oCADvD;AAEA,MAAMzC,IAAI,GAAG4B,QAAQ,IAAIO,WAAZ,IAA2BO,UAAxC;AACA,MAAMzC,cAAc,GAAG4B,kBAAkB,IAAIO,qBAAtB,IAA+CO,8BAAtE;AACA,MAAMzC,OAAO,GAAG4B,WAAW,IAAIO,cAAf,IAAiCO,gBAAjD;AACA,MAAMzC,KAAK,GAAG4B,SAAS,IAAIO,YAAb,IAA6BO,YAA3C;AACA,MAAMxC,UAAU,GAAG4B,cAAc,IAAIO,iBAAlB,IAAuCE,UAA1D;AACA,MAAMtC,YAAY,GAAG4B,gBAAgB,IAAIO,mBAAzC;AAEA,SACE,gCAAC,kBAAD;AAEIzC,IAAAA,UAAU,EAAVA,UAFJ;AAGIC,IAAAA,iBAAiB,EAAjBA,iBAHJ;AAIIC,IAAAA,IAAI,EAAJA,IAJJ;AAKIC,IAAAA,cAAc,EAAdA,cALJ;AAMIC,IAAAA,OAAO,EAAPA,OANJ;AAOIC,IAAAA,KAAK,EAALA,KAPJ;AAQIC,IAAAA,YAAY,EAAZA,YARJ;AASIgB,IAAAA,iBAAiB,EAAjBA,iBATJ;AAUIf,IAAAA,UAAU,EAAVA,UAVJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IADF;AAeD,CAvDM","sourcesContent":["import React from 'react';\n\nimport type { Attachment as AttachmentType } from 'stream-chat';\n\nimport { AttachmentActions as AttachmentActionsDefault } from '../../components/Attachment/AttachmentActions';\nimport { Card as CardDefault } from '../../components/Attachment/Card';\nimport { FileAttachment as FileAttachmentDefault } from '../../components/Attachment/FileAttachment';\nimport { Gallery as GalleryDefault } from '../../components/Attachment/Gallery';\nimport { Giphy as GiphyDefault } from '../../components/Attachment/Giphy';\nimport {\n MessagesContextValue,\n useMessagesContext,\n} from '../../contexts/messagesContext/MessagesContext';\n\nimport type { DefaultStreamChatGenerics } from '../../types/types';\n\nexport type ActionHandler = (name: string, value: string) => void;\n\nexport type AttachmentPropsWithContext<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = Pick<\n MessagesContextValue<StreamChatGenerics>,\n | 'AttachmentActions'\n | 'Card'\n | 'FileAttachment'\n | 'Gallery'\n | 'giphyVersion'\n | 'Giphy'\n | 'isAttachmentEqual'\n | 'UrlPreview'\n> & {\n /**\n * The attachment to render\n */\n attachment: AttachmentType<StreamChatGenerics>;\n};\n\nconst AttachmentWithContext = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n props: AttachmentPropsWithContext<StreamChatGenerics>,\n) => {\n const {\n attachment,\n AttachmentActions,\n Card,\n FileAttachment,\n Gallery,\n Giphy,\n giphyVersion,\n UrlPreview,\n } = props;\n\n const hasAttachmentActions = !!attachment.actions?.length;\n\n if (attachment.type === 'giphy' || attachment.type === 'imgur') {\n return <Giphy attachment={attachment} giphyVersion={giphyVersion} />;\n }\n\n if (\n (attachment.title_link || attachment.og_scrape_url) &&\n (attachment.image_url || attachment.thumb_url)\n ) {\n return <UrlPreview {...attachment} />;\n }\n\n if (attachment.type === 'image') {\n return (\n <>\n <Gallery images={[attachment]} />\n {hasAttachmentActions && (\n <AttachmentActions key={`key-actions-${attachment.id}`} {...attachment} />\n )}\n </>\n );\n }\n\n if (attachment.type === 'file' || attachment.type === 'audio') {\n return <FileAttachment attachment={attachment} />;\n }\n\n if (attachment.type === 'video' && attachment.asset_url) {\n return (\n // TODO: Put in video component\n <FileAttachment attachment={attachment} />\n );\n }\n\n if (hasAttachmentActions) {\n return (\n <>\n <Card {...attachment} />\n <AttachmentActions key={`key-actions-${attachment.id}`} {...attachment} />\n </>\n );\n } else {\n return <Card {...attachment} />;\n }\n};\n\nconst areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(\n prevProps: AttachmentPropsWithContext<StreamChatGenerics>,\n nextProps: AttachmentPropsWithContext<StreamChatGenerics>,\n) => {\n const { attachment: prevAttachment, isAttachmentEqual } = prevProps;\n const { attachment: nextAttachment } = nextProps;\n\n const attachmentEqual =\n prevAttachment.actions?.length === nextAttachment.actions?.length &&\n prevAttachment.image_url === nextAttachment.image_url &&\n prevAttachment.thumb_url === nextAttachment.thumb_url;\n if (!attachmentEqual) return false;\n\n if (isAttachmentEqual) {\n return isAttachmentEqual(prevAttachment, nextAttachment);\n }\n\n return true;\n};\n\nconst MemoizedAttachment = React.memo(\n AttachmentWithContext,\n areEqual,\n) as typeof AttachmentWithContext;\n\nexport type AttachmentProps<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = Partial<\n Pick<\n MessagesContextValue<StreamChatGenerics>,\n | 'AttachmentActions'\n | 'Card'\n | 'FileAttachment'\n | 'Gallery'\n | 'Giphy'\n | 'giphyVersion'\n | 'UrlPreview'\n | 'isAttachmentEqual'\n >\n> &\n Pick<AttachmentPropsWithContext<StreamChatGenerics>, 'attachment'>;\n\n/**\n * Attachment - The message attachment\n */\nexport const Attachment = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n props: AttachmentProps<StreamChatGenerics>,\n) => {\n const {\n attachment,\n AttachmentActions: PropAttachmentActions,\n Card: PropCard,\n FileAttachment: PropFileAttachment,\n Gallery: PropGallery,\n Giphy: PropGiphy,\n giphyVersion: PropGiphyVersion,\n UrlPreview: PropUrlPreview,\n } = props;\n\n const {\n AttachmentActions: ContextAttachmentActions,\n Card: ContextCard,\n FileAttachment: ContextFileAttachment,\n Gallery: ContextGallery,\n Giphy: ContextGiphy,\n giphyVersion: ContextGiphyVersion,\n isAttachmentEqual,\n UrlPreview: ContextUrlPreview,\n } = useMessagesContext<StreamChatGenerics>();\n\n if (!attachment) {\n return null;\n }\n\n const AttachmentActions =\n PropAttachmentActions || ContextAttachmentActions || AttachmentActionsDefault;\n const Card = PropCard || ContextCard || CardDefault;\n const FileAttachment = PropFileAttachment || ContextFileAttachment || FileAttachmentDefault;\n const Gallery = PropGallery || ContextGallery || GalleryDefault;\n const Giphy = PropGiphy || ContextGiphy || GiphyDefault;\n const UrlPreview = PropUrlPreview || ContextUrlPreview || CardDefault;\n const giphyVersion = PropGiphyVersion || ContextGiphyVersion;\n\n return (\n <MemoizedAttachment\n {...{\n attachment,\n AttachmentActions,\n Card,\n FileAttachment,\n Gallery,\n Giphy,\n giphyVersion,\n isAttachmentEqual,\n UrlPreview,\n }}\n />\n );\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["Attachment.tsx"],"names":["AttachmentWithContext","props","attachment","AttachmentActions","Card","FileAttachment","Gallery","Giphy","giphyVersion","UrlPreview","hasAttachmentActions","actions","length","type","title_link","og_scrape_url","image_url","thumb_url","id","areEqual","prevProps","nextProps","prevAttachment","isAttachmentEqual","nextAttachment","attachmentEqual","MemoizedAttachment","React","memo","Attachment","PropAttachmentActions","PropCard","PropFileAttachment","PropGallery","PropGiphy","PropGiphyVersion","PropUrlPreview","ContextAttachmentActions","ContextCard","ContextFileAttachment","ContextGallery","ContextGiphy","ContextGiphyVersion","ContextUrlPreview","AttachmentActionsDefault","CardDefault","FileAttachmentDefault","GalleryDefault","GiphyDefault"],"mappings":";;;;;;;;;AAAA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;AA4BA,IAAMA,qBAAqB,GAAG,SAAxBA,qBAAwB,CAG5BC,KAH4B,EAIzB;AAAA;;AACH,MACEC,UADF,GASID,KATJ,CACEC,UADF;AAAA,MAEEC,iBAFF,GASIF,KATJ,CAEEE,iBAFF;AAAA,MAGEC,IAHF,GASIH,KATJ,CAGEG,IAHF;AAAA,MAIEC,c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AMxC,cAAc,GAAG2B,kBAAkB,IAAIO,qBAAtB,IAA+CO,8BAAtE;AACA,MAAMxC,OAAO,GAAG2B,WAAW,IAAIO,cAAf,IAAiCO,gBAAjD;AACA,MAAMxC,KAAK,GAAG2B,SAAS,IAAIO,YAAb,IAA6BO,YAA3C;AACA,MAAMvC,UAAU,GAAG2B,cAAc,IAAIO,iBAAlB,IAAuCE,UAA1D;AACA,MAAMrC,YAAY,GAAG2B,gBAAgB,IAAIO,mBAAzC;AAEA,SACE,gCAAC,kBAAD;AAEIxC,IAAAA,UAAU,EAAVA,UAFJ;AAGIC,IAAAA,iBAAiB,EAAjBA,iBAHJ;AAIIC,IAAAA,IAAI,EAAJA,IAJJ;AAKIC,IAAAA,cAAc,EAAdA,cALJ;AAMIC,IAAAA,OAAO,EAAPA,OANJ;AAOIC,IAAAA,KAAK,EAALA,KAPJ;AAQIC,IAAAA,YAAY,EAAZA,YARJ;AASIe,IAAAA,iBAAiB,EAAjBA,iBATJ;AAUId,IAAAA,UAAU,EAAVA,UAVJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IADF;AAeD,CAvDM","sourcesContent":["import React from 'react';\n\nimport type { Attachment as AttachmentType } from 'stream-chat';\n\nimport { AttachmentActions as AttachmentActionsDefault } from '../../components/Attachment/AttachmentActions';\nimport { Card as CardDefault } from '../../components/Attachment/Card';\nimport { FileAttachment as FileAttachmentDefault } from '../../components/Attachment/FileAttachment';\nimport { Gallery as GalleryDefault } from '../../components/Attachment/Gallery';\nimport { Giphy as GiphyDefault } from '../../components/Attachment/Giphy';\nimport {\n MessagesContextValue,\n useMessagesContext,\n} from '../../contexts/messagesContext/MessagesContext';\n\nimport type { DefaultStreamChatGenerics } from '../../types/types';\n\nexport type ActionHandler = (name: string, value: string) => void;\n\nexport type AttachmentPropsWithContext<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = Pick<\n MessagesContextValue<StreamChatGenerics>,\n | 'AttachmentActions'\n | 'Card'\n | 'FileAttachment'\n | 'Gallery'\n | 'giphyVersion'\n | 'Giphy'\n | 'isAttachmentEqual'\n | 'UrlPreview'\n> & {\n /**\n * The attachment to render\n */\n attachment: AttachmentType<StreamChatGenerics>;\n};\n\nconst AttachmentWithContext = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n props: AttachmentPropsWithContext<StreamChatGenerics>,\n) => {\n const {\n attachment,\n AttachmentActions,\n Card,\n FileAttachment,\n Gallery,\n Giphy,\n giphyVersion,\n UrlPreview,\n } = props;\n\n const hasAttachmentActions = !!attachment.actions?.length;\n\n if (attachment.type === 'giphy' || attachment.type === 'imgur') {\n return <Giphy attachment={attachment} giphyVersion={giphyVersion} />;\n }\n\n if (\n (attachment.title_link || attachment.og_scrape_url) &&\n (attachment.image_url || attachment.thumb_url)\n ) {\n return <UrlPreview {...attachment} />;\n }\n\n if (attachment.type === 'image') {\n return (\n <>\n <Gallery images={[attachment]} />\n {hasAttachmentActions && (\n <AttachmentActions key={`key-actions-${attachment.id}`} {...attachment} />\n )}\n </>\n );\n }\n\n if (attachment.type === 'video' && !attachment.og_scrape_url) {\n return (\n <>\n <Gallery videos={[attachment]} />\n {hasAttachmentActions && (\n <AttachmentActions key={`key-actions-${attachment.id}`} {...attachment} />\n )}\n </>\n );\n }\n\n if (attachment.type === 'file' || attachment.type === 'audio') {\n return <FileAttachment attachment={attachment} />;\n }\n\n if (hasAttachmentActions) {\n return (\n <>\n <Card {...attachment} />\n <AttachmentActions key={`key-actions-${attachment.id}`} {...attachment} />\n </>\n );\n } else {\n return <Card {...attachment} />;\n }\n};\n\nconst areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(\n prevProps: AttachmentPropsWithContext<StreamChatGenerics>,\n nextProps: AttachmentPropsWithContext<StreamChatGenerics>,\n) => {\n const { attachment: prevAttachment, isAttachmentEqual } = prevProps;\n const { attachment: nextAttachment } = nextProps;\n\n const attachmentEqual =\n prevAttachment.actions?.length === nextAttachment.actions?.length &&\n prevAttachment.image_url === nextAttachment.image_url &&\n prevAttachment.thumb_url === nextAttachment.thumb_url;\n if (!attachmentEqual) return false;\n\n if (isAttachmentEqual) {\n return isAttachmentEqual(prevAttachment, nextAttachment);\n }\n\n return true;\n};\n\nconst MemoizedAttachment = React.memo(\n AttachmentWithContext,\n areEqual,\n) as typeof AttachmentWithContext;\n\nexport type AttachmentProps<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = Partial<\n Pick<\n MessagesContextValue<StreamChatGenerics>,\n | 'AttachmentActions'\n | 'Card'\n | 'FileAttachment'\n | 'Gallery'\n | 'Giphy'\n | 'giphyVersion'\n | 'UrlPreview'\n | 'isAttachmentEqual'\n >\n> &\n Pick<AttachmentPropsWithContext<StreamChatGenerics>, 'attachment'>;\n\n/**\n * Attachment - The message attachment\n */\nexport const Attachment = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n props: AttachmentProps<StreamChatGenerics>,\n) => {\n const {\n attachment,\n AttachmentActions: PropAttachmentActions,\n Card: PropCard,\n FileAttachment: PropFileAttachment,\n Gallery: PropGallery,\n Giphy: PropGiphy,\n giphyVersion: PropGiphyVersion,\n UrlPreview: PropUrlPreview,\n } = props;\n\n const {\n AttachmentActions: ContextAttachmentActions,\n Card: ContextCard,\n FileAttachment: ContextFileAttachment,\n Gallery: ContextGallery,\n Giphy: ContextGiphy,\n giphyVersion: ContextGiphyVersion,\n isAttachmentEqual,\n UrlPreview: ContextUrlPreview,\n } = useMessagesContext<StreamChatGenerics>();\n\n if (!attachment) {\n return null;\n }\n\n const AttachmentActions =\n PropAttachmentActions || ContextAttachmentActions || AttachmentActionsDefault;\n const Card = PropCard || ContextCard || CardDefault;\n const FileAttachment = PropFileAttachment || ContextFileAttachment || FileAttachmentDefault;\n const Gallery = PropGallery || ContextGallery || GalleryDefault;\n const Giphy = PropGiphy || ContextGiphy || GiphyDefault;\n const UrlPreview = PropUrlPreview || ContextUrlPreview || CardDefault;\n const giphyVersion = PropGiphyVersion || ContextGiphyVersion;\n\n return (\n <MemoizedAttachment\n {...{\n attachment,\n AttachmentActions,\n Card,\n FileAttachment,\n Gallery,\n Giphy,\n giphyVersion,\n isAttachmentEqual,\n UrlPreview,\n }}\n />\n );\n};\n"]}
|
|
@@ -129,6 +129,9 @@ var CardWithContext = function CardWithContext(props) {
|
|
|
129
129
|
onLongPress: function onLongPress(event) {
|
|
130
130
|
if (_onLongPress) {
|
|
131
131
|
_onLongPress({
|
|
132
|
+
additionalInfo: {
|
|
133
|
+
url: og_scrape_url
|
|
134
|
+
},
|
|
132
135
|
emitter: 'card',
|
|
133
136
|
event: event
|
|
134
137
|
});
|
|
@@ -137,6 +140,9 @@ var CardWithContext = function CardWithContext(props) {
|
|
|
137
140
|
onPress: function onPress(event) {
|
|
138
141
|
if (_onPress) {
|
|
139
142
|
_onPress({
|
|
143
|
+
additionalInfo: {
|
|
144
|
+
url: og_scrape_url
|
|
145
|
+
},
|
|
140
146
|
defaultHandler: defaultOnPress,
|
|
141
147
|
emitter: 'card',
|
|
142
148
|
event: event
|
|
@@ -146,6 +152,9 @@ var CardWithContext = function CardWithContext(props) {
|
|
|
146
152
|
onPressIn: function onPressIn(event) {
|
|
147
153
|
if (_onPressIn) {
|
|
148
154
|
_onPressIn({
|
|
155
|
+
additionalInfo: {
|
|
156
|
+
url: og_scrape_url
|
|
157
|
+
},
|
|
149
158
|
defaultHandler: defaultOnPress,
|
|
150
159
|
emitter: 'card',
|
|
151
160
|
event: event
|
|
@@ -165,21 +174,21 @@ var CardWithContext = function CardWithContext(props) {
|
|
|
165
174
|
__self: _this,
|
|
166
175
|
__source: {
|
|
167
176
|
fileName: _jsxFileName,
|
|
168
|
-
lineNumber:
|
|
177
|
+
lineNumber: 182,
|
|
169
178
|
columnNumber: 22
|
|
170
179
|
}
|
|
171
180
|
})), CardCover && _react["default"].createElement(CardCover, (0, _extends2["default"])({}, props, {
|
|
172
181
|
__self: _this,
|
|
173
182
|
__source: {
|
|
174
183
|
fileName: _jsxFileName,
|
|
175
|
-
lineNumber:
|
|
184
|
+
lineNumber: 183,
|
|
176
185
|
columnNumber: 21
|
|
177
186
|
}
|
|
178
187
|
})), uri && !CardCover && _react["default"].createElement(_reactNative.View, {
|
|
179
188
|
__self: _this,
|
|
180
189
|
__source: {
|
|
181
190
|
fileName: _jsxFileName,
|
|
182
|
-
lineNumber:
|
|
191
|
+
lineNumber: 185,
|
|
183
192
|
columnNumber: 9
|
|
184
193
|
}
|
|
185
194
|
}, _react["default"].createElement(_reactNative.Image, {
|
|
@@ -191,7 +200,7 @@ var CardWithContext = function CardWithContext(props) {
|
|
|
191
200
|
__self: _this,
|
|
192
201
|
__source: {
|
|
193
202
|
fileName: _jsxFileName,
|
|
194
|
-
lineNumber:
|
|
203
|
+
lineNumber: 186,
|
|
195
204
|
columnNumber: 11
|
|
196
205
|
}
|
|
197
206
|
}), author_name && _react["default"].createElement(_reactNative.View, {
|
|
@@ -199,7 +208,7 @@ var CardWithContext = function CardWithContext(props) {
|
|
|
199
208
|
__self: _this,
|
|
200
209
|
__source: {
|
|
201
210
|
fileName: _jsxFileName,
|
|
202
|
-
lineNumber:
|
|
211
|
+
lineNumber: 192,
|
|
203
212
|
columnNumber: 13
|
|
204
213
|
}
|
|
205
214
|
}, _react["default"].createElement(_reactNative.View, {
|
|
@@ -209,7 +218,7 @@ var CardWithContext = function CardWithContext(props) {
|
|
|
209
218
|
__self: _this,
|
|
210
219
|
__source: {
|
|
211
220
|
fileName: _jsxFileName,
|
|
212
|
-
lineNumber:
|
|
221
|
+
lineNumber: 193,
|
|
213
222
|
columnNumber: 15
|
|
214
223
|
}
|
|
215
224
|
}, _react["default"].createElement(_reactNative.Text, {
|
|
@@ -219,14 +228,14 @@ var CardWithContext = function CardWithContext(props) {
|
|
|
219
228
|
__self: _this,
|
|
220
229
|
__source: {
|
|
221
230
|
fileName: _jsxFileName,
|
|
222
|
-
lineNumber:
|
|
231
|
+
lineNumber: 201,
|
|
223
232
|
columnNumber: 17
|
|
224
233
|
}
|
|
225
234
|
}, author_name)))), CardFooter ? _react["default"].createElement(CardFooter, (0, _extends2["default"])({}, props, {
|
|
226
235
|
__self: _this,
|
|
227
236
|
__source: {
|
|
228
237
|
fileName: _jsxFileName,
|
|
229
|
-
lineNumber:
|
|
238
|
+
lineNumber: 217,
|
|
230
239
|
columnNumber: 9
|
|
231
240
|
}
|
|
232
241
|
})) : _react["default"].createElement(_reactNative.View, {
|
|
@@ -234,7 +243,7 @@ var CardWithContext = function CardWithContext(props) {
|
|
|
234
243
|
__self: _this,
|
|
235
244
|
__source: {
|
|
236
245
|
fileName: _jsxFileName,
|
|
237
|
-
lineNumber:
|
|
246
|
+
lineNumber: 219,
|
|
238
247
|
columnNumber: 9
|
|
239
248
|
}
|
|
240
249
|
}, _react["default"].createElement(_reactNative.View, {
|
|
@@ -246,7 +255,7 @@ var CardWithContext = function CardWithContext(props) {
|
|
|
246
255
|
__self: _this,
|
|
247
256
|
__source: {
|
|
248
257
|
fileName: _jsxFileName,
|
|
249
|
-
lineNumber:
|
|
258
|
+
lineNumber: 220,
|
|
250
259
|
columnNumber: 11
|
|
251
260
|
}
|
|
252
261
|
}, !uri && author_name && _react["default"].createElement(_reactNative.Text, {
|
|
@@ -256,7 +265,7 @@ var CardWithContext = function CardWithContext(props) {
|
|
|
256
265
|
__self: _this,
|
|
257
266
|
__source: {
|
|
258
267
|
fileName: _jsxFileName,
|
|
259
|
-
lineNumber:
|
|
268
|
+
lineNumber: 229,
|
|
260
269
|
columnNumber: 15
|
|
261
270
|
}
|
|
262
271
|
}, author_name), title && _react["default"].createElement(_reactNative.Text, {
|
|
@@ -267,7 +276,7 @@ var CardWithContext = function CardWithContext(props) {
|
|
|
267
276
|
__self: _this,
|
|
268
277
|
__source: {
|
|
269
278
|
fileName: _jsxFileName,
|
|
270
|
-
lineNumber:
|
|
279
|
+
lineNumber: 241,
|
|
271
280
|
columnNumber: 15
|
|
272
281
|
}
|
|
273
282
|
}, title), text && _react["default"].createElement(_reactNative.Text, {
|
|
@@ -278,7 +287,7 @@ var CardWithContext = function CardWithContext(props) {
|
|
|
278
287
|
__self: _this,
|
|
279
288
|
__source: {
|
|
280
289
|
fileName: _jsxFileName,
|
|
281
|
-
lineNumber:
|
|
290
|
+
lineNumber: 249,
|
|
282
291
|
columnNumber: 15
|
|
283
292
|
}
|
|
284
293
|
}, text))));
|
|
@@ -317,7 +326,7 @@ var Card = function Card(props) {
|
|
|
317
326
|
__self: _this,
|
|
318
327
|
__source: {
|
|
319
328
|
fileName: _jsxFileName,
|
|
320
|
-
lineNumber:
|
|
329
|
+
lineNumber: 290,
|
|
321
330
|
columnNumber: 5
|
|
322
331
|
}
|
|
323
332
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Card.tsx"],"names":["styles","StyleSheet","create","authorName","fontSize","fontWeight","authorNameContainer","borderTopRightRadius","paddingHorizontal","paddingTop","authorNameFooter","padding","authorNameMask","bottom","left","position","cardCover","borderRadius","height","marginHorizontal","cardFooter","flexDirection","justifyContent","container","overflow","width","description","title","CardWithContext","props","additionalTouchableProps","author_name","CardCover","CardFooter","CardHeader","image_url","og_scrape_url","onLongPress","onPress","onPressIn","preventPress","stylesProp","text","thumb_url","theme","colors","accent_blue","black","blue_alice","transparent","messageSimple","card","authorNameFooterContainer","cover","footer","titleStyle","footerStyle","noURI","uri","error","openURL","defaultOnPress","event","emitter","defaultHandler","backgroundColor","color","borderLeftColor","MemoizedCard","React","memo","Card","message","channelId","cid","messageId","id","displayName"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AAcA;;AAEA;;AAIA;;AAIA;;AAEA;;;;;;;AAEA,IAAMA,MAAM,GAAGC,wBAAWC,MAAX,CAAkB;AAC/BC,EAAAA,UAAU,EAAE;AAAEC,IAAAA,QAAQ,EAAE,IAAZ;AAAkBC,IAAAA,UAAU,EAAE;AAA9B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,CADF,CArEJ,CADF;AAgHD,CAhKD;;AAkKA,IAAM0B,YAAY,GAAGC,kBAAMC,IAAN,CAAW1C,eAAX,EAA4B;AAAA,SAAM,IAAN;AAAA,CAA5B,CAArB;;AAgBO,IAAM2C,IAAI,GAAG,SAAPA,IAAO,CAGlB1C,KAHkB,EAIf;AACH,2BACE,wCADF;AAAA,MAAQ2C,OAAR,sBAAQA,OAAR;AAAA,MAAiBnC,WAAjB,sBAAiBA,WAAjB;AAAA,MAA8BC,OAA9B,sBAA8BA,OAA9B;AAAA,MAAuCC,SAAvC,sBAAuCA,SAAvC;AAAA,MAAkDC,YAAlD,sBAAkDA,YAAlD;;AAEA,4BACE,0CADF;AAAA,MAAQV,wBAAR,uBAAQA,wBAAR;AAAA,MAAkCE,SAAlC,uBAAkCA,SAAlC;AAAA,MAA6CC,UAA7C,uBAA6CA,UAA7C;AAAA,MAAyDC,UAAzD,uBAAyDA,UAAzD;;AAGA,SACE,gCAAC,YAAD;AAEIJ,IAAAA,wBAAwB,EAAxBA,wBAFJ;AAGIE,IAAAA,SAAS,EAATA,SAHJ;AAIIC,IAAAA,UAAU,EAAVA,UAJJ;AAKIC,IAAAA,UAAU,EAAVA,UALJ;AAMIuC,IAAAA,SAAS,EAAED,OAAO,CAACE,GANvB;AAOIC,IAAAA,SAAS,EAAEH,OAAO,CAACI,EAPvB;AAQIvC,IAAAA,WAAW,EAAXA,WARJ;AASIC,IAAAA,OAAO,EAAPA,OATJ;AAUIC,IAAAA,SAAS,EAATA,SAVJ;AAWIC,IAAAA,YAAY,EAAZA;AAXJ,KAaMX,KAbN;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KADF;AAiBD,CA3BM;;;AA6BP0C,IAAI,CAACM,WAAL,GAAmB,2BAAnB","sourcesContent":["import React from 'react';\nimport {\n Image,\n ImageStyle,\n StyleProp,\n StyleSheet,\n Text,\n TextStyle,\n TouchableOpacity,\n View,\n ViewStyle,\n} from 'react-native';\n\nimport type { Attachment } from 'stream-chat';\n\nimport { useGoToURL } from './hooks/useGoToURL';\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';\nimport type { DefaultStreamChatGenerics } from '../../types/types';\nimport { makeImageCompatibleUrl } from '../../utils/utils';\n\nconst styles = StyleSheet.create({\n authorName: { fontSize: 14.5, fontWeight: '600' },\n authorNameContainer: {\n borderTopRightRadius: 15,\n paddingHorizontal: 8,\n paddingTop: 8,\n },\n authorNameFooter: {\n fontSize: 14.5,\n fontWeight: '600',\n padding: 8,\n },\n authorNameMask: {\n bottom: 0,\n left: 8,\n position: 'absolute',\n },\n cardCover: {\n borderRadius: 8,\n height: 140,\n marginHorizontal: 8,\n },\n cardFooter: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n padding: 10,\n },\n container: {\n overflow: 'hidden',\n width: 256,\n },\n description: {\n fontSize: 12,\n marginHorizontal: 8,\n },\n title: {\n fontSize: 12,\n marginHorizontal: 8,\n },\n});\n\nexport type CardPropsWithContext<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = Attachment<StreamChatGenerics> &\n Pick<\n MessageContextValue<StreamChatGenerics>,\n 'onLongPress' | 'onPress' | 'onPressIn' | 'preventPress'\n > &\n Pick<\n MessagesContextValue<StreamChatGenerics>,\n 'additionalTouchableProps' | 'CardCover' | 'CardFooter' | 'CardHeader'\n > & {\n channelId: string | undefined;\n messageId: string | undefined;\n styles?: Partial<{\n authorName: StyleProp<TextStyle>;\n authorNameContainer: StyleProp<ViewStyle>;\n authorNameFooter: StyleProp<TextStyle>;\n authorNameFooterContainer: StyleProp<ViewStyle>;\n authorNameMask: StyleProp<ViewStyle>;\n cardCover: StyleProp<ImageStyle>;\n cardFooter: StyleProp<ViewStyle>;\n container: StyleProp<ViewStyle>;\n description: StyleProp<TextStyle>;\n title: StyleProp<TextStyle>;\n }>;\n };\n\nconst CardWithContext = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n props: CardPropsWithContext<StreamChatGenerics>,\n) => {\n const {\n additionalTouchableProps,\n author_name,\n CardCover,\n CardFooter,\n CardHeader,\n image_url,\n og_scrape_url,\n onLongPress,\n onPress,\n onPressIn,\n preventPress,\n styles: stylesProp = {},\n text,\n thumb_url,\n title,\n } = props;\n\n const {\n theme: {\n colors: { accent_blue, black, blue_alice, transparent },\n messageSimple: {\n card: {\n authorName,\n authorNameContainer,\n authorNameFooter,\n authorNameFooterContainer,\n authorNameMask,\n container,\n cover,\n footer: { description, title: titleStyle, ...footerStyle },\n noURI,\n },\n },\n },\n } = useTheme();\n\n const uri = image_url || thumb_url;\n\n const [error, openURL] = useGoToURL(og_scrape_url || uri);\n\n const defaultOnPress = () => !error && openURL && openURL();\n\n return (\n <TouchableOpacity\n disabled={preventPress}\n onLongPress={(event) => {\n if (onLongPress) {\n onLongPress({\n emitter: 'card',\n event,\n });\n }\n }}\n onPress={(event) => {\n if (onPress) {\n onPress({\n defaultHandler: defaultOnPress,\n emitter: 'card',\n event,\n });\n }\n }}\n onPressIn={(event) => {\n if (onPressIn) {\n onPressIn({\n defaultHandler: defaultOnPress,\n emitter: 'card',\n event,\n });\n }\n }}\n style={[styles.container, container, stylesProp.container]}\n testID='card-attachment'\n {...additionalTouchableProps}\n >\n {CardHeader && <CardHeader {...props} />}\n {CardCover && <CardCover {...props} />}\n {uri && !CardCover && (\n <View>\n <Image\n resizeMode='cover'\n source={{ uri: makeImageCompatibleUrl(uri) }}\n style={[styles.cardCover, cover, stylesProp.cardCover]}\n />\n {author_name && (\n <View style={[styles.authorNameMask, authorNameMask, stylesProp.authorNameMask]}>\n <View\n style={[\n styles.authorNameContainer,\n { backgroundColor: blue_alice },\n authorNameContainer,\n stylesProp.authorNameContainer,\n ]}\n >\n <Text\n style={[\n styles.authorName,\n { color: accent_blue },\n authorName,\n stylesProp.authorName,\n ]}\n >\n {author_name}\n </Text>\n </View>\n </View>\n )}\n </View>\n )}\n {CardFooter ? (\n <CardFooter {...props} />\n ) : (\n <View style={[styles.cardFooter, footerStyle, stylesProp.cardFooter]}>\n <View\n style={[\n authorNameFooterContainer,\n { backgroundColor: transparent },\n !uri ? { borderLeftColor: accent_blue, ...noURI } : {},\n stylesProp.authorNameFooterContainer,\n ]}\n >\n {!uri && author_name && (\n <Text\n style={[\n styles.authorNameFooter,\n { color: accent_blue },\n authorNameFooter,\n stylesProp.authorNameFooter,\n ]}\n >\n {author_name}\n </Text>\n )}\n {title && (\n <Text\n numberOfLines={1}\n style={[styles.title, { color: black }, titleStyle, stylesProp.title]}\n >\n {title}\n </Text>\n )}\n {text && (\n <Text\n numberOfLines={3}\n style={[styles.description, { color: black }, description, stylesProp.description]}\n >\n {text}\n </Text>\n )}\n </View>\n </View>\n )}\n </TouchableOpacity>\n );\n};\n\nconst MemoizedCard = React.memo(CardWithContext, () => true) as typeof CardWithContext;\n\nexport type CardProps<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = Attachment<StreamChatGenerics> &\n Partial<\n Pick<MessageContextValue<StreamChatGenerics>, 'onLongPress' | 'onPress' | 'onPressIn'> &\n Pick<\n MessagesContextValue<StreamChatGenerics>,\n 'additionalTouchableProps' | 'CardCover' | 'CardFooter' | 'CardHeader'\n >\n >;\n\n/**\n * UI component for card in attachments.\n */\nexport const Card = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n props: CardProps<StreamChatGenerics>,\n) => {\n const { message, onLongPress, onPress, onPressIn, preventPress } =\n useMessageContext<StreamChatGenerics>();\n const { additionalTouchableProps, CardCover, CardFooter, CardHeader } =\n useMessagesContext<StreamChatGenerics>();\n\n return (\n <MemoizedCard\n {...{\n additionalTouchableProps,\n CardCover,\n CardFooter,\n CardHeader,\n channelId: message.cid,\n messageId: message.id,\n onLongPress,\n onPress,\n onPressIn,\n preventPress,\n }}\n {...props}\n />\n );\n};\n\nCard.displayName = 'Card{messageSimple{card}}';\n"]}
|
|
1
|
+
{"version":3,"sources":["Card.tsx"],"names":["styles","StyleSheet","create","authorName","fontSize","fontWeight","authorNameContainer","borderTopRightRadius","paddingHorizontal","paddingTop","authorNameFooter","padding","authorNameMask","bottom","left","position","cardCover","borderRadius","height","marginHorizontal","cardFooter","flexDirection","justifyContent","container","overflow","width","description","title","CardWithContext","props","additionalTouchableProps","author_name","CardCover","CardFooter","CardHeader","image_url","og_scrape_url","onLongPress","onPress","onPressIn","preventPress","stylesProp","text","thumb_url","theme","colors","accent_blue","black","blue_alice","transparent","messageSimple","card","authorNameFooterContainer","cover","footer","titleStyle","footerStyle","noURI","uri","error","openURL","defaultOnPress","event","additionalInfo","url","emitter","defaultHandler","backgroundColor","color","borderLeftColor","MemoizedCard","React","memo","Card","message","channelId","cid","messageId","id","displayName"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AAcA;;AAEA;;AAIA;;AAIA;;AAEA;;;;;;;AAEA,IAAMA,MAAM,GAAGC,wBAAWC,MAAX,CAAkB;AAC/BC,EAAAA,UAAU,EAAE;AAAEC,IAAAA,QAAQ,EAAE,IAAZ;AAAkBC,IAAAA,UAAU,EAAE;AAA9B,GADmB;AAE/BC,EAAAA,mBAAmB,EAAE;AACnBC,IAAAA,oBAAoB,EAAE,EADH;AAEnBC,IAAAA,iBAAiB,EAAE,CAFA;AAGnBC,IAAAA,UAAU,EAAE;AAHO,GAFU;AAO/BC,EAAAA,gBAAgB,EAAE;AAChBN,IAAAA,QAAQ,EAAE,IADM;AAEhBC,IAAAA,UAAU,EAAE,KAFI;AAGhBM,IAAAA,OAAO,EAAE;AAHO,GAPa;AAY/BC,EAAAA,cAAc,EAAE;AACdC,IAAAA,MAAM,EAAE,CADM;AAEdC,IAAAA,IAAI,EAAE,CAFQ;AAGdC,IAAAA,QAAQ,EAAE;AAHI,GAZe;AAiB/BC,E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AAAA,MAAQ6C,OAAR,sBAAQA,OAAR;AAAA,MAAiBrC,WAAjB,sBAAiBA,WAAjB;AAAA,MAA8BC,OAA9B,sBAA8BA,OAA9B;AAAA,MAAuCC,SAAvC,sBAAuCA,SAAvC;AAAA,MAAkDC,YAAlD,sBAAkDA,YAAlD;;AAEA,4BACE,0CADF;AAAA,MAAQV,wBAAR,uBAAQA,wBAAR;AAAA,MAAkCE,SAAlC,uBAAkCA,SAAlC;AAAA,MAA6CC,UAA7C,uBAA6CA,UAA7C;AAAA,MAAyDC,UAAzD,uBAAyDA,UAAzD;;AAGA,SACE,gCAAC,YAAD;AAEIJ,IAAAA,wBAAwB,EAAxBA,wBAFJ;AAGIE,IAAAA,SAAS,EAATA,SAHJ;AAIIC,IAAAA,UAAU,EAAVA,UAJJ;AAKIC,IAAAA,UAAU,EAAVA,UALJ;AAMIyC,IAAAA,SAAS,EAAED,OAAO,CAACE,GANvB;AAOIC,IAAAA,SAAS,EAAEH,OAAO,CAACI,EAPvB;AAQIzC,IAAAA,WAAW,EAAXA,WARJ;AASIC,IAAAA,OAAO,EAAPA,OATJ;AAUIC,IAAAA,SAAS,EAATA,SAVJ;AAWIC,IAAAA,YAAY,EAAZA;AAXJ,KAaMX,KAbN;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KADF;AAiBD,CA3BM;;;AA6BP4C,IAAI,CAACM,WAAL,GAAmB,2BAAnB","sourcesContent":["import React from 'react';\nimport {\n Image,\n ImageStyle,\n StyleProp,\n StyleSheet,\n Text,\n TextStyle,\n TouchableOpacity,\n View,\n ViewStyle,\n} from 'react-native';\n\nimport type { Attachment } from 'stream-chat';\n\nimport { useGoToURL } from './hooks/useGoToURL';\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';\nimport type { DefaultStreamChatGenerics } from '../../types/types';\nimport { makeImageCompatibleUrl } from '../../utils/utils';\n\nconst styles = StyleSheet.create({\n authorName: { fontSize: 14.5, fontWeight: '600' },\n authorNameContainer: {\n borderTopRightRadius: 15,\n paddingHorizontal: 8,\n paddingTop: 8,\n },\n authorNameFooter: {\n fontSize: 14.5,\n fontWeight: '600',\n padding: 8,\n },\n authorNameMask: {\n bottom: 0,\n left: 8,\n position: 'absolute',\n },\n cardCover: {\n borderRadius: 8,\n height: 140,\n marginHorizontal: 8,\n },\n cardFooter: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n padding: 10,\n },\n container: {\n overflow: 'hidden',\n width: 256,\n },\n description: {\n fontSize: 12,\n marginHorizontal: 8,\n },\n title: {\n fontSize: 12,\n marginHorizontal: 8,\n },\n});\n\nexport type CardPropsWithContext<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = Attachment<StreamChatGenerics> &\n Pick<\n MessageContextValue<StreamChatGenerics>,\n 'onLongPress' | 'onPress' | 'onPressIn' | 'preventPress'\n > &\n Pick<\n MessagesContextValue<StreamChatGenerics>,\n 'additionalTouchableProps' | 'CardCover' | 'CardFooter' | 'CardHeader'\n > & {\n channelId: string | undefined;\n messageId: string | undefined;\n styles?: Partial<{\n authorName: StyleProp<TextStyle>;\n authorNameContainer: StyleProp<ViewStyle>;\n authorNameFooter: StyleProp<TextStyle>;\n authorNameFooterContainer: StyleProp<ViewStyle>;\n authorNameMask: StyleProp<ViewStyle>;\n cardCover: StyleProp<ImageStyle>;\n cardFooter: StyleProp<ViewStyle>;\n container: StyleProp<ViewStyle>;\n description: StyleProp<TextStyle>;\n title: StyleProp<TextStyle>;\n }>;\n };\n\nconst CardWithContext = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n props: CardPropsWithContext<StreamChatGenerics>,\n) => {\n const {\n additionalTouchableProps,\n author_name,\n CardCover,\n CardFooter,\n CardHeader,\n image_url,\n og_scrape_url,\n onLongPress,\n onPress,\n onPressIn,\n preventPress,\n styles: stylesProp = {},\n text,\n thumb_url,\n title,\n } = props;\n\n const {\n theme: {\n colors: { accent_blue, black, blue_alice, transparent },\n messageSimple: {\n card: {\n authorName,\n authorNameContainer,\n authorNameFooter,\n authorNameFooterContainer,\n authorNameMask,\n container,\n cover,\n footer: { description, title: titleStyle, ...footerStyle },\n noURI,\n },\n },\n },\n } = useTheme();\n\n const uri = image_url || thumb_url;\n\n const [error, openURL] = useGoToURL(og_scrape_url || uri);\n\n const defaultOnPress = () => !error && openURL && openURL();\n\n return (\n <TouchableOpacity\n disabled={preventPress}\n onLongPress={(event) => {\n if (onLongPress) {\n onLongPress({\n additionalInfo: { url: og_scrape_url },\n emitter: 'card',\n event,\n });\n }\n }}\n onPress={(event) => {\n if (onPress) {\n onPress({\n additionalInfo: { url: og_scrape_url },\n defaultHandler: defaultOnPress,\n emitter: 'card',\n event,\n });\n }\n }}\n onPressIn={(event) => {\n if (onPressIn) {\n onPressIn({\n additionalInfo: { url: og_scrape_url },\n defaultHandler: defaultOnPress,\n emitter: 'card',\n event,\n });\n }\n }}\n style={[styles.container, container, stylesProp.container]}\n testID='card-attachment'\n {...additionalTouchableProps}\n >\n {CardHeader && <CardHeader {...props} />}\n {CardCover && <CardCover {...props} />}\n {uri && !CardCover && (\n <View>\n <Image\n resizeMode='cover'\n source={{ uri: makeImageCompatibleUrl(uri) }}\n style={[styles.cardCover, cover, stylesProp.cardCover]}\n />\n {author_name && (\n <View style={[styles.authorNameMask, authorNameMask, stylesProp.authorNameMask]}>\n <View\n style={[\n styles.authorNameContainer,\n { backgroundColor: blue_alice },\n authorNameContainer,\n stylesProp.authorNameContainer,\n ]}\n >\n <Text\n style={[\n styles.authorName,\n { color: accent_blue },\n authorName,\n stylesProp.authorName,\n ]}\n >\n {author_name}\n </Text>\n </View>\n </View>\n )}\n </View>\n )}\n {CardFooter ? (\n <CardFooter {...props} />\n ) : (\n <View style={[styles.cardFooter, footerStyle, stylesProp.cardFooter]}>\n <View\n style={[\n authorNameFooterContainer,\n { backgroundColor: transparent },\n !uri ? { borderLeftColor: accent_blue, ...noURI } : {},\n stylesProp.authorNameFooterContainer,\n ]}\n >\n {!uri && author_name && (\n <Text\n style={[\n styles.authorNameFooter,\n { color: accent_blue },\n authorNameFooter,\n stylesProp.authorNameFooter,\n ]}\n >\n {author_name}\n </Text>\n )}\n {title && (\n <Text\n numberOfLines={1}\n style={[styles.title, { color: black }, titleStyle, stylesProp.title]}\n >\n {title}\n </Text>\n )}\n {text && (\n <Text\n numberOfLines={3}\n style={[styles.description, { color: black }, description, stylesProp.description]}\n >\n {text}\n </Text>\n )}\n </View>\n </View>\n )}\n </TouchableOpacity>\n );\n};\n\nconst MemoizedCard = React.memo(CardWithContext, () => true) as typeof CardWithContext;\n\nexport type CardProps<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = Attachment<StreamChatGenerics> &\n Partial<\n Pick<MessageContextValue<StreamChatGenerics>, 'onLongPress' | 'onPress' | 'onPressIn'> &\n Pick<\n MessagesContextValue<StreamChatGenerics>,\n 'additionalTouchableProps' | 'CardCover' | 'CardFooter' | 'CardHeader'\n >\n >;\n\n/**\n * UI component for card in attachments.\n */\nexport const Card = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n props: CardProps<StreamChatGenerics>,\n) => {\n const { message, onLongPress, onPress, onPressIn, preventPress } =\n useMessageContext<StreamChatGenerics>();\n const { additionalTouchableProps, CardCover, CardFooter, CardHeader } =\n useMessagesContext<StreamChatGenerics>();\n\n return (\n <MemoizedCard\n {...{\n additionalTouchableProps,\n CardCover,\n CardFooter,\n CardHeader,\n channelId: message.cid,\n messageId: message.id,\n onLongPress,\n onPress,\n onPressIn,\n preventPress,\n }}\n {...props}\n />\n );\n};\n\nCard.displayName = 'Card{messageSimple{card}}';\n"]}
|
|
@@ -7,6 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.Gallery = void 0;
|
|
9
9
|
|
|
10
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
|
+
|
|
10
12
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
13
|
|
|
12
14
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
@@ -73,6 +75,9 @@ var styles = _reactNative.StyleSheet.create({
|
|
|
73
75
|
overflow: 'hidden'
|
|
74
76
|
},
|
|
75
77
|
imageContainer: {
|
|
78
|
+
display: 'flex',
|
|
79
|
+
flexDirection: 'row',
|
|
80
|
+
justifyContent: 'center',
|
|
76
81
|
padding: 1
|
|
77
82
|
},
|
|
78
83
|
moreImagesContainer: {
|
|
@@ -102,7 +107,9 @@ var GalleryWithContext = function GalleryWithContext(props) {
|
|
|
102
107
|
setImage = props.setImage,
|
|
103
108
|
setImages = props.setImages,
|
|
104
109
|
setOverlay = props.setOverlay,
|
|
105
|
-
threadList = props.threadList
|
|
110
|
+
threadList = props.threadList,
|
|
111
|
+
videos = props.videos,
|
|
112
|
+
VideoThumbnail = props.VideoThumbnail;
|
|
106
113
|
|
|
107
114
|
var _useTheme = (0, _ThemeContext.useTheme)(),
|
|
108
115
|
_useTheme$theme = _useTheme.theme,
|
|
@@ -129,19 +136,20 @@ var GalleryWithContext = function GalleryWithContext(props) {
|
|
|
129
136
|
minHeight: minHeight,
|
|
130
137
|
minWidth: minWidth
|
|
131
138
|
};
|
|
139
|
+
var imagesAndVideos = [].concat((0, _toConsumableArray2["default"])(images || []), (0, _toConsumableArray2["default"])(videos || []));
|
|
132
140
|
|
|
133
141
|
var _useMemo = (0, _react.useMemo)(function () {
|
|
134
142
|
return (0, _buildGallery.buildGallery)({
|
|
135
|
-
images:
|
|
143
|
+
images: imagesAndVideos,
|
|
136
144
|
sizeConfig: sizeConfig
|
|
137
145
|
});
|
|
138
|
-
}, [
|
|
146
|
+
}, [imagesAndVideos.length]),
|
|
139
147
|
height = _useMemo.height,
|
|
140
148
|
invertedDirections = _useMemo.invertedDirections,
|
|
141
149
|
thumbnailGrid = _useMemo.thumbnailGrid,
|
|
142
150
|
width = _useMemo.width;
|
|
143
151
|
|
|
144
|
-
if (!(
|
|
152
|
+
if (!(imagesAndVideos != null && imagesAndVideos.length)) return null;
|
|
145
153
|
var messageText = message == null ? void 0 : message.text;
|
|
146
154
|
var messageId = message == null ? void 0 : message.id;
|
|
147
155
|
var numOfColumns = thumbnailGrid.length;
|
|
@@ -156,7 +164,7 @@ var GalleryWithContext = function GalleryWithContext(props) {
|
|
|
156
164
|
__self: _this,
|
|
157
165
|
__source: {
|
|
158
166
|
fileName: _jsxFileName,
|
|
159
|
-
lineNumber:
|
|
167
|
+
lineNumber: 180,
|
|
160
168
|
columnNumber: 5
|
|
161
169
|
}
|
|
162
170
|
}, thumbnailGrid.map(function (rows, colIndex) {
|
|
@@ -170,12 +178,13 @@ var GalleryWithContext = function GalleryWithContext(props) {
|
|
|
170
178
|
__self: _this,
|
|
171
179
|
__source: {
|
|
172
180
|
fileName: _jsxFileName,
|
|
173
|
-
lineNumber:
|
|
181
|
+
lineNumber: 197,
|
|
174
182
|
columnNumber: 11
|
|
175
183
|
}
|
|
176
184
|
}, rows.map(function (_ref, rowIndex) {
|
|
177
185
|
var height = _ref.height,
|
|
178
186
|
resizeMode = _ref.resizeMode,
|
|
187
|
+
type = _ref.type,
|
|
179
188
|
url = _ref.url,
|
|
180
189
|
width = _ref.width;
|
|
181
190
|
|
|
@@ -196,10 +205,25 @@ var GalleryWithContext = function GalleryWithContext(props) {
|
|
|
196
205
|
}
|
|
197
206
|
};
|
|
198
207
|
|
|
208
|
+
var borderRadius = (0, _getGalleryImageBorderRadius.getGalleryImageBorderRadius)({
|
|
209
|
+
alignment: alignment,
|
|
210
|
+
colIndex: colIndex,
|
|
211
|
+
groupStyles: groupStyles,
|
|
212
|
+
hasThreadReplies: hasThreadReplies,
|
|
213
|
+
height: height,
|
|
214
|
+
invertedDirections: invertedDirections,
|
|
215
|
+
messageText: messageText,
|
|
216
|
+
numOfColumns: numOfColumns,
|
|
217
|
+
numOfRows: numOfRows,
|
|
218
|
+
rowIndex: rowIndex,
|
|
219
|
+
sizeConfig: sizeConfig,
|
|
220
|
+
threadList: threadList,
|
|
221
|
+
width: width
|
|
222
|
+
});
|
|
199
223
|
return _react["default"].createElement(_reactNative.TouchableOpacity, (0, _extends2["default"])({
|
|
200
224
|
activeOpacity: 0.8,
|
|
201
225
|
disabled: preventPress,
|
|
202
|
-
key: "gallery-item-" + messageId + "/" + colIndex + "/" + rowIndex + "/" +
|
|
226
|
+
key: "gallery-item-" + messageId + "/" + colIndex + "/" + rowIndex + "/" + imagesAndVideos.length,
|
|
203
227
|
onLongPress: function onLongPress(event) {
|
|
204
228
|
if (_onLongPress) {
|
|
205
229
|
_onLongPress({
|
|
@@ -235,26 +259,23 @@ var GalleryWithContext = function GalleryWithContext(props) {
|
|
|
235
259
|
__self: _this,
|
|
236
260
|
__source: {
|
|
237
261
|
fileName: _jsxFileName,
|
|
238
|
-
lineNumber:
|
|
262
|
+
lineNumber: 239,
|
|
239
263
|
columnNumber: 17
|
|
240
264
|
}
|
|
241
|
-
}), _react["default"].createElement(
|
|
265
|
+
}), type === 'video' ? _react["default"].createElement(VideoThumbnail, {
|
|
266
|
+
style: [borderRadius, image, {
|
|
267
|
+
height: height - 1,
|
|
268
|
+
width: width - 1
|
|
269
|
+
}],
|
|
270
|
+
__self: _this,
|
|
271
|
+
__source: {
|
|
272
|
+
fileName: _jsxFileName,
|
|
273
|
+
lineNumber: 283,
|
|
274
|
+
columnNumber: 21
|
|
275
|
+
}
|
|
276
|
+
}) : _react["default"].createElement(MemoizedGalleryImage, {
|
|
242
277
|
resizeMode: resizeMode,
|
|
243
|
-
style: [
|
|
244
|
-
alignment: alignment,
|
|
245
|
-
colIndex: colIndex,
|
|
246
|
-
groupStyles: groupStyles,
|
|
247
|
-
hasThreadReplies: hasThreadReplies,
|
|
248
|
-
height: height,
|
|
249
|
-
invertedDirections: invertedDirections,
|
|
250
|
-
messageText: messageText,
|
|
251
|
-
numOfColumns: numOfColumns,
|
|
252
|
-
numOfRows: numOfRows,
|
|
253
|
-
rowIndex: rowIndex,
|
|
254
|
-
sizeConfig: sizeConfig,
|
|
255
|
-
threadList: threadList,
|
|
256
|
-
width: width
|
|
257
|
-
}), image, {
|
|
278
|
+
style: [borderRadius, image, {
|
|
258
279
|
height: height - 1,
|
|
259
280
|
width: width - 1
|
|
260
281
|
}],
|
|
@@ -262,17 +283,17 @@ var GalleryWithContext = function GalleryWithContext(props) {
|
|
|
262
283
|
__self: _this,
|
|
263
284
|
__source: {
|
|
264
285
|
fileName: _jsxFileName,
|
|
265
|
-
lineNumber:
|
|
266
|
-
columnNumber:
|
|
286
|
+
lineNumber: 294,
|
|
287
|
+
columnNumber: 21
|
|
267
288
|
}
|
|
268
|
-
}), colIndex === numOfColumns - 1 && rowIndex === numOfRows - 1 &&
|
|
289
|
+
}), colIndex === numOfColumns - 1 && rowIndex === numOfRows - 1 && imagesAndVideos.length > 4 ? _react["default"].createElement(_reactNative.View, {
|
|
269
290
|
style: [_reactNative.StyleSheet.absoluteFillObject, styles.moreImagesContainer, {
|
|
270
291
|
backgroundColor: overlay
|
|
271
292
|
}, moreImagesContainer],
|
|
272
293
|
__self: _this,
|
|
273
294
|
__source: {
|
|
274
295
|
fileName: _jsxFileName,
|
|
275
|
-
lineNumber:
|
|
296
|
+
lineNumber: 310,
|
|
276
297
|
columnNumber: 21
|
|
277
298
|
}
|
|
278
299
|
}, _react["default"].createElement(_reactNative.Text, {
|
|
@@ -280,10 +301,10 @@ var GalleryWithContext = function GalleryWithContext(props) {
|
|
|
280
301
|
__self: _this,
|
|
281
302
|
__source: {
|
|
282
303
|
fileName: _jsxFileName,
|
|
283
|
-
lineNumber:
|
|
304
|
+
lineNumber: 318,
|
|
284
305
|
columnNumber: 23
|
|
285
306
|
}
|
|
286
|
-
}, "+" + (
|
|
307
|
+
}, "+" + (imagesAndVideos.length - 4))) : null);
|
|
287
308
|
}));
|
|
288
309
|
}));
|
|
289
310
|
};
|
|
@@ -292,11 +313,13 @@ var areEqual = function areEqual(prevProps, nextProps) {
|
|
|
292
313
|
var prevGroupStyles = prevProps.groupStyles,
|
|
293
314
|
prevHasThreadReplies = prevProps.hasThreadReplies,
|
|
294
315
|
prevImages = prevProps.images,
|
|
295
|
-
prevMessage = prevProps.message
|
|
316
|
+
prevMessage = prevProps.message,
|
|
317
|
+
prevVideos = prevProps.videos;
|
|
296
318
|
var nextGroupStyles = nextProps.groupStyles,
|
|
297
319
|
nextHasThreadReplies = nextProps.hasThreadReplies,
|
|
298
320
|
nextImages = nextProps.images,
|
|
299
|
-
nextMessage = nextProps.message
|
|
321
|
+
nextMessage = nextProps.message,
|
|
322
|
+
nextVideos = nextProps.videos;
|
|
300
323
|
var messageEqual = (prevMessage == null ? void 0 : prevMessage.id) === (nextMessage == null ? void 0 : nextMessage.id);
|
|
301
324
|
if (!messageEqual) return false;
|
|
302
325
|
var groupStylesEqual = prevGroupStyles.length === nextGroupStyles.length && prevGroupStyles[0] === nextGroupStyles[0];
|
|
@@ -307,6 +330,10 @@ var areEqual = function areEqual(prevProps, nextProps) {
|
|
|
307
330
|
return (0, _utils.getUrlWithoutParams)(image.image_url) === (0, _utils.getUrlWithoutParams)(nextImages[index].image_url) && (0, _utils.getUrlWithoutParams)(image.thumb_url) === (0, _utils.getUrlWithoutParams)(nextImages[index].thumb_url);
|
|
308
331
|
});
|
|
309
332
|
if (!imagesEqual) return false;
|
|
333
|
+
var videosEqual = prevVideos.length === nextVideos.length && prevVideos.every(function (image, index) {
|
|
334
|
+
return (0, _utils.getUrlWithoutParams)(image.image_url) === (0, _utils.getUrlWithoutParams)(nextVideos[index].image_url) && (0, _utils.getUrlWithoutParams)(image.thumb_url) === (0, _utils.getUrlWithoutParams)(nextVideos[index].thumb_url);
|
|
335
|
+
});
|
|
336
|
+
if (!videosEqual) return false;
|
|
310
337
|
return true;
|
|
311
338
|
};
|
|
312
339
|
|
|
@@ -324,7 +351,9 @@ var Gallery = function Gallery(props) {
|
|
|
324
351
|
propPreventPress = props.preventPress,
|
|
325
352
|
propSetImage = props.setImage,
|
|
326
353
|
propSetOverlay = props.setOverlay,
|
|
327
|
-
propThreadList = props.threadList
|
|
354
|
+
propThreadList = props.threadList,
|
|
355
|
+
propVideos = props.videos,
|
|
356
|
+
PropVideoThumbnail = props.VideoThumbnail;
|
|
328
357
|
|
|
329
358
|
var _useImageGalleryConte = (0, _ImageGalleryContext.useImageGalleryContext)(),
|
|
330
359
|
contextSetImage = _useImageGalleryConte.setImage,
|
|
@@ -339,17 +368,20 @@ var Gallery = function Gallery(props) {
|
|
|
339
368
|
contextOnPress = _useMessageContext.onPress,
|
|
340
369
|
contextOnPressIn = _useMessageContext.onPressIn,
|
|
341
370
|
contextPreventPress = _useMessageContext.preventPress,
|
|
342
|
-
contextThreadList = _useMessageContext.threadList
|
|
371
|
+
contextThreadList = _useMessageContext.threadList,
|
|
372
|
+
contextVideos = _useMessageContext.videos;
|
|
343
373
|
|
|
344
374
|
var _useMessagesContext = (0, _MessagesContext.useMessagesContext)(),
|
|
345
375
|
contextAdditionalTouchableProps = _useMessagesContext.additionalTouchableProps,
|
|
346
|
-
legacyImageViewerSwipeBehaviour = _useMessagesContext.legacyImageViewerSwipeBehaviour
|
|
376
|
+
legacyImageViewerSwipeBehaviour = _useMessagesContext.legacyImageViewerSwipeBehaviour,
|
|
377
|
+
ContextVideoThumnbnail = _useMessagesContext.VideoThumbnail;
|
|
347
378
|
|
|
348
379
|
var _useOverlayContext = (0, _OverlayContext.useOverlayContext)(),
|
|
349
380
|
contextSetOverlay = _useOverlayContext.setOverlay;
|
|
350
381
|
|
|
351
382
|
var images = propImages || contextImages;
|
|
352
|
-
|
|
383
|
+
var videos = propVideos || contextVideos;
|
|
384
|
+
if (!images.length && !videos.length) return null;
|
|
353
385
|
var additionalTouchableProps = propAdditionalTouchableProps || contextAdditionalTouchableProps;
|
|
354
386
|
var alignment = propAlignment || contextAlignment;
|
|
355
387
|
var groupStyles = propGroupStyles || contextGroupStyles;
|
|
@@ -360,6 +392,7 @@ var Gallery = function Gallery(props) {
|
|
|
360
392
|
var setImage = propSetImage || contextSetImage;
|
|
361
393
|
var setOverlay = propSetOverlay || contextSetOverlay;
|
|
362
394
|
var threadList = propThreadList || contextThreadList;
|
|
395
|
+
var VideoThumbnail = PropVideoThumbnail || ContextVideoThumnbnail;
|
|
363
396
|
return _react["default"].createElement(MemoizedGallery, {
|
|
364
397
|
additionalTouchableProps: additionalTouchableProps,
|
|
365
398
|
alignment: alignment,
|
|
@@ -377,10 +410,12 @@ var Gallery = function Gallery(props) {
|
|
|
377
410
|
setImages: setImages,
|
|
378
411
|
setOverlay: setOverlay,
|
|
379
412
|
threadList: threadList,
|
|
413
|
+
videos: videos,
|
|
414
|
+
VideoThumbnail: VideoThumbnail,
|
|
380
415
|
__self: _this,
|
|
381
416
|
__source: {
|
|
382
417
|
fileName: _jsxFileName,
|
|
383
|
-
lineNumber:
|
|
418
|
+
lineNumber: 453,
|
|
384
419
|
columnNumber: 5
|
|
385
420
|
}
|
|
386
421
|
});
|