stream-chat-react-native-core 4.1.4 → 4.2.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/components/Attachment/Attachment.js +16 -10
- package/lib/commonjs/components/Attachment/Attachment.js.map +1 -1
- package/lib/commonjs/components/Attachment/Giphy.js +61 -40
- package/lib/commonjs/components/Attachment/Giphy.js.map +1 -1
- package/lib/commonjs/components/Channel/Channel.js +16 -13
- package/lib/commonjs/components/Channel/Channel.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useCreateMessagesContext.js +2 -0
- package/lib/commonjs/components/Channel/hooks/useCreateMessagesContext.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageContent.js +42 -20
- package/lib/commonjs/components/Message/MessageSimple/MessageContent.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 +1 -0
- package/lib/commonjs/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/Attachment/Attachment.js +16 -10
- package/lib/module/components/Attachment/Attachment.js.map +1 -1
- package/lib/module/components/Attachment/Giphy.js +61 -40
- package/lib/module/components/Attachment/Giphy.js.map +1 -1
- package/lib/module/components/Channel/Channel.js +16 -13
- package/lib/module/components/Channel/Channel.js.map +1 -1
- package/lib/module/components/Channel/hooks/useCreateMessagesContext.js +2 -0
- package/lib/module/components/Channel/hooks/useCreateMessagesContext.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/MessageContent.js +42 -20
- package/lib/module/components/Message/MessageSimple/MessageContent.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 +1 -0
- package/lib/module/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/module/version.json +1 -1
- package/lib/typescript/components/Attachment/Attachment.d.ts +2 -2
- package/lib/typescript/components/Attachment/Giphy.d.ts +2 -2
- package/lib/typescript/components/Channel/Channel.d.ts +1 -1
- package/lib/typescript/components/Channel/hooks/useCreateMessagesContext.d.ts +1 -1
- package/lib/typescript/contexts/messagesContext/MessagesContext.d.ts +5 -1
- package/lib/typescript/contexts/themeContext/utils/theme.d.ts +1 -0
- package/package.json +2 -2
- package/src/components/Attachment/Attachment.tsx +29 -4
- package/src/components/Attachment/Giphy.tsx +55 -22
- package/src/components/Attachment/__tests__/Attachment.test.js +41 -0
- package/src/components/Channel/Channel.tsx +3 -0
- package/src/components/Channel/hooks/useCreateMessagesContext.ts +2 -0
- package/src/components/Message/MessageSimple/MessageContent.tsx +20 -13
- package/src/contexts/messagesContext/MessagesContext.tsx +5 -2
- package/src/contexts/themeContext/utils/theme.ts +1 -0
- package/src/version.json +1 -1
|
@@ -33,16 +33,18 @@ var AttachmentWithContext = function AttachmentWithContext(props) {
|
|
|
33
33
|
FileAttachment = props.FileAttachment,
|
|
34
34
|
Gallery = props.Gallery,
|
|
35
35
|
Giphy = props.Giphy,
|
|
36
|
+
giphyVersion = props.giphyVersion,
|
|
36
37
|
UrlPreview = props.UrlPreview;
|
|
37
38
|
var hasAttachmentActions = !!((_attachment$actions = attachment.actions) != null && _attachment$actions.length);
|
|
38
39
|
|
|
39
40
|
if (attachment.type === 'giphy' || attachment.type === 'imgur') {
|
|
40
41
|
return _react["default"].createElement(Giphy, {
|
|
41
42
|
attachment: attachment,
|
|
43
|
+
giphyVersion: giphyVersion,
|
|
42
44
|
__self: _this,
|
|
43
45
|
__source: {
|
|
44
46
|
fileName: _jsxFileName,
|
|
45
|
-
lineNumber:
|
|
47
|
+
lineNumber: 56,
|
|
46
48
|
columnNumber: 12
|
|
47
49
|
}
|
|
48
50
|
});
|
|
@@ -53,7 +55,7 @@ var AttachmentWithContext = function AttachmentWithContext(props) {
|
|
|
53
55
|
__self: _this,
|
|
54
56
|
__source: {
|
|
55
57
|
fileName: _jsxFileName,
|
|
56
|
-
lineNumber:
|
|
58
|
+
lineNumber: 63,
|
|
57
59
|
columnNumber: 12
|
|
58
60
|
}
|
|
59
61
|
}));
|
|
@@ -65,7 +67,7 @@ var AttachmentWithContext = function AttachmentWithContext(props) {
|
|
|
65
67
|
__self: _this,
|
|
66
68
|
__source: {
|
|
67
69
|
fileName: _jsxFileName,
|
|
68
|
-
lineNumber:
|
|
70
|
+
lineNumber: 69,
|
|
69
71
|
columnNumber: 9
|
|
70
72
|
}
|
|
71
73
|
}), hasAttachmentActions && _react["default"].createElement(AttachmentActions, (0, _extends2["default"])({
|
|
@@ -74,7 +76,7 @@ var AttachmentWithContext = function AttachmentWithContext(props) {
|
|
|
74
76
|
__self: _this,
|
|
75
77
|
__source: {
|
|
76
78
|
fileName: _jsxFileName,
|
|
77
|
-
lineNumber:
|
|
79
|
+
lineNumber: 71,
|
|
78
80
|
columnNumber: 11
|
|
79
81
|
}
|
|
80
82
|
})));
|
|
@@ -86,7 +88,7 @@ var AttachmentWithContext = function AttachmentWithContext(props) {
|
|
|
86
88
|
__self: _this,
|
|
87
89
|
__source: {
|
|
88
90
|
fileName: _jsxFileName,
|
|
89
|
-
lineNumber:
|
|
91
|
+
lineNumber: 78,
|
|
90
92
|
columnNumber: 12
|
|
91
93
|
}
|
|
92
94
|
});
|
|
@@ -98,7 +100,7 @@ var AttachmentWithContext = function AttachmentWithContext(props) {
|
|
|
98
100
|
__self: _this,
|
|
99
101
|
__source: {
|
|
100
102
|
fileName: _jsxFileName,
|
|
101
|
-
lineNumber:
|
|
103
|
+
lineNumber: 84,
|
|
102
104
|
columnNumber: 7
|
|
103
105
|
}
|
|
104
106
|
});
|
|
@@ -109,7 +111,7 @@ var AttachmentWithContext = function AttachmentWithContext(props) {
|
|
|
109
111
|
__self: _this,
|
|
110
112
|
__source: {
|
|
111
113
|
fileName: _jsxFileName,
|
|
112
|
-
lineNumber:
|
|
114
|
+
lineNumber: 91,
|
|
113
115
|
columnNumber: 9
|
|
114
116
|
}
|
|
115
117
|
})), _react["default"].createElement(AttachmentActions, (0, _extends2["default"])({
|
|
@@ -118,7 +120,7 @@ var AttachmentWithContext = function AttachmentWithContext(props) {
|
|
|
118
120
|
__self: _this,
|
|
119
121
|
__source: {
|
|
120
122
|
fileName: _jsxFileName,
|
|
121
|
-
lineNumber:
|
|
123
|
+
lineNumber: 92,
|
|
122
124
|
columnNumber: 9
|
|
123
125
|
}
|
|
124
126
|
})));
|
|
@@ -127,7 +129,7 @@ var AttachmentWithContext = function AttachmentWithContext(props) {
|
|
|
127
129
|
__self: _this,
|
|
128
130
|
__source: {
|
|
129
131
|
fileName: _jsxFileName,
|
|
130
|
-
lineNumber:
|
|
132
|
+
lineNumber: 96,
|
|
131
133
|
columnNumber: 12
|
|
132
134
|
}
|
|
133
135
|
}));
|
|
@@ -152,6 +154,7 @@ var Attachment = function Attachment(props) {
|
|
|
152
154
|
PropFileAttachment = props.FileAttachment,
|
|
153
155
|
PropGallery = props.Gallery,
|
|
154
156
|
PropGiphy = props.Giphy,
|
|
157
|
+
PropGiphyVersion = props.giphyVersion,
|
|
155
158
|
PropUrlPreview = props.UrlPreview;
|
|
156
159
|
|
|
157
160
|
var _useMessagesContext = (0, _MessagesContext.useMessagesContext)(),
|
|
@@ -160,6 +163,7 @@ var Attachment = function Attachment(props) {
|
|
|
160
163
|
ContextFileAttachment = _useMessagesContext.FileAttachment,
|
|
161
164
|
ContextGallery = _useMessagesContext.Gallery,
|
|
162
165
|
ContextGiphy = _useMessagesContext.Giphy,
|
|
166
|
+
ContextGiphyVersion = _useMessagesContext.giphyVersion,
|
|
163
167
|
ContextUrlPreview = _useMessagesContext.UrlPreview;
|
|
164
168
|
|
|
165
169
|
if (!attachment) {
|
|
@@ -172,6 +176,7 @@ var Attachment = function Attachment(props) {
|
|
|
172
176
|
var Gallery = PropGallery || ContextGallery || _Gallery.Gallery;
|
|
173
177
|
var Giphy = PropGiphy || ContextGiphy || _Giphy.Giphy;
|
|
174
178
|
var UrlPreview = PropUrlPreview || ContextUrlPreview || _Card.Card;
|
|
179
|
+
var giphyVersion = PropGiphyVersion || ContextGiphyVersion;
|
|
175
180
|
return _react["default"].createElement(MemoizedAttachment, {
|
|
176
181
|
attachment: attachment,
|
|
177
182
|
AttachmentActions: AttachmentActions,
|
|
@@ -179,11 +184,12 @@ var Attachment = function Attachment(props) {
|
|
|
179
184
|
FileAttachment: FileAttachment,
|
|
180
185
|
Gallery: Gallery,
|
|
181
186
|
Giphy: Giphy,
|
|
187
|
+
giphyVersion: giphyVersion,
|
|
182
188
|
UrlPreview: UrlPreview,
|
|
183
189
|
__self: _this,
|
|
184
190
|
__source: {
|
|
185
191
|
fileName: _jsxFileName,
|
|
186
|
-
lineNumber:
|
|
192
|
+
lineNumber: 179,
|
|
187
193
|
columnNumber: 5
|
|
188
194
|
}
|
|
189
195
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Attachment.tsx"],"names":["AttachmentWithContext","props","attachment","AttachmentActions","Card","FileAttachment","Gallery","Giphy","UrlPreview","hasAttachmentActions","actions","length","type","title_link","og_scrape_url","image_url","thumb_url","id","asset_url","areEqual","prevProps","nextProps","prevAttachment","nextAttachment","attachmentEqual","MemoizedAttachment","React","memo","Attachment","PropAttachmentActions","PropCard","PropFileAttachment","PropGallery","PropGiphy","PropUrlPreview","ContextAttachmentActions","ContextCard","ContextFileAttachment","ContextGallery","ContextGiphy","ContextUrlPreview","AttachmentActionsDefault","CardDefault","FileAttachmentDefault","GalleryDefault","GiphyDefault"],"mappings":";;;;;;;;;AAAA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;AAqBA,IAAMA,qBAAqB,GAAG,SAAxBA,qBAAwB,CAG5BC,KAH4B,EAIzB;AAAA;;AACH,MAAQC,UAAR,GAA4FD,KAA5F,CAAQC,UAAR;AAAA,MAAoBC,iBAApB,GAA4FF,KAA5F,C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AAAA,OAAO,EAAPA,OANJ;AAOIC,IAAAA,KAAK,EAALA,KAPJ;AAQIC,IAAAA,UAAU,EAAVA,UARJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IADF;AAaD,CAjDM","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' | 'Card' | 'FileAttachment' | 'Gallery' | 'Giphy' | '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 { attachment, AttachmentActions, Card, FileAttachment, Gallery, Giphy, UrlPreview } = props;\n\n const hasAttachmentActions = !!attachment.actions?.length;\n\n if (attachment.type === 'giphy' || attachment.type === 'imgur') {\n return <Giphy attachment={attachment} />;\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 } = 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\n return attachmentEqual;\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' | 'Card' | 'FileAttachment' | 'Gallery' | 'Giphy' | 'UrlPreview'\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 UrlPreview: PropUrlPreview,\n } = props;\n\n const {\n AttachmentActions: ContextAttachmentActions,\n Card: ContextCard,\n FileAttachment: ContextFileAttachment,\n Gallery: ContextGallery,\n Giphy: ContextGiphy,\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\n return (\n <MemoizedAttachment\n {...{\n attachment,\n AttachmentActions,\n Card,\n FileAttachment,\n Gallery,\n Giphy,\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","asset_url","areEqual","prevProps","nextProps","prevAttachment","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;;;;;AA2BA,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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,IAAAA,IAAI,EAAJA,IAJJ;AAKIC,IAAAA,cAAc,EAAdA,cALJ;AAMIC,IAAAA,OAAO,EAAPA,OANJ;AAOIC,IAAAA,KAAK,EAALA,KAPJ;AAQIC,IAAAA,YAAY,EAAZA,YARJ;AASIC,IAAAA,UAAU,EAAVA,UATJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IADF;AAcD,CArDM","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 | '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 } = 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\n return attachmentEqual;\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 >\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 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 UrlPreview,\n }}\n />\n );\n};\n"]}
|
|
@@ -27,6 +27,9 @@ var _this = this,
|
|
|
27
27
|
_jsxFileName = "/home/runner/work/stream-chat-react-native/stream-chat-react-native/package/src/components/Attachment/Giphy.tsx";
|
|
28
28
|
|
|
29
29
|
var styles = _reactNative.StyleSheet.create({
|
|
30
|
+
actionsRow: {
|
|
31
|
+
flexDirection: 'row'
|
|
32
|
+
},
|
|
30
33
|
buttonContainer: {
|
|
31
34
|
alignItems: 'center',
|
|
32
35
|
borderTopWidth: 1,
|
|
@@ -43,8 +46,10 @@ var styles = _reactNative.StyleSheet.create({
|
|
|
43
46
|
width: 270
|
|
44
47
|
},
|
|
45
48
|
giphy: {
|
|
49
|
+
alignSelf: 'center',
|
|
46
50
|
borderRadius: 2,
|
|
47
51
|
height: 170,
|
|
52
|
+
maxWidth: 270,
|
|
48
53
|
width: 270
|
|
49
54
|
},
|
|
50
55
|
giphyContainer: {
|
|
@@ -79,18 +84,16 @@ var styles = _reactNative.StyleSheet.create({
|
|
|
79
84
|
padding: 8,
|
|
80
85
|
width: '60%'
|
|
81
86
|
},
|
|
82
|
-
margin: {
|
|
83
|
-
margin: 1
|
|
84
|
-
},
|
|
85
|
-
row: {
|
|
86
|
-
flexDirection: 'row'
|
|
87
|
-
},
|
|
88
87
|
selectionContainer: {
|
|
89
88
|
borderBottomLeftRadius: 8,
|
|
90
89
|
borderWidth: 1,
|
|
91
90
|
overflow: 'hidden',
|
|
92
91
|
width: 272
|
|
93
92
|
},
|
|
93
|
+
selectionImageContainer: {
|
|
94
|
+
alignSelf: 'center',
|
|
95
|
+
margin: 1
|
|
96
|
+
},
|
|
94
97
|
send: {
|
|
95
98
|
fontSize: 14,
|
|
96
99
|
fontWeight: '600',
|
|
@@ -120,6 +123,7 @@ var GiphyWithContext = function GiphyWithContext(props) {
|
|
|
120
123
|
_onPressIn = props.onPressIn,
|
|
121
124
|
preventPress = props.preventPress;
|
|
122
125
|
var actions = attachment.actions,
|
|
126
|
+
giphyData = attachment.giphy,
|
|
123
127
|
image_url = attachment.image_url,
|
|
124
128
|
thumb_url = attachment.thumb_url,
|
|
125
129
|
title = attachment.title,
|
|
@@ -133,6 +137,7 @@ var GiphyWithContext = function GiphyWithContext(props) {
|
|
|
133
137
|
grey = _useTheme$theme$color.grey,
|
|
134
138
|
grey_dark = _useTheme$theme$color.grey_dark,
|
|
135
139
|
grey_gainsboro = _useTheme$theme$color.grey_gainsboro,
|
|
140
|
+
label_bg_transparent = _useTheme$theme$color.label_bg_transparent,
|
|
136
141
|
white = _useTheme$theme$color.white,
|
|
137
142
|
_useTheme$theme$messa = _useTheme$theme.messageSimple.giphy,
|
|
138
143
|
buttonContainer = _useTheme$theme$messa.buttonContainer,
|
|
@@ -150,6 +155,15 @@ var GiphyWithContext = function GiphyWithContext(props) {
|
|
|
150
155
|
shuffle = _useTheme$theme$messa.shuffle;
|
|
151
156
|
|
|
152
157
|
var uri = image_url || thumb_url;
|
|
158
|
+
var giphyDimensions = {};
|
|
159
|
+
|
|
160
|
+
if (type === 'giphy' && giphyData) {
|
|
161
|
+
var giphyVersionInfo = giphyData[props.giphyVersion];
|
|
162
|
+
uri = giphyVersionInfo.url;
|
|
163
|
+
giphyDimensions.height = parseFloat(giphyVersionInfo.height);
|
|
164
|
+
giphyDimensions.width = parseFloat(giphyVersionInfo.width);
|
|
165
|
+
}
|
|
166
|
+
|
|
153
167
|
if (!uri) return null;
|
|
154
168
|
return actions ? _react["default"].createElement(_reactNative.View, {
|
|
155
169
|
style: [styles.selectionContainer, {
|
|
@@ -159,7 +173,7 @@ var GiphyWithContext = function GiphyWithContext(props) {
|
|
|
159
173
|
__self: _this,
|
|
160
174
|
__source: {
|
|
161
175
|
fileName: _jsxFileName,
|
|
162
|
-
lineNumber:
|
|
176
|
+
lineNumber: 171,
|
|
163
177
|
columnNumber: 5
|
|
164
178
|
}
|
|
165
179
|
}, _react["default"].createElement(_reactNative.View, {
|
|
@@ -167,14 +181,14 @@ var GiphyWithContext = function GiphyWithContext(props) {
|
|
|
167
181
|
__self: _this,
|
|
168
182
|
__source: {
|
|
169
183
|
fileName: _jsxFileName,
|
|
170
|
-
lineNumber:
|
|
184
|
+
lineNumber: 178,
|
|
171
185
|
columnNumber: 7
|
|
172
186
|
}
|
|
173
187
|
}, _react["default"].createElement(_icons.GiphyIcon, {
|
|
174
188
|
__self: _this,
|
|
175
189
|
__source: {
|
|
176
190
|
fileName: _jsxFileName,
|
|
177
|
-
lineNumber:
|
|
191
|
+
lineNumber: 179,
|
|
178
192
|
columnNumber: 9
|
|
179
193
|
}
|
|
180
194
|
}), _react["default"].createElement(_reactNative.Text, {
|
|
@@ -182,7 +196,7 @@ var GiphyWithContext = function GiphyWithContext(props) {
|
|
|
182
196
|
__self: _this,
|
|
183
197
|
__source: {
|
|
184
198
|
fileName: _jsxFileName,
|
|
185
|
-
lineNumber:
|
|
199
|
+
lineNumber: 180,
|
|
186
200
|
columnNumber: 9
|
|
187
201
|
}
|
|
188
202
|
}, "Giphy"), _react["default"].createElement(_reactNative.Text, {
|
|
@@ -192,42 +206,42 @@ var GiphyWithContext = function GiphyWithContext(props) {
|
|
|
192
206
|
__self: _this,
|
|
193
207
|
__source: {
|
|
194
208
|
fileName: _jsxFileName,
|
|
195
|
-
lineNumber:
|
|
209
|
+
lineNumber: 181,
|
|
196
210
|
columnNumber: 9
|
|
197
211
|
}
|
|
198
212
|
}, "/giphy " + title)), _react["default"].createElement(_reactNative.View, {
|
|
199
|
-
style: styles.
|
|
213
|
+
style: styles.selectionImageContainer,
|
|
200
214
|
__self: _this,
|
|
201
215
|
__source: {
|
|
202
216
|
fileName: _jsxFileName,
|
|
203
|
-
lineNumber:
|
|
217
|
+
lineNumber: 185,
|
|
204
218
|
columnNumber: 7
|
|
205
219
|
}
|
|
206
220
|
}, _react["default"].createElement(_reactNative.Image, {
|
|
207
|
-
resizeMode: "
|
|
221
|
+
resizeMode: "contain",
|
|
208
222
|
source: {
|
|
209
223
|
uri: (0, _utils.makeImageCompatibleUrl)(uri)
|
|
210
224
|
},
|
|
211
|
-
style: [styles.giphy, giphy],
|
|
225
|
+
style: [styles.giphy, giphyDimensions, giphy],
|
|
212
226
|
__self: _this,
|
|
213
227
|
__source: {
|
|
214
228
|
fileName: _jsxFileName,
|
|
215
|
-
lineNumber:
|
|
229
|
+
lineNumber: 186,
|
|
216
230
|
columnNumber: 9
|
|
217
231
|
}
|
|
218
232
|
})), _react["default"].createElement(_reactNative.View, {
|
|
219
233
|
__self: _this,
|
|
220
234
|
__source: {
|
|
221
235
|
fileName: _jsxFileName,
|
|
222
|
-
lineNumber:
|
|
236
|
+
lineNumber: 192,
|
|
223
237
|
columnNumber: 7
|
|
224
238
|
}
|
|
225
239
|
}, _react["default"].createElement(_reactNative.View, {
|
|
226
|
-
style: styles.
|
|
240
|
+
style: styles.actionsRow,
|
|
227
241
|
__self: _this,
|
|
228
242
|
__source: {
|
|
229
243
|
fileName: _jsxFileName,
|
|
230
|
-
lineNumber:
|
|
244
|
+
lineNumber: 193,
|
|
231
245
|
columnNumber: 9
|
|
232
246
|
}
|
|
233
247
|
}, _react["default"].createElement(_reactNative.TouchableOpacity, {
|
|
@@ -243,7 +257,7 @@ var GiphyWithContext = function GiphyWithContext(props) {
|
|
|
243
257
|
__self: _this,
|
|
244
258
|
__source: {
|
|
245
259
|
fileName: _jsxFileName,
|
|
246
|
-
lineNumber:
|
|
260
|
+
lineNumber: 194,
|
|
247
261
|
columnNumber: 11
|
|
248
262
|
}
|
|
249
263
|
}, _react["default"].createElement(_reactNative.Text, {
|
|
@@ -253,7 +267,7 @@ var GiphyWithContext = function GiphyWithContext(props) {
|
|
|
253
267
|
__self: _this,
|
|
254
268
|
__source: {
|
|
255
269
|
fileName: _jsxFileName,
|
|
256
|
-
lineNumber:
|
|
270
|
+
lineNumber: 206,
|
|
257
271
|
columnNumber: 13
|
|
258
272
|
}
|
|
259
273
|
}, actions == null ? void 0 : actions[2].text)), _react["default"].createElement(_reactNative.TouchableOpacity, {
|
|
@@ -269,7 +283,7 @@ var GiphyWithContext = function GiphyWithContext(props) {
|
|
|
269
283
|
__self: _this,
|
|
270
284
|
__source: {
|
|
271
285
|
fileName: _jsxFileName,
|
|
272
|
-
lineNumber:
|
|
286
|
+
lineNumber: 208,
|
|
273
287
|
columnNumber: 11
|
|
274
288
|
}
|
|
275
289
|
}, _react["default"].createElement(_reactNative.Text, {
|
|
@@ -279,7 +293,7 @@ var GiphyWithContext = function GiphyWithContext(props) {
|
|
|
279
293
|
__self: _this,
|
|
280
294
|
__source: {
|
|
281
295
|
fileName: _jsxFileName,
|
|
282
|
-
lineNumber:
|
|
296
|
+
lineNumber: 220,
|
|
283
297
|
columnNumber: 13
|
|
284
298
|
}
|
|
285
299
|
}, actions == null ? void 0 : actions[1].text)), _react["default"].createElement(_reactNative.TouchableOpacity, {
|
|
@@ -294,7 +308,7 @@ var GiphyWithContext = function GiphyWithContext(props) {
|
|
|
294
308
|
__self: _this,
|
|
295
309
|
__source: {
|
|
296
310
|
fileName: _jsxFileName,
|
|
297
|
-
lineNumber:
|
|
311
|
+
lineNumber: 222,
|
|
298
312
|
columnNumber: 11
|
|
299
313
|
}
|
|
300
314
|
}, _react["default"].createElement(_reactNative.Text, {
|
|
@@ -304,7 +318,7 @@ var GiphyWithContext = function GiphyWithContext(props) {
|
|
|
304
318
|
__self: _this,
|
|
305
319
|
__source: {
|
|
306
320
|
fileName: _jsxFileName,
|
|
307
|
-
lineNumber:
|
|
321
|
+
lineNumber: 230,
|
|
308
322
|
columnNumber: 13
|
|
309
323
|
}
|
|
310
324
|
}, actions == null ? void 0 : actions[0].text))))) : _react["default"].createElement(_reactNative.TouchableOpacity, (0, _extends2["default"])({
|
|
@@ -333,32 +347,33 @@ var GiphyWithContext = function GiphyWithContext(props) {
|
|
|
333
347
|
});
|
|
334
348
|
}
|
|
335
349
|
},
|
|
336
|
-
style: [styles.container, container],
|
|
337
350
|
testID: "giphy-attachment"
|
|
338
351
|
}, additionalTouchableProps, {
|
|
339
352
|
__self: _this,
|
|
340
353
|
__source: {
|
|
341
354
|
fileName: _jsxFileName,
|
|
342
|
-
lineNumber:
|
|
355
|
+
lineNumber: 236,
|
|
343
356
|
columnNumber: 5
|
|
344
357
|
}
|
|
345
358
|
}), _react["default"].createElement(_reactNative.View, {
|
|
359
|
+
style: [styles.container, container],
|
|
346
360
|
__self: _this,
|
|
347
361
|
__source: {
|
|
348
362
|
fileName: _jsxFileName,
|
|
349
|
-
lineNumber:
|
|
363
|
+
lineNumber: 265,
|
|
350
364
|
columnNumber: 7
|
|
351
365
|
}
|
|
352
366
|
}, _react["default"].createElement(_reactNative.Image, {
|
|
353
|
-
resizeMode: "
|
|
367
|
+
resizeMode: "contain",
|
|
354
368
|
source: {
|
|
355
369
|
uri: (0, _utils.makeImageCompatibleUrl)(uri)
|
|
356
370
|
},
|
|
357
|
-
style: [styles.giphy, giphy],
|
|
371
|
+
style: [styles.giphy, giphyDimensions, giphy],
|
|
372
|
+
testID: "giphy-attachment-image",
|
|
358
373
|
__self: _this,
|
|
359
374
|
__source: {
|
|
360
375
|
fileName: _jsxFileName,
|
|
361
|
-
lineNumber:
|
|
376
|
+
lineNumber: 266,
|
|
362
377
|
columnNumber: 9
|
|
363
378
|
}
|
|
364
379
|
}), _react["default"].createElement(_reactNative.View, {
|
|
@@ -366,17 +381,17 @@ var GiphyWithContext = function GiphyWithContext(props) {
|
|
|
366
381
|
__self: _this,
|
|
367
382
|
__source: {
|
|
368
383
|
fileName: _jsxFileName,
|
|
369
|
-
lineNumber:
|
|
384
|
+
lineNumber: 272,
|
|
370
385
|
columnNumber: 9
|
|
371
386
|
}
|
|
372
387
|
}, _react["default"].createElement(_reactNative.View, {
|
|
373
388
|
style: [styles.giphyContainer, {
|
|
374
|
-
backgroundColor:
|
|
389
|
+
backgroundColor: label_bg_transparent
|
|
375
390
|
}, giphyContainer],
|
|
376
391
|
__self: _this,
|
|
377
392
|
__source: {
|
|
378
393
|
fileName: _jsxFileName,
|
|
379
|
-
lineNumber:
|
|
394
|
+
lineNumber: 273,
|
|
380
395
|
columnNumber: 11
|
|
381
396
|
}
|
|
382
397
|
}, _react["default"].createElement(_Lightning.Lightning, {
|
|
@@ -386,7 +401,7 @@ var GiphyWithContext = function GiphyWithContext(props) {
|
|
|
386
401
|
__self: _this,
|
|
387
402
|
__source: {
|
|
388
403
|
fileName: _jsxFileName,
|
|
389
|
-
lineNumber:
|
|
404
|
+
lineNumber: 280,
|
|
390
405
|
columnNumber: 13
|
|
391
406
|
}
|
|
392
407
|
}), _react["default"].createElement(_reactNative.Text, {
|
|
@@ -396,7 +411,7 @@ var GiphyWithContext = function GiphyWithContext(props) {
|
|
|
396
411
|
__self: _this,
|
|
397
412
|
__source: {
|
|
398
413
|
fileName: _jsxFileName,
|
|
399
|
-
lineNumber:
|
|
414
|
+
lineNumber: 281,
|
|
400
415
|
columnNumber: 13
|
|
401
416
|
}
|
|
402
417
|
}, type == null ? void 0 : type.toUpperCase())))));
|
|
@@ -406,15 +421,19 @@ var areEqual = function areEqual(prevProps, nextProps) {
|
|
|
406
421
|
var _prevProps$attachment = prevProps.attachment,
|
|
407
422
|
prevActions = _prevProps$attachment.actions,
|
|
408
423
|
prevImageUrl = _prevProps$attachment.image_url,
|
|
409
|
-
prevThumbUrl = _prevProps$attachment.thumb_url
|
|
424
|
+
prevThumbUrl = _prevProps$attachment.thumb_url,
|
|
425
|
+
prevGiphyVersion = prevProps.giphyVersion;
|
|
410
426
|
var _nextProps$attachment = nextProps.attachment,
|
|
411
427
|
nextActions = _nextProps$attachment.actions,
|
|
412
428
|
nextImageUrl = _nextProps$attachment.image_url,
|
|
413
|
-
nextThumbUrl = _nextProps$attachment.thumb_url
|
|
429
|
+
nextThumbUrl = _nextProps$attachment.thumb_url,
|
|
430
|
+
nextGiphyVersion = nextProps.giphyVersion;
|
|
414
431
|
var imageUrlEqual = prevImageUrl === nextImageUrl;
|
|
415
432
|
if (!imageUrlEqual) return false;
|
|
416
433
|
var thumbUrlEqual = prevThumbUrl === nextThumbUrl;
|
|
417
434
|
if (!thumbUrlEqual) return false;
|
|
435
|
+
var giphyVersionEqual = prevGiphyVersion === nextGiphyVersion;
|
|
436
|
+
if (!giphyVersionEqual) return false;
|
|
418
437
|
var actionsEqual = Array.isArray(prevActions) === Array.isArray(nextActions) && (Array.isArray(prevActions) && Array.isArray(nextActions) && prevActions.length === nextActions.length || prevActions === nextActions);
|
|
419
438
|
if (!actionsEqual) return false;
|
|
420
439
|
return true;
|
|
@@ -431,10 +450,12 @@ var Giphy = function Giphy(props) {
|
|
|
431
450
|
preventPress = _useMessageContext.preventPress;
|
|
432
451
|
|
|
433
452
|
var _useMessagesContext = (0, _MessagesContext.useMessagesContext)(),
|
|
434
|
-
additionalTouchableProps = _useMessagesContext.additionalTouchableProps
|
|
453
|
+
additionalTouchableProps = _useMessagesContext.additionalTouchableProps,
|
|
454
|
+
giphyVersion = _useMessagesContext.giphyVersion;
|
|
435
455
|
|
|
436
456
|
return _react["default"].createElement(MemoizedGiphy, (0, _extends2["default"])({
|
|
437
457
|
additionalTouchableProps: additionalTouchableProps,
|
|
458
|
+
giphyVersion: giphyVersion,
|
|
438
459
|
handleAction: handleAction,
|
|
439
460
|
onLongPress: onLongPress,
|
|
440
461
|
onPress: onPress,
|
|
@@ -444,7 +465,7 @@ var Giphy = function Giphy(props) {
|
|
|
444
465
|
__self: _this,
|
|
445
466
|
__source: {
|
|
446
467
|
fileName: _jsxFileName,
|
|
447
|
-
lineNumber:
|
|
468
|
+
lineNumber: 348,
|
|
448
469
|
columnNumber: 5
|
|
449
470
|
}
|
|
450
471
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Giphy.tsx"],"names":["styles","StyleSheet","create","buttonContainer","alignItems","borderTopWidth","flex","justifyContent","cancel","fontSize","fontWeight","paddingVertical","container","overflow","width","giphy","borderRadius","height","giphyContainer","flexDirection","giphyHeaderText","giphyHeaderTitle","giphyMask","bottom","left","position","giphyMaskText","header","display","padding","margin","row","selectionContainer","borderBottomLeftRadius","borderWidth","send","shuffle","shuffleButton","GiphyWithContext","props","additionalTouchableProps","attachment","handleAction","onLongPress","onPress","onPressIn","preventPress","actions","image_url","thumb_url","title","type","theme","colors","accent_blue","black","grey","grey_dark","grey_gainsboro","white","messageSimple","uri","backgroundColor","borderColor","color","name","value","borderRightWidth","text","event","emitter","toUpperCase","areEqual","prevProps","nextProps","prevActions","prevImageUrl","prevThumbUrl","nextActions","nextImageUrl","nextThumbUrl","imageUrlEqual","thumbUrlEqual","actionsEqual","Array","isArray","length","MemoizedGiphy","React","memo","Giphy","displayName"],"mappings":";;;;;;;;;AAAA;;AACA;;AAIA;;AAIA;;AAIA;;AACA;;AACA;;AAEA;;;;;AAEA,IAAMA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AAoB,OAAO,KAAP;AAEpB,MAAMC,YAAY,GAChBC,KAAK,CAACC,OAAN,CAAcV,WAAd,MAA+BS,KAAK,CAACC,OAAN,CAAcP,WAAd,CAA/B,KACEM,KAAK,CAACC,OAAN,CAAcV,WAAd,KACAS,KAAK,CAACC,OAAN,CAAcP,WAAd,CADA,IAEAH,WAAW,CAACW,MAAZ,KAAuBR,WAAW,CAACQ,MAFpC,IAGCX,WAAW,KAAKG,WAJlB,CADF;AAMA,MAAI,CAACK,YAAL,EAAmB,OAAO,KAAP;AAEnB,SAAO,IAAP;AACD,CA1BD;;AA4BA,IAAMI,aAAa,GAAGC,kBAAMC,IAAN,CAAWnD,gBAAX,EAA6BkC,QAA7B,CAAtB;;AAcO,IAAMkB,KAAK,GAAG,SAARA,KAAQ,CAGnBnD,KAHmB,EAIhB;AACH,2BACE,wCADF;AAAA,MAAQG,YAAR,sBAAQA,YAAR;AAAA,MAAsBC,WAAtB,sBAAsBA,WAAtB;AAAA,MAAmCC,OAAnC,sBAAmCA,OAAnC;AAAA,MAA4CC,SAA5C,sBAA4CA,SAA5C;AAAA,MAAuDC,YAAvD,sBAAuDA,YAAvD;;AAEA,4BAAqC,0CAArC;AAAA,MAAQN,wBAAR,uBAAQA,wBAAR;;AAEA,SACE,gCAAC,aAAD;AAEIA,IAAAA,wBAAwB,EAAxBA,wBAFJ;AAGIE,IAAAA,YAAY,EAAZA,YAHJ;AAIIC,IAAAA,WAAW,EAAXA,WAJJ;AAKIC,IAAAA,OAAO,EAAPA,OALJ;AAMIC,IAAAA,SAAS,EAATA,SANJ;AAOIC,IAAAA,YAAY,EAAZA;AAPJ,KASMP,KATN;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KADF;AAaD,CAtBM;;;AAwBPmD,KAAK,CAACC,WAAN,GAAoB,6BAApB","sourcesContent":["import React from 'react';\nimport { Image, StyleSheet, Text, TouchableOpacity, View } from 'react-native';\n\nimport type { Attachment } from 'stream-chat';\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 { GiphyIcon } from '../../icons';\nimport { Lightning } from '../../icons/Lightning';\nimport type { DefaultStreamChatGenerics } from '../../types/types';\nimport { makeImageCompatibleUrl } from '../../utils/utils';\n\nconst styles = StyleSheet.create({\n buttonContainer: { alignItems: 'center', borderTopWidth: 1, flex: 1, justifyContent: 'center' },\n cancel: {\n fontSize: 14,\n fontWeight: '600',\n paddingVertical: 16,\n },\n container: {\n overflow: 'hidden',\n width: 270,\n },\n giphy: {\n borderRadius: 2,\n height: 170,\n width: 270,\n },\n giphyContainer: {\n alignItems: 'center',\n borderRadius: 12,\n flexDirection: 'row',\n height: 24,\n justifyContent: 'center',\n width: 68,\n },\n giphyHeaderText: {\n fontSize: 16,\n fontWeight: '600',\n },\n giphyHeaderTitle: {\n fontSize: 14,\n },\n giphyMask: {\n bottom: 8,\n left: 8,\n position: 'absolute',\n },\n giphyMaskText: { fontSize: 13, fontWeight: '600' },\n header: {\n alignItems: 'center',\n display: 'flex',\n flexDirection: 'row',\n justifyContent: 'space-between',\n padding: 8,\n width: '60%',\n },\n margin: {\n margin: 1,\n },\n row: { flexDirection: 'row' },\n selectionContainer: {\n borderBottomLeftRadius: 8,\n borderWidth: 1,\n overflow: 'hidden',\n width: 272,\n },\n send: {\n fontSize: 14,\n fontWeight: '600',\n paddingVertical: 16,\n },\n shuffle: {\n fontSize: 14,\n fontWeight: '600',\n paddingVertical: 16,\n },\n shuffleButton: {\n alignItems: 'center',\n borderRadius: 16,\n borderWidth: 1,\n height: 32,\n justifyContent: 'center',\n width: 32,\n },\n});\n\nexport type GiphyPropsWithContext<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = Pick<\n MessageContextValue<StreamChatGenerics>,\n 'handleAction' | 'onLongPress' | 'onPress' | 'onPressIn' | 'preventPress'\n> &\n Pick<MessagesContextValue<StreamChatGenerics>, 'additionalTouchableProps'> & {\n attachment: Attachment<StreamChatGenerics>;\n };\n\nconst GiphyWithContext = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n props: GiphyPropsWithContext<StreamChatGenerics>,\n) => {\n const {\n additionalTouchableProps,\n attachment,\n handleAction,\n onLongPress,\n onPress,\n onPressIn,\n preventPress,\n } = props;\n\n const { actions, image_url, thumb_url, title, type } = attachment;\n\n const {\n theme: {\n colors: { accent_blue, black, grey, grey_dark, grey_gainsboro, white },\n messageSimple: {\n giphy: {\n buttonContainer,\n cancel,\n container,\n giphy,\n giphyContainer,\n giphyHeaderText,\n giphyHeaderTitle,\n giphyMask,\n giphyMaskText,\n header,\n selectionContainer,\n send,\n shuffle,\n },\n },\n },\n } = useTheme();\n\n const uri = image_url || thumb_url;\n\n if (!uri) return null;\n\n return actions ? (\n <View\n style={[\n styles.selectionContainer,\n { backgroundColor: white, borderColor: `${black}0D` },\n selectionContainer,\n ]}\n >\n <View style={[styles.header, header]}>\n <GiphyIcon />\n <Text style={[styles.giphyHeaderText, giphyHeaderText]}>Giphy</Text>\n <Text\n style={[styles.giphyHeaderTitle, giphyHeaderTitle, { color: grey_dark }]}\n >{`/giphy ${title}`}</Text>\n </View>\n <View style={styles.margin}>\n <Image\n resizeMode='cover'\n source={{ uri: makeImageCompatibleUrl(uri) }}\n style={[styles.giphy, giphy]}\n />\n </View>\n <View>\n <View style={styles.row}>\n <TouchableOpacity\n onPress={() => {\n if (actions?.[2].name && actions?.[2].value && handleAction) {\n handleAction(actions[2].name, actions[2].value);\n }\n }}\n style={[\n styles.buttonContainer,\n { borderColor: grey_gainsboro, borderRightWidth: 1 },\n buttonContainer,\n ]}\n >\n <Text style={[styles.cancel, { color: grey }, cancel]}>{actions?.[2].text}</Text>\n </TouchableOpacity>\n <TouchableOpacity\n onPress={() => {\n if (actions?.[1].name && actions?.[1].value && handleAction) {\n handleAction(actions[1].name, actions[1].value);\n }\n }}\n style={[\n styles.buttonContainer,\n { borderColor: grey_gainsboro, borderRightWidth: 1 },\n buttonContainer,\n ]}\n >\n <Text style={[styles.shuffle, { color: grey }, shuffle]}>{actions?.[1].text}</Text>\n </TouchableOpacity>\n <TouchableOpacity\n onPress={() => {\n if (actions?.[0].name && actions?.[0].value && handleAction) {\n handleAction(actions[0].name, actions[0].value);\n }\n }}\n style={[styles.buttonContainer, { borderColor: grey_gainsboro }, buttonContainer]}\n >\n <Text style={[styles.send, { color: accent_blue }, send]}>{actions?.[0].text}</Text>\n </TouchableOpacity>\n </View>\n </View>\n </View>\n ) : (\n <TouchableOpacity\n disabled={preventPress}\n onLongPress={(event) => {\n if (onLongPress) {\n onLongPress({\n emitter: 'giphy',\n event,\n });\n }\n }}\n onPress={(event) => {\n if (onPress) {\n onPress({\n emitter: 'giphy',\n event,\n });\n }\n }}\n onPressIn={(event) => {\n if (onPressIn) {\n onPressIn({\n emitter: 'giphy',\n event,\n });\n }\n }}\n style={[styles.container, container]}\n testID='giphy-attachment'\n {...additionalTouchableProps}\n >\n <View>\n <Image\n resizeMode='cover'\n source={{ uri: makeImageCompatibleUrl(uri) }}\n style={[styles.giphy, giphy]}\n />\n <View style={[styles.giphyMask, giphyMask]}>\n <View style={[styles.giphyContainer, { backgroundColor: grey_dark }, giphyContainer]}>\n <Lightning height={16} pathFill={white} width={16} />\n <Text style={[styles.giphyMaskText, { color: white }, giphyMaskText]}>\n {type?.toUpperCase()}\n </Text>\n </View>\n </View>\n </View>\n </TouchableOpacity>\n );\n};\n\nconst areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(\n prevProps: GiphyPropsWithContext<StreamChatGenerics>,\n nextProps: GiphyPropsWithContext<StreamChatGenerics>,\n) => {\n const {\n attachment: { actions: prevActions, image_url: prevImageUrl, thumb_url: prevThumbUrl },\n } = prevProps;\n const {\n attachment: { actions: nextActions, image_url: nextImageUrl, thumb_url: nextThumbUrl },\n } = nextProps;\n\n const imageUrlEqual = prevImageUrl === nextImageUrl;\n if (!imageUrlEqual) return false;\n\n const thumbUrlEqual = prevThumbUrl === nextThumbUrl;\n if (!thumbUrlEqual) return false;\n\n const actionsEqual =\n Array.isArray(prevActions) === Array.isArray(nextActions) &&\n ((Array.isArray(prevActions) &&\n Array.isArray(nextActions) &&\n prevActions.length === nextActions.length) ||\n prevActions === nextActions);\n if (!actionsEqual) return false;\n\n return true;\n};\n\nconst MemoizedGiphy = React.memo(GiphyWithContext, areEqual) as typeof GiphyWithContext;\n\nexport type GiphyProps<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = Partial<\n Pick<MessageContextValue<StreamChatGenerics>, 'onLongPress' | 'onPressIn'> &\n Pick<MessagesContextValue<StreamChatGenerics>, 'additionalTouchableProps'>\n> & {\n attachment: Attachment<StreamChatGenerics>;\n};\n\n/**\n * UI component for card in attachments.\n */\nexport const Giphy = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n props: GiphyProps<StreamChatGenerics>,\n) => {\n const { handleAction, onLongPress, onPress, onPressIn, preventPress } =\n useMessageContext<StreamChatGenerics>();\n const { additionalTouchableProps } = useMessagesContext<StreamChatGenerics>();\n\n return (\n <MemoizedGiphy\n {...{\n additionalTouchableProps,\n handleAction,\n onLongPress,\n onPress,\n onPressIn,\n preventPress,\n }}\n {...props}\n />\n );\n};\n\nGiphy.displayName = 'Giphy{messageSimple{giphy}}';\n"]}
|
|
1
|
+
{"version":3,"sources":["Giphy.tsx"],"names":["styles","StyleSheet","create","actionsRow","flexDirection","buttonContainer","alignItems","borderTopWidth","flex","justifyContent","cancel","fontSize","fontWeight","paddingVertical","container","overflow","width","giphy","alignSelf","borderRadius","height","maxWidth","giphyContainer","giphyHeaderText","giphyHeaderTitle","giphyMask","bottom","left","position","giphyMaskText","header","display","padding","selectionContainer","borderBottomLeftRadius","borderWidth","selectionImageContainer","margin","send","shuffle","shuffleButton","GiphyWithContext","props","additionalTouchableProps","attachment","handleAction","onLongPress","onPress","onPressIn","preventPress","actions","giphyData","image_url","thumb_url","title","type","theme","colors","accent_blue","black","grey","grey_dark","grey_gainsboro","label_bg_transparent","white","messageSimple","uri","giphyDimensions","giphyVersionInfo","giphyVersion","url","parseFloat","backgroundColor","borderColor","color","name","value","borderRightWidth","text","event","emitter","toUpperCase","areEqual","prevProps","nextProps","prevActions","prevImageUrl","prevThumbUrl","prevGiphyVersion","nextActions","nextImageUrl","nextThumbUrl","nextGiphyVersion","imageUrlEqual","thumbUrlEqual","giphyVersionEqual","actionsEqual","Array","isArray","length","MemoizedGiphy","React","memo","Giphy","displayName"],"mappings":";;;;;;;;;AAAA;;AACA;;AAIA;;AAIA;;AAIA;;AACA;;AACA;;AAEA;;;;;AAEA,IAAMA,MAAM,GAAGC,wBAAWC,MAAX,CAAkB;AAC/BC,EAAAA,UAAU,EAAE;AACVC,IAAAA,aAAa,EAAE;AADL,GADmB;AAI/BC,EAAAA,eAAe,EAAE;AACfC,IAAAA,UAAU,EAAE,QADG;AAEfC,IAAAA,cAAc,EAAE,CAFD;AAGfC,IAAAA,IAAI,EAAE,CAHS;AAIfC,IAAAA,cAAc,EAAE;AAJD,GAJc;AAU/BC,EAAAA,MAAM,EAAE;AACNC,IAAAA,QAAQ,EAAE,EADJ;AAENC,IAAAA,UAAU,EAAE,KAFN;AAGNC,IAAAA,eAAe,EAAE;AAHX,GAVuB;AAe/BC,EAAAA,SAAS,EAAE;AACTC,IAAAA,QAAQ,EAAE,QADD;AAETC,IAAAA,KAAK,EAAE;AAFE,GAfoB;AAmB/BC,EAAAA,KAAK,EAAE;AACLC,IAAAA,SAAS,EAAE,QADN;AAELC,IAAAA,YAAY,EAAE,CAFT;AAGLC,IAAAA,MAAM,EAAE,GAHH;AAILC,IAAAA,QAAQ,EAAE,GAJL;AAKLL,IAAAA,KAAK,EAAE;AALF,GAnBwB;AA0B/BM,EAAAA,c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AA;AAAA;AAAA;AAAA;AAAA;AAAA,KADF;AAcD,CAvBM;;;AAyBP6D,KAAK,CAACC,WAAN,GAAoB,6BAApB","sourcesContent":["import React from 'react';\nimport { Image, StyleSheet, Text, TouchableOpacity, View } from 'react-native';\n\nimport type { Attachment } from 'stream-chat';\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 { GiphyIcon } from '../../icons';\nimport { Lightning } from '../../icons/Lightning';\nimport type { DefaultStreamChatGenerics } from '../../types/types';\nimport { makeImageCompatibleUrl } from '../../utils/utils';\n\nconst styles = StyleSheet.create({\n actionsRow: {\n flexDirection: 'row',\n },\n buttonContainer: {\n alignItems: 'center',\n borderTopWidth: 1,\n flex: 1,\n justifyContent: 'center',\n },\n cancel: {\n fontSize: 14,\n fontWeight: '600',\n paddingVertical: 16,\n },\n container: {\n overflow: 'hidden',\n width: 270,\n },\n giphy: {\n alignSelf: 'center',\n borderRadius: 2,\n height: 170,\n maxWidth: 270,\n width: 270,\n },\n giphyContainer: {\n alignItems: 'center',\n borderRadius: 12,\n flexDirection: 'row',\n height: 24,\n justifyContent: 'center',\n width: 68,\n },\n giphyHeaderText: {\n fontSize: 16,\n fontWeight: '600',\n },\n giphyHeaderTitle: {\n fontSize: 14,\n },\n giphyMask: {\n bottom: 8,\n left: 8,\n position: 'absolute',\n },\n giphyMaskText: {\n fontSize: 13,\n fontWeight: '600',\n },\n header: {\n alignItems: 'center',\n display: 'flex',\n flexDirection: 'row',\n justifyContent: 'space-between',\n padding: 8,\n width: '60%',\n },\n selectionContainer: {\n borderBottomLeftRadius: 8,\n borderWidth: 1,\n overflow: 'hidden',\n width: 272,\n },\n selectionImageContainer: {\n alignSelf: 'center',\n margin: 1,\n },\n send: {\n fontSize: 14,\n fontWeight: '600',\n paddingVertical: 16,\n },\n shuffle: {\n fontSize: 14,\n fontWeight: '600',\n paddingVertical: 16,\n },\n shuffleButton: {\n alignItems: 'center',\n borderRadius: 16,\n borderWidth: 1,\n height: 32,\n justifyContent: 'center',\n width: 32,\n },\n});\n\nexport type GiphyPropsWithContext<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = Pick<\n MessageContextValue<StreamChatGenerics>,\n 'handleAction' | 'onLongPress' | 'onPress' | 'onPressIn' | 'preventPress'\n> &\n Pick<MessagesContextValue<StreamChatGenerics>, 'giphyVersion' | 'additionalTouchableProps'> & {\n attachment: Attachment<StreamChatGenerics>;\n };\n\nconst GiphyWithContext = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n props: GiphyPropsWithContext<StreamChatGenerics>,\n) => {\n const {\n additionalTouchableProps,\n attachment,\n handleAction,\n onLongPress,\n onPress,\n onPressIn,\n preventPress,\n } = props;\n\n const { actions, giphy: giphyData, image_url, thumb_url, title, type } = attachment;\n\n const {\n theme: {\n colors: { accent_blue, black, grey, grey_dark, grey_gainsboro, label_bg_transparent, white },\n messageSimple: {\n giphy: {\n buttonContainer,\n cancel,\n container,\n giphy,\n giphyContainer,\n giphyHeaderText,\n giphyHeaderTitle,\n giphyMask,\n giphyMaskText,\n header,\n selectionContainer,\n send,\n shuffle,\n },\n },\n },\n } = useTheme();\n\n let uri = image_url || thumb_url;\n const giphyDimensions: { height?: number; width?: number } = {};\n\n if (type === 'giphy' && giphyData) {\n const giphyVersionInfo = giphyData[props.giphyVersion];\n uri = giphyVersionInfo.url;\n giphyDimensions.height = parseFloat(giphyVersionInfo.height);\n giphyDimensions.width = parseFloat(giphyVersionInfo.width);\n }\n\n if (!uri) return null;\n\n return actions ? (\n <View\n style={[\n styles.selectionContainer,\n { backgroundColor: white, borderColor: `${black}0D` },\n selectionContainer,\n ]}\n >\n <View style={[styles.header, header]}>\n <GiphyIcon />\n <Text style={[styles.giphyHeaderText, giphyHeaderText]}>Giphy</Text>\n <Text\n style={[styles.giphyHeaderTitle, giphyHeaderTitle, { color: grey_dark }]}\n >{`/giphy ${title}`}</Text>\n </View>\n <View style={styles.selectionImageContainer}>\n <Image\n resizeMode='contain'\n source={{ uri: makeImageCompatibleUrl(uri) }}\n style={[styles.giphy, giphyDimensions, giphy]}\n />\n </View>\n <View>\n <View style={styles.actionsRow}>\n <TouchableOpacity\n onPress={() => {\n if (actions?.[2].name && actions?.[2].value && handleAction) {\n handleAction(actions[2].name, actions[2].value);\n }\n }}\n style={[\n styles.buttonContainer,\n { borderColor: grey_gainsboro, borderRightWidth: 1 },\n buttonContainer,\n ]}\n >\n <Text style={[styles.cancel, { color: grey }, cancel]}>{actions?.[2].text}</Text>\n </TouchableOpacity>\n <TouchableOpacity\n onPress={() => {\n if (actions?.[1].name && actions?.[1].value && handleAction) {\n handleAction(actions[1].name, actions[1].value);\n }\n }}\n style={[\n styles.buttonContainer,\n { borderColor: grey_gainsboro, borderRightWidth: 1 },\n buttonContainer,\n ]}\n >\n <Text style={[styles.shuffle, { color: grey }, shuffle]}>{actions?.[1].text}</Text>\n </TouchableOpacity>\n <TouchableOpacity\n onPress={() => {\n if (actions?.[0].name && actions?.[0].value && handleAction) {\n handleAction(actions[0].name, actions[0].value);\n }\n }}\n style={[styles.buttonContainer, { borderColor: grey_gainsboro }, buttonContainer]}\n >\n <Text style={[styles.send, { color: accent_blue }, send]}>{actions?.[0].text}</Text>\n </TouchableOpacity>\n </View>\n </View>\n </View>\n ) : (\n <TouchableOpacity\n disabled={preventPress}\n onLongPress={(event) => {\n if (onLongPress) {\n onLongPress({\n emitter: 'giphy',\n event,\n });\n }\n }}\n onPress={(event) => {\n if (onPress) {\n onPress({\n emitter: 'giphy',\n event,\n });\n }\n }}\n onPressIn={(event) => {\n if (onPressIn) {\n onPressIn({\n emitter: 'giphy',\n event,\n });\n }\n }}\n testID='giphy-attachment'\n {...additionalTouchableProps}\n >\n <View style={[styles.container, container]}>\n <Image\n resizeMode='contain'\n source={{ uri: makeImageCompatibleUrl(uri) }}\n style={[styles.giphy, giphyDimensions, giphy]}\n testID='giphy-attachment-image'\n />\n <View style={[styles.giphyMask, giphyMask]}>\n <View\n style={[\n styles.giphyContainer,\n { backgroundColor: label_bg_transparent },\n giphyContainer,\n ]}\n >\n <Lightning height={16} pathFill={white} width={16} />\n <Text style={[styles.giphyMaskText, { color: white }, giphyMaskText]}>\n {type?.toUpperCase()}\n </Text>\n </View>\n </View>\n </View>\n </TouchableOpacity>\n );\n};\n\nconst areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(\n prevProps: GiphyPropsWithContext<StreamChatGenerics>,\n nextProps: GiphyPropsWithContext<StreamChatGenerics>,\n) => {\n const {\n attachment: { actions: prevActions, image_url: prevImageUrl, thumb_url: prevThumbUrl },\n giphyVersion: prevGiphyVersion,\n } = prevProps;\n const {\n attachment: { actions: nextActions, image_url: nextImageUrl, thumb_url: nextThumbUrl },\n giphyVersion: nextGiphyVersion,\n } = nextProps;\n\n const imageUrlEqual = prevImageUrl === nextImageUrl;\n if (!imageUrlEqual) return false;\n\n const thumbUrlEqual = prevThumbUrl === nextThumbUrl;\n if (!thumbUrlEqual) return false;\n\n const giphyVersionEqual = prevGiphyVersion === nextGiphyVersion;\n if (!giphyVersionEqual) return false;\n\n const actionsEqual =\n Array.isArray(prevActions) === Array.isArray(nextActions) &&\n ((Array.isArray(prevActions) &&\n Array.isArray(nextActions) &&\n prevActions.length === nextActions.length) ||\n prevActions === nextActions);\n if (!actionsEqual) return false;\n\n return true;\n};\n\nconst MemoizedGiphy = React.memo(GiphyWithContext, areEqual) as typeof GiphyWithContext;\n\nexport type GiphyProps<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = Partial<\n Pick<MessageContextValue<StreamChatGenerics>, 'isMyMessage' | 'onLongPress' | 'onPressIn'> &\n Pick<MessagesContextValue<StreamChatGenerics>, 'giphyVersion' | 'additionalTouchableProps'>\n> & {\n attachment: Attachment<StreamChatGenerics>;\n};\n\n/**\n * UI component for card in attachments.\n */\nexport const Giphy = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n props: GiphyProps<StreamChatGenerics>,\n) => {\n const { handleAction, onLongPress, onPress, onPressIn, preventPress } =\n useMessageContext<StreamChatGenerics>();\n const { additionalTouchableProps, giphyVersion } = useMessagesContext<StreamChatGenerics>();\n\n return (\n <MemoizedGiphy\n {...{\n additionalTouchableProps,\n giphyVersion,\n handleAction,\n onLongPress,\n onPress,\n onPressIn,\n preventPress,\n }}\n {...props}\n />\n );\n};\n\nGiphy.displayName = 'Giphy{messageSimple{giphy}}';\n"]}
|