stream-chat-react-native-core 4.3.0-beta.4 → 4.3.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/components/Attachment/Attachment.js +21 -12
- package/lib/commonjs/components/Attachment/Attachment.js.map +1 -1
- package/lib/commonjs/components/Channel/Channel.js +15 -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/Message.js +11 -8
- package/lib/commonjs/components/Message/Message.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageContent.js +28 -23
- package/lib/commonjs/components/Message/MessageSimple/MessageContent.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageSimple.js +7 -6
- package/lib/commonjs/components/Message/MessageSimple/MessageSimple.js.map +1 -1
- package/lib/commonjs/contexts/messagesContext/MessagesContext.js +2 -2
- package/lib/commonjs/contexts/messagesContext/MessagesContext.js.map +1 -1
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/Attachment/Attachment.js +21 -12
- package/lib/module/components/Attachment/Attachment.js.map +1 -1
- package/lib/module/components/Channel/Channel.js +15 -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/Message.js +11 -8
- package/lib/module/components/Message/Message.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/MessageContent.js +28 -23
- package/lib/module/components/Message/MessageSimple/MessageContent.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/MessageSimple.js +7 -6
- package/lib/module/components/Message/MessageSimple/MessageSimple.js.map +1 -1
- package/lib/module/contexts/messagesContext/MessagesContext.js +2 -2
- package/lib/module/contexts/messagesContext/MessagesContext.js.map +1 -1
- package/lib/module/version.json +1 -1
- package/lib/typescript/components/Attachment/Attachment.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/components/Message/Message.d.ts +1 -1
- package/lib/typescript/components/Message/MessageSimple/MessageContent.d.ts +1 -1
- package/lib/typescript/contexts/messagesContext/MessagesContext.d.ts +2 -0
- package/package.json +1 -1
- package/src/components/Attachment/Attachment.tsx +11 -2
- package/src/components/Channel/Channel.tsx +3 -0
- package/src/components/Channel/__tests__/isAttachmentEqualHandler.test.js +100 -0
- package/src/components/Channel/hooks/useCreateMessagesContext.ts +2 -0
- package/src/components/Message/Message.tsx +19 -8
- package/src/components/Message/MessageSimple/MessageContent.tsx +23 -14
- package/src/components/Message/MessageSimple/MessageSimple.tsx +14 -11
- package/src/contexts/messagesContext/MessagesContext.tsx +5 -0
- package/src/version.json +1 -1
|
@@ -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","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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,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;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"]}
|
|
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;AAAA;AAAA;AAAA,OAAP;AACD;;AAED,MAAIA,UAAU,CAACW,IAAX,KAAoB,OAAxB,EAAiC;AAC/B,WAC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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"]}
|
|
@@ -343,6 +343,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
|
|
|
343
343
|
InputGiphySearch = _props$InputGiphySear === void 0 ? _InputGiphySearch.InputGiphySearch : _props$InputGiphySear,
|
|
344
344
|
_props$InputReplyStat = props.InputReplyStateHeader,
|
|
345
345
|
InputReplyStateHeader = _props$InputReplyStat === void 0 ? _InputReplyStateHeader.InputReplyStateHeader : _props$InputReplyStat,
|
|
346
|
+
isAttachmentEqual = props.isAttachmentEqual,
|
|
346
347
|
keyboardBehavior = props.keyboardBehavior,
|
|
347
348
|
_props$KeyboardCompat = props.KeyboardCompatibleView,
|
|
348
349
|
KeyboardCompatibleView = _props$KeyboardCompat === void 0 ? _KeyboardCompatibleView.KeyboardCompatibleView : _props$KeyboardCompat,
|
|
@@ -1976,6 +1977,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
|
|
|
1976
1977
|
initialScrollToFirstUnreadMessage: initialScrollToFirstUnreadMessage,
|
|
1977
1978
|
InlineDateSeparator: InlineDateSeparator,
|
|
1978
1979
|
InlineUnreadIndicator: InlineUnreadIndicator,
|
|
1980
|
+
isAttachmentEqual: isAttachmentEqual,
|
|
1979
1981
|
legacyImageViewerSwipeBehaviour: legacyImageViewerSwipeBehaviour,
|
|
1980
1982
|
markdownRules: markdownRules,
|
|
1981
1983
|
Message: Message,
|
|
@@ -2044,7 +2046,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
|
|
|
2044
2046
|
__self: _this,
|
|
2045
2047
|
__source: {
|
|
2046
2048
|
fileName: _jsxFileName,
|
|
2047
|
-
lineNumber:
|
|
2049
|
+
lineNumber: 1770,
|
|
2048
2050
|
columnNumber: 12
|
|
2049
2051
|
}
|
|
2050
2052
|
});
|
|
@@ -2059,7 +2061,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
|
|
|
2059
2061
|
__self: _this,
|
|
2060
2062
|
__source: {
|
|
2061
2063
|
fileName: _jsxFileName,
|
|
2062
|
-
lineNumber:
|
|
2064
|
+
lineNumber: 1775,
|
|
2063
2065
|
columnNumber: 7
|
|
2064
2066
|
}
|
|
2065
2067
|
}, t('Please select a channel first'));
|
|
@@ -2073,7 +2075,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
|
|
|
2073
2075
|
__self: _this,
|
|
2074
2076
|
__source: {
|
|
2075
2077
|
fileName: _jsxFileName,
|
|
2076
|
-
lineNumber:
|
|
2078
|
+
lineNumber: 1782,
|
|
2077
2079
|
columnNumber: 5
|
|
2078
2080
|
}
|
|
2079
2081
|
}), _react["default"].createElement(_ChannelContext.ChannelProvider, {
|
|
@@ -2081,7 +2083,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
|
|
|
2081
2083
|
__self: _this,
|
|
2082
2084
|
__source: {
|
|
2083
2085
|
fileName: _jsxFileName,
|
|
2084
|
-
lineNumber:
|
|
2086
|
+
lineNumber: 1788,
|
|
2085
2087
|
columnNumber: 7
|
|
2086
2088
|
}
|
|
2087
2089
|
}, _react["default"].createElement(_OwnCapabilitiesContext.OwnCapabilitiesProvider, {
|
|
@@ -2089,7 +2091,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
|
|
|
2089
2091
|
__self: _this,
|
|
2090
2092
|
__source: {
|
|
2091
2093
|
fileName: _jsxFileName,
|
|
2092
|
-
lineNumber:
|
|
2094
|
+
lineNumber: 1789,
|
|
2093
2095
|
columnNumber: 9
|
|
2094
2096
|
}
|
|
2095
2097
|
}, _react["default"].createElement(_TypingContext.TypingProvider, {
|
|
@@ -2097,7 +2099,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
|
|
|
2097
2099
|
__self: _this,
|
|
2098
2100
|
__source: {
|
|
2099
2101
|
fileName: _jsxFileName,
|
|
2100
|
-
lineNumber:
|
|
2102
|
+
lineNumber: 1790,
|
|
2101
2103
|
columnNumber: 11
|
|
2102
2104
|
}
|
|
2103
2105
|
}, _react["default"].createElement(_PaginatedMessageListContext.PaginatedMessageListProvider, {
|
|
@@ -2105,7 +2107,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
|
|
|
2105
2107
|
__self: _this,
|
|
2106
2108
|
__source: {
|
|
2107
2109
|
fileName: _jsxFileName,
|
|
2108
|
-
lineNumber:
|
|
2110
|
+
lineNumber: 1791,
|
|
2109
2111
|
columnNumber: 13
|
|
2110
2112
|
}
|
|
2111
2113
|
}, _react["default"].createElement(_MessagesContext.MessagesProvider, {
|
|
@@ -2113,7 +2115,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
|
|
|
2113
2115
|
__self: _this,
|
|
2114
2116
|
__source: {
|
|
2115
2117
|
fileName: _jsxFileName,
|
|
2116
|
-
lineNumber:
|
|
2118
|
+
lineNumber: 1792,
|
|
2117
2119
|
columnNumber: 15
|
|
2118
2120
|
}
|
|
2119
2121
|
}, _react["default"].createElement(_ThreadContext.ThreadProvider, {
|
|
@@ -2121,7 +2123,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
|
|
|
2121
2123
|
__self: _this,
|
|
2122
2124
|
__source: {
|
|
2123
2125
|
fileName: _jsxFileName,
|
|
2124
|
-
lineNumber:
|
|
2126
|
+
lineNumber: 1793,
|
|
2125
2127
|
columnNumber: 17
|
|
2126
2128
|
}
|
|
2127
2129
|
}, _react["default"].createElement(_SuggestionsContext.SuggestionsProvider, {
|
|
@@ -2129,7 +2131,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
|
|
|
2129
2131
|
__self: _this,
|
|
2130
2132
|
__source: {
|
|
2131
2133
|
fileName: _jsxFileName,
|
|
2132
|
-
lineNumber:
|
|
2134
|
+
lineNumber: 1794,
|
|
2133
2135
|
columnNumber: 19
|
|
2134
2136
|
}
|
|
2135
2137
|
}, _react["default"].createElement(_MessageInputContext.MessageInputProvider, {
|
|
@@ -2137,7 +2139,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
|
|
|
2137
2139
|
__self: _this,
|
|
2138
2140
|
__source: {
|
|
2139
2141
|
fileName: _jsxFileName,
|
|
2140
|
-
lineNumber:
|
|
2142
|
+
lineNumber: 1795,
|
|
2141
2143
|
columnNumber: 21
|
|
2142
2144
|
}
|
|
2143
2145
|
}, _react["default"].createElement(_reactNative.View, {
|
|
@@ -2147,7 +2149,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
|
|
|
2147
2149
|
__self: _this,
|
|
2148
2150
|
__source: {
|
|
2149
2151
|
fileName: _jsxFileName,
|
|
2150
|
-
lineNumber:
|
|
2152
|
+
lineNumber: 1796,
|
|
2151
2153
|
columnNumber: 23
|
|
2152
2154
|
}
|
|
2153
2155
|
}, children))))))))));
|
|
@@ -2202,7 +2204,7 @@ var Channel = function Channel(props) {
|
|
|
2202
2204
|
__self: _this,
|
|
2203
2205
|
__source: {
|
|
2204
2206
|
fileName: _jsxFileName,
|
|
2205
|
-
lineNumber:
|
|
2207
|
+
lineNumber: 1853,
|
|
2206
2208
|
columnNumber: 5
|
|
2207
2209
|
}
|
|
2208
2210
|
}));
|