stream-chat-react-native-core 4.7.0 → 4.7.1-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/Card.js +61 -21
- package/lib/commonjs/components/Attachment/Card.js.map +1 -1
- package/lib/commonjs/components/AutoCompleteInput/AutoCompleteSuggestionList.js +1 -1
- package/lib/commonjs/components/AutoCompleteInput/AutoCompleteSuggestionList.js.map +1 -1
- package/lib/commonjs/components/MessageInput/SendMessageDisallowedIndicator.js +2 -2
- package/lib/commonjs/components/MessageInput/SendMessageDisallowedIndicator.js.map +1 -1
- package/lib/commonjs/components/Reply/Reply.js +12 -12
- package/lib/commonjs/components/Reply/Reply.js.map +1 -1
- package/lib/commonjs/contexts/activeChannelsRefContext/ActiveChannelsRefContext.js +2 -2
- package/lib/commonjs/contexts/activeChannelsRefContext/ActiveChannelsRefContext.js.map +1 -1
- package/lib/commonjs/contexts/attachmentPickerContext/AttachmentPickerContext.js +14 -4
- package/lib/commonjs/contexts/attachmentPickerContext/AttachmentPickerContext.js.map +1 -1
- package/lib/commonjs/contexts/channelContext/ChannelContext.js +14 -4
- package/lib/commonjs/contexts/channelContext/ChannelContext.js.map +1 -1
- package/lib/commonjs/contexts/channelsContext/ChannelsContext.js +14 -4
- package/lib/commonjs/contexts/channelsContext/ChannelsContext.js.map +1 -1
- package/lib/commonjs/contexts/channelsStateContext/ChannelsStateContext.js +15 -9
- package/lib/commonjs/contexts/channelsStateContext/ChannelsStateContext.js.map +1 -1
- package/lib/commonjs/contexts/chatContext/ChatContext.js +14 -4
- package/lib/commonjs/contexts/chatContext/ChatContext.js.map +1 -1
- package/lib/commonjs/contexts/imageGalleryContext/ImageGalleryContext.js +14 -4
- package/lib/commonjs/contexts/imageGalleryContext/ImageGalleryContext.js.map +1 -1
- package/lib/commonjs/contexts/keyboardContext/KeyboardContext.js +2 -2
- package/lib/commonjs/contexts/keyboardContext/KeyboardContext.js.map +1 -1
- package/lib/commonjs/contexts/messageContext/MessageContext.js +14 -4
- package/lib/commonjs/contexts/messageContext/MessageContext.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js +14 -4
- package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/commonjs/contexts/messageOverlayContext/MessageOverlayContext.js +14 -4
- package/lib/commonjs/contexts/messageOverlayContext/MessageOverlayContext.js.map +1 -1
- package/lib/commonjs/contexts/messageOverlayContext/hooks/useResettableState.test.js +4 -4
- package/lib/commonjs/contexts/messageOverlayContext/hooks/useResettableState.test.js.map +1 -1
- package/lib/commonjs/contexts/messagesContext/MessagesContext.js +14 -4
- package/lib/commonjs/contexts/messagesContext/MessagesContext.js.map +1 -1
- package/lib/commonjs/contexts/overlayContext/OverlayContext.js +13 -3
- package/lib/commonjs/contexts/overlayContext/OverlayContext.js.map +1 -1
- package/lib/commonjs/contexts/overlayContext/OverlayProvider.js +12 -12
- package/lib/commonjs/contexts/overlayContext/OverlayProvider.js.map +1 -1
- package/lib/commonjs/contexts/ownCapabilitiesContext/OwnCapabilitiesContext.js +13 -3
- package/lib/commonjs/contexts/ownCapabilitiesContext/OwnCapabilitiesContext.js.map +1 -1
- package/lib/commonjs/contexts/paginatedMessageListContext/PaginatedMessageListContext.js +14 -4
- package/lib/commonjs/contexts/paginatedMessageListContext/PaginatedMessageListContext.js.map +1 -1
- package/lib/commonjs/contexts/suggestionsContext/SuggestionsContext.js +14 -4
- package/lib/commonjs/contexts/suggestionsContext/SuggestionsContext.js.map +1 -1
- package/lib/commonjs/contexts/themeContext/ThemeContext.js +13 -7
- package/lib/commonjs/contexts/themeContext/ThemeContext.js.map +1 -1
- package/lib/commonjs/contexts/themeContext/utils/theme.js +9 -0
- package/lib/commonjs/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/commonjs/contexts/threadContext/ThreadContext.js +14 -4
- package/lib/commonjs/contexts/threadContext/ThreadContext.js.map +1 -1
- package/lib/commonjs/contexts/translationContext/TranslationContext.js +15 -6
- package/lib/commonjs/contexts/translationContext/TranslationContext.js.map +1 -1
- package/lib/commonjs/contexts/typingContext/TypingContext.js +14 -4
- package/lib/commonjs/contexts/typingContext/TypingContext.js.map +1 -1
- package/lib/commonjs/contexts/utils/defaultBaseContextValue.js +7 -0
- package/lib/commonjs/contexts/utils/defaultBaseContextValue.js.map +1 -0
- package/lib/commonjs/contexts/utils/isTestEnvironment.js +11 -0
- package/lib/commonjs/contexts/utils/isTestEnvironment.js.map +1 -0
- package/lib/commonjs/mock-builders/mock.js +30 -5
- package/lib/commonjs/mock-builders/mock.js.map +1 -1
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/Attachment/Card.js +61 -21
- package/lib/module/components/Attachment/Card.js.map +1 -1
- package/lib/module/components/AutoCompleteInput/AutoCompleteSuggestionList.js +1 -1
- package/lib/module/components/AutoCompleteInput/AutoCompleteSuggestionList.js.map +1 -1
- package/lib/module/components/MessageInput/SendMessageDisallowedIndicator.js +2 -2
- package/lib/module/components/MessageInput/SendMessageDisallowedIndicator.js.map +1 -1
- package/lib/module/components/Reply/Reply.js +12 -12
- package/lib/module/components/Reply/Reply.js.map +1 -1
- package/lib/module/contexts/activeChannelsRefContext/ActiveChannelsRefContext.js +2 -2
- package/lib/module/contexts/activeChannelsRefContext/ActiveChannelsRefContext.js.map +1 -1
- package/lib/module/contexts/attachmentPickerContext/AttachmentPickerContext.js +14 -4
- package/lib/module/contexts/attachmentPickerContext/AttachmentPickerContext.js.map +1 -1
- package/lib/module/contexts/channelContext/ChannelContext.js +14 -4
- package/lib/module/contexts/channelContext/ChannelContext.js.map +1 -1
- package/lib/module/contexts/channelsContext/ChannelsContext.js +14 -4
- package/lib/module/contexts/channelsContext/ChannelsContext.js.map +1 -1
- package/lib/module/contexts/channelsStateContext/ChannelsStateContext.js +15 -9
- package/lib/module/contexts/channelsStateContext/ChannelsStateContext.js.map +1 -1
- package/lib/module/contexts/chatContext/ChatContext.js +14 -4
- package/lib/module/contexts/chatContext/ChatContext.js.map +1 -1
- package/lib/module/contexts/imageGalleryContext/ImageGalleryContext.js +14 -4
- package/lib/module/contexts/imageGalleryContext/ImageGalleryContext.js.map +1 -1
- package/lib/module/contexts/keyboardContext/KeyboardContext.js +2 -2
- package/lib/module/contexts/keyboardContext/KeyboardContext.js.map +1 -1
- package/lib/module/contexts/messageContext/MessageContext.js +14 -4
- package/lib/module/contexts/messageContext/MessageContext.js.map +1 -1
- package/lib/module/contexts/messageInputContext/MessageInputContext.js +14 -4
- package/lib/module/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/module/contexts/messageOverlayContext/MessageOverlayContext.js +14 -4
- package/lib/module/contexts/messageOverlayContext/MessageOverlayContext.js.map +1 -1
- package/lib/module/contexts/messageOverlayContext/hooks/useResettableState.test.js +4 -4
- package/lib/module/contexts/messageOverlayContext/hooks/useResettableState.test.js.map +1 -1
- package/lib/module/contexts/messagesContext/MessagesContext.js +14 -4
- package/lib/module/contexts/messagesContext/MessagesContext.js.map +1 -1
- package/lib/module/contexts/overlayContext/OverlayContext.js +13 -3
- package/lib/module/contexts/overlayContext/OverlayContext.js.map +1 -1
- package/lib/module/contexts/overlayContext/OverlayProvider.js +12 -12
- package/lib/module/contexts/overlayContext/OverlayProvider.js.map +1 -1
- package/lib/module/contexts/ownCapabilitiesContext/OwnCapabilitiesContext.js +13 -3
- package/lib/module/contexts/ownCapabilitiesContext/OwnCapabilitiesContext.js.map +1 -1
- package/lib/module/contexts/paginatedMessageListContext/PaginatedMessageListContext.js +14 -4
- package/lib/module/contexts/paginatedMessageListContext/PaginatedMessageListContext.js.map +1 -1
- package/lib/module/contexts/suggestionsContext/SuggestionsContext.js +14 -4
- package/lib/module/contexts/suggestionsContext/SuggestionsContext.js.map +1 -1
- package/lib/module/contexts/themeContext/ThemeContext.js +13 -7
- package/lib/module/contexts/themeContext/ThemeContext.js.map +1 -1
- package/lib/module/contexts/themeContext/utils/theme.js +9 -0
- package/lib/module/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/module/contexts/threadContext/ThreadContext.js +14 -4
- package/lib/module/contexts/threadContext/ThreadContext.js.map +1 -1
- package/lib/module/contexts/translationContext/TranslationContext.js +15 -6
- package/lib/module/contexts/translationContext/TranslationContext.js.map +1 -1
- package/lib/module/contexts/typingContext/TypingContext.js +14 -4
- package/lib/module/contexts/typingContext/TypingContext.js.map +1 -1
- package/lib/module/contexts/utils/defaultBaseContextValue.js +7 -0
- package/lib/module/contexts/utils/defaultBaseContextValue.js.map +1 -0
- package/lib/module/contexts/utils/isTestEnvironment.js +11 -0
- package/lib/module/contexts/utils/isTestEnvironment.js.map +1 -0
- package/lib/module/mock-builders/mock.js +30 -5
- package/lib/module/mock-builders/mock.js.map +1 -1
- package/lib/module/version.json +1 -1
- package/lib/typescript/contexts/__tests__/index.test.d.ts +1 -0
- package/lib/typescript/contexts/keyboardContext/KeyboardContext.d.ts +6 -2
- package/lib/typescript/contexts/themeContext/ThemeContext.d.ts +5 -2
- package/lib/typescript/contexts/themeContext/utils/theme.d.ts +6 -0
- package/lib/typescript/contexts/utils/defaultBaseContextValue.d.ts +1 -0
- package/lib/typescript/contexts/utils/isTestEnvironment.d.ts +1 -0
- package/lib/typescript/mock-builders/mock.d.ts +2 -2
- package/package.json +1 -1
- package/src/components/Attachment/Card.tsx +29 -6
- package/src/components/Attachment/__tests__/Attachment.test.js +0 -14
- package/src/components/Attachment/__tests__/Giphy.test.js +9 -5
- package/src/components/AutoCompleteInput/AutoCompleteSuggestionList.tsx +1 -0
- package/src/components/ImageGallery/components/__tests__/ImageGalleryHeader.test.tsx +5 -3
- package/src/components/MessageInput/SendMessageDisallowedIndicator.tsx +1 -0
- package/src/components/MessageInput/__tests__/FileUploadPreview.test.js +1 -1
- package/src/components/Reply/Reply.tsx +6 -3
- package/src/contexts/__tests__/index.test.tsx +103 -0
- package/src/contexts/activeChannelsRefContext/ActiveChannelsRefContext.tsx +1 -0
- package/src/contexts/attachmentPickerContext/AttachmentPickerContext.tsx +18 -4
- package/src/contexts/channelContext/ChannelContext.tsx +18 -2
- package/src/contexts/channelsContext/ChannelsContext.tsx +18 -2
- package/src/contexts/channelsStateContext/ChannelsStateContext.tsx +19 -10
- package/src/contexts/chatContext/ChatContext.tsx +15 -2
- package/src/contexts/imageGalleryContext/ImageGalleryContext.tsx +18 -3
- package/src/contexts/keyboardContext/KeyboardContext.tsx +2 -1
- package/src/contexts/messageContext/MessageContext.tsx +19 -2
- package/src/contexts/messageInputContext/MessageInputContext.tsx +20 -2
- package/src/contexts/messageOverlayContext/MessageOverlayContext.tsx +19 -3
- package/src/contexts/messageOverlayContext/hooks/useResettableState.test.tsx +1 -0
- package/src/contexts/messagesContext/MessagesContext.tsx +19 -2
- package/src/contexts/overlayContext/OverlayContext.tsx +17 -2
- package/src/contexts/overlayContext/OverlayProvider.tsx +1 -0
- package/src/contexts/ownCapabilitiesContext/OwnCapabilitiesContext.tsx +18 -3
- package/src/contexts/paginatedMessageListContext/PaginatedMessageListContext.tsx +15 -3
- package/src/contexts/suggestionsContext/SuggestionsContext.tsx +19 -2
- package/src/contexts/suggestionsContext/__tests__/Suggestions.test.js +1 -0
- package/src/contexts/themeContext/ThemeContext.tsx +19 -5
- package/src/contexts/themeContext/utils/theme.ts +15 -0
- package/src/contexts/threadContext/ThreadContext.tsx +16 -2
- package/src/contexts/translationContext/TranslationContext.tsx +18 -4
- package/src/contexts/typingContext/TypingContext.tsx +17 -2
- package/src/contexts/utils/defaultBaseContextValue.ts +1 -0
- package/src/contexts/utils/isTestEnvironment.ts +1 -0
- package/src/mock-builders/mock.js +16 -3
- package/src/version.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["AutoCompleteSuggestionList.tsx"],"names":["SuggestionsItem","props","children","touchableOpacityProps","displayName","AutoCompleteSuggestionListWithContext","active","AutoCompleteSuggestionHeader","AutoCompleteSuggestionItem","data","onSelect","queryText","triggerType","theme","messageInput","maxHeight","container","itemStyle","suggestions","item","flatlist","suggestionsListContainer","renderItem","index","paddingBottom","length","paddingTop","name","id","areEqual","prevProps","nextProps","prevActive","prevData","prevQueryText","prevType","nextActive","nextData","nextQueryText","nextType","activeEqual","queryTextEqual","dataEqual","typeEqual","MemoizedAutoCompleteSuggestionList","React","memo","AutoCompleteSuggestionList"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAKA;;AAQA;;;;;;;AAmBA,IAAMA,eAAgD,GAAG,SAAnDA,eAAmD,CAACC,KAAD,EAAW;AAClE,MAAQC,QAAR,GAA+CD,KAA/C,CAAQC,QAAR;AAAA,MAAqBC,qBAArB,6CAA+CF,KAA/C;AACA,SAAO,gCAAC,6BAAD,gCAAsBE,qBAAtB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAA8CD,QAA9C,CAAP;AACD,CAHD;;AAKAF,eAAe,CAACI,WAAhB,GAA8B,8CAA9B;;AAEO,IAAMC,qCAAqC,GAAG,SAAxCA,qCAAwC,CAGnDJ,KAHmD,EAIhD;AACH,MACEK,MADF,GAQIL,KARJ,CACEK,MADF;AAAA,MAEEC,4BAFF,GAQIN,KARJ,CAEEM,4BAFF;AAAA,MAGEC,0BAHF,GAQIP,KARJ,CAGEO,0BAHF;AAAA,MAIEC,IAJF,GAQIR,KARJ,CAIEQ,IAJF;AAAA,MAKEC,QALF,GAQIT,KARJ,CAKES,QALF;AAAA,MAMEC,SANF,GAQIV,KARJ,CAMEU,SANF;AAAA,MAOEC,WAPF,GAQIX,KARJ,CAOEW,WAPF;;AAUA,kBAQI,6BARJ;AAAA,wCACEC,KADF,CAEIC,YAFJ;AAAA,MAGmBC,SAHnB,yBAGMC,SAHN,CAGmBD,SAHnB;AAAA,MAI2BE,SAJ3B,yBAIMC,WAJN,CAIqBC,IAJrB;AAAA,MAKkCC,QALlC,yBAKMC,wBALN,CAKkCD,QALlC;;AAUA,MAAME,UAAU,GAAG,SAAbA,UAAa,OAA8E;AAAA,QAA3EC,KAA2E,QAA3EA,KAA2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FF;AAAA,MAGayB,aAHb,GAKIJ,SALJ,CAGEnB,SAHF;AAAA,MAIewB,QAJf,GAKIL,SALJ,CAIElB,WAJF;AAMA,MACUwB,UADV,GAKIL,SALJ,CACEzB,MADF;AAAA,MAEQ+B,QAFR,GAKIN,SALJ,CAEEtB,IAFF;AAAA,MAGa6B,aAHb,GAKIP,SALJ,CAGEpB,SAHF;AAAA,MAIe4B,QAJf,GAKIR,SALJ,CAIEnB,WAJF;AAOA,MAAM4B,WAAW,GAAGR,UAAU,KAAKI,UAAnC;AACA,MAAI,CAACI,WAAL,EAAkB,OAAO,KAAP;AAElB,MAAMC,cAAc,GAAGP,aAAa,KAAKI,aAAzC;AACA,MAAI,CAACG,cAAL,EAAqB,OAAO,KAAP;AAErB,MAAMC,SAAS,GAAGT,QAAQ,KAAKI,QAA/B;AACA,MAAI,CAACK,SAAL,EAAgB,OAAO,KAAP;AAEhB,MAAMC,SAAS,GAAGR,QAAQ,KAAKI,QAA/B;AACA,MAAI,CAACI,SAAL,EAAgB,OAAO,KAAP;AAEhB,SAAO,IAAP;AACD,CA9BD;;AAgCA,IAAMC,kCAAkC,GAAGC,kBAAMC,IAAN,CACzCzC,qCADyC,EAEzCwB,QAFyC,CAA3C;;AAcO,IAAMkB,0BAA0B,GAAG,SAA7BA,0BAA6B,CAGxC9C,KAHwC,EAIrC;AACH,8BACE,gDADF;AAAA,MAAQM,4BAAR,yBAAQA,4BAAR;AAAA,MAAsCC,0BAAtC,yBAAsCA,0BAAtC;;AAEA,SACE,gCAAC,kCAAD;AACQD,IAAAA,4BAA4B,EAA5BA,4BADR;AACsCC,IAAAA,0BAA0B,EAA1BA;AADtC,KAEMP,KAFN;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KADF;AAMD,CAbM;;;AAeP8C,0BAA0B,CAAC3C,WAA3B,GACE,6DADF","sourcesContent":["import React from 'react';\nimport { FlatList, TouchableOpacity, TouchableOpacityProps } from 'react-native';\n\nimport type { AutoCompleteSuggestionHeaderProps } from './AutoCompleteSuggestionHeader';\nimport type { AutoCompleteSuggestionItemProps } from './AutoCompleteSuggestionItem';\n\nimport {\n isSuggestionCommand,\n isSuggestionEmoji,\n isSuggestionUser,\n Suggestion,\n SuggestionsContextValue,\n useSuggestionsContext,\n} from '../../contexts/suggestionsContext/SuggestionsContext';\nimport { useTheme } from '../../contexts/themeContext/ThemeContext';\nimport type { DefaultStreamChatGenerics } from '../../types/types';\n\ntype AutoCompleteSuggestionListComponentProps<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = Pick<SuggestionsContextValue, 'queryText' | 'triggerType'> & {\n active: boolean;\n data: Suggestion<StreamChatGenerics>[];\n onSelect: (item: Suggestion<StreamChatGenerics>) => void;\n};\n\nexport type AutoCompleteSuggestionListPropsWithContext<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = Pick<\n SuggestionsContextValue<StreamChatGenerics>,\n 'AutoCompleteSuggestionHeader' | 'AutoCompleteSuggestionItem'\n> &\n AutoCompleteSuggestionListComponentProps<StreamChatGenerics>;\n\nconst SuggestionsItem: React.FC<TouchableOpacityProps> = (props) => {\n const { children, ...touchableOpacityProps } = props;\n return <TouchableOpacity {...touchableOpacityProps}>{children}</TouchableOpacity>;\n};\n\nSuggestionsItem.displayName = 'SuggestionsHeader{messageInput{suggestions}}';\n\nexport const AutoCompleteSuggestionListWithContext = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n props: AutoCompleteSuggestionListPropsWithContext<StreamChatGenerics>,\n) => {\n const {\n active,\n AutoCompleteSuggestionHeader,\n AutoCompleteSuggestionItem,\n data,\n onSelect,\n queryText,\n triggerType,\n } = props;\n\n const {\n theme: {\n messageInput: {\n container: { maxHeight },\n suggestions: { item: itemStyle },\n suggestionsListContainer: { flatlist },\n },\n },\n } = useTheme();\n\n const renderItem = ({ index, item }: { index: number; item: Suggestion<StreamChatGenerics> }) => {\n switch (triggerType) {\n case 'mention':\n if (isSuggestionUser(item)) {\n return (\n <SuggestionsItem\n onPress={() => {\n onSelect(item);\n }}\n style={[\n {\n paddingBottom: index === data.length - 1 ? 8 : 0,\n paddingTop: index === 0 ? 8 : 0,\n },\n itemStyle,\n ]}\n >\n {AutoCompleteSuggestionItem && (\n <AutoCompleteSuggestionItem itemProps={item} triggerType={triggerType} />\n )}\n </SuggestionsItem>\n );\n }\n return null;\n case 'command':\n if (isSuggestionCommand(item)) {\n return (\n <SuggestionsItem\n onPress={() => {\n onSelect(item);\n }}\n style={[itemStyle]}\n >\n {AutoCompleteSuggestionItem && (\n <AutoCompleteSuggestionItem itemProps={item} triggerType={triggerType} />\n )}\n </SuggestionsItem>\n );\n }\n return null;\n case 'emoji':\n if (isSuggestionEmoji(item)) {\n return (\n <SuggestionsItem\n onPress={() => {\n onSelect(item);\n }}\n style={[itemStyle]}\n >\n {AutoCompleteSuggestionItem && (\n <AutoCompleteSuggestionItem itemProps={item} triggerType={triggerType} />\n )}\n </SuggestionsItem>\n );\n }\n return null;\n default:\n return null;\n }\n };\n\n if (!active || data.length === 0) return null;\n\n return (\n <FlatList\n data={data}\n keyboardShouldPersistTaps='always'\n keyExtractor={(item, index) =>\n `${item.name || (isSuggestionUser(item) ? item.id : '')}${index}`\n }\n ListHeaderComponent={\n AutoCompleteSuggestionHeader ? (\n <AutoCompleteSuggestionHeader queryText={queryText} triggerType={triggerType} />\n ) : null\n }\n renderItem={renderItem}\n style={[flatlist, { maxHeight }]}\n />\n );\n};\n\nconst areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(\n prevProps: AutoCompleteSuggestionListPropsWithContext<StreamChatGenerics>,\n nextProps: AutoCompleteSuggestionListPropsWithContext<StreamChatGenerics>,\n) => {\n const {\n active: prevActive,\n data: prevData,\n queryText: prevQueryText,\n triggerType: prevType,\n } = prevProps;\n const {\n active: nextActive,\n data: nextData,\n queryText: nextQueryText,\n triggerType: nextType,\n } = nextProps;\n\n const activeEqual = prevActive === nextActive;\n if (!activeEqual) return false;\n\n const queryTextEqual = prevQueryText === nextQueryText;\n if (!queryTextEqual) return false;\n\n const dataEqual = prevData === nextData;\n if (!dataEqual) return false;\n\n const typeEqual = prevType === nextType;\n if (!typeEqual) return false;\n\n return true;\n};\n\nconst MemoizedAutoCompleteSuggestionList = React.memo(\n AutoCompleteSuggestionListWithContext,\n areEqual,\n) as typeof AutoCompleteSuggestionListWithContext;\n\nexport type AutoCompleteSuggestionListProps<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = AutoCompleteSuggestionListComponentProps<StreamChatGenerics> & {\n AutoCompleteSuggestionHeader?: React.ComponentType<AutoCompleteSuggestionHeaderProps>;\n AutoCompleteSuggestionItem?: React.ComponentType<\n AutoCompleteSuggestionItemProps<StreamChatGenerics>\n >;\n};\n\nexport const AutoCompleteSuggestionList = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n props: AutoCompleteSuggestionListProps<StreamChatGenerics>,\n) => {\n const { AutoCompleteSuggestionHeader, AutoCompleteSuggestionItem } =\n useSuggestionsContext<StreamChatGenerics>();\n return (\n <MemoizedAutoCompleteSuggestionList\n {...{ AutoCompleteSuggestionHeader, AutoCompleteSuggestionItem }}\n {...props}\n />\n );\n};\n\nAutoCompleteSuggestionList.displayName =\n 'AutoCompleteSuggestionList{messageInput{suggestions{List}}}';\n"]}
|
|
1
|
+
{"version":3,"sources":["AutoCompleteSuggestionList.tsx"],"names":["SuggestionsItem","props","children","touchableOpacityProps","displayName","AutoCompleteSuggestionListWithContext","active","AutoCompleteSuggestionHeader","AutoCompleteSuggestionItem","data","onSelect","queryText","triggerType","theme","messageInput","maxHeight","container","itemStyle","suggestions","item","flatlist","suggestionsListContainer","renderItem","index","paddingBottom","length","paddingTop","name","id","areEqual","prevProps","nextProps","prevActive","prevData","prevQueryText","prevType","nextActive","nextData","nextQueryText","nextType","activeEqual","queryTextEq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B,MADF;AAAA,MAEQ+B,QAFR,GAKIN,SALJ,CAEEtB,IAFF;AAAA,MAGa6B,aAHb,GAKIP,SALJ,CAGEpB,SAHF;AAAA,MAIe4B,QAJf,GAKIR,SALJ,CAIEnB,WAJF;AAOA,MAAM4B,WAAW,GAAGR,UAAU,KAAKI,UAAnC;AACA,MAAI,CAACI,WAAL,EAAkB,OAAO,KAAP;AAElB,MAAMC,cAAc,GAAGP,aAAa,KAAKI,aAAzC;AACA,MAAI,CAACG,cAAL,EAAqB,OAAO,KAAP;AAErB,MAAMC,SAAS,GAAGT,QAAQ,KAAKI,QAA/B;AACA,MAAI,CAACK,SAAL,EAAgB,OAAO,KAAP;AAEhB,MAAMC,SAAS,GAAGR,QAAQ,KAAKI,QAA/B;AACA,MAAI,CAACI,SAAL,EAAgB,OAAO,KAAP;AAEhB,SAAO,IAAP;AACD,CA9BD;;AAgCA,IAAMC,kCAAkC,GAAGC,kBAAMC,IAAN,CACzCzC,qCADyC,EAEzCwB,QAFyC,CAA3C;;AAcO,IAAMkB,0BAA0B,GAAG,SAA7BA,0BAA6B,CAGxC9C,KAHwC,EAIrC;AACH,8BACE,gDADF;AAAA,MAAQM,4BAAR,yBAAQA,4BAAR;AAAA,MAAsCC,0BAAtC,yBAAsCA,0BAAtC;;AAGA,SACE,gCAAC,kCAAD;AACQD,IAAAA,4BAA4B,EAA5BA,4BADR;AACsCC,IAAAA,0BAA0B,EAA1BA;AADtC,KAEMP,KAFN;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KADF;AAMD,CAdM;;;AAgBP8C,0BAA0B,CAAC3C,WAA3B,GACE,6DADF","sourcesContent":["import React from 'react';\nimport { FlatList, TouchableOpacity, TouchableOpacityProps } from 'react-native';\n\nimport type { AutoCompleteSuggestionHeaderProps } from './AutoCompleteSuggestionHeader';\nimport type { AutoCompleteSuggestionItemProps } from './AutoCompleteSuggestionItem';\n\nimport {\n isSuggestionCommand,\n isSuggestionEmoji,\n isSuggestionUser,\n Suggestion,\n SuggestionsContextValue,\n useSuggestionsContext,\n} from '../../contexts/suggestionsContext/SuggestionsContext';\nimport { useTheme } from '../../contexts/themeContext/ThemeContext';\nimport type { DefaultStreamChatGenerics } from '../../types/types';\n\ntype AutoCompleteSuggestionListComponentProps<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = Pick<SuggestionsContextValue, 'queryText' | 'triggerType'> & {\n active: boolean;\n data: Suggestion<StreamChatGenerics>[];\n onSelect: (item: Suggestion<StreamChatGenerics>) => void;\n};\n\nexport type AutoCompleteSuggestionListPropsWithContext<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = Pick<\n SuggestionsContextValue<StreamChatGenerics>,\n 'AutoCompleteSuggestionHeader' | 'AutoCompleteSuggestionItem'\n> &\n AutoCompleteSuggestionListComponentProps<StreamChatGenerics>;\n\nconst SuggestionsItem: React.FC<TouchableOpacityProps> = (props) => {\n const { children, ...touchableOpacityProps } = props;\n return <TouchableOpacity {...touchableOpacityProps}>{children}</TouchableOpacity>;\n};\n\nSuggestionsItem.displayName = 'SuggestionsHeader{messageInput{suggestions}}';\n\nexport const AutoCompleteSuggestionListWithContext = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n props: AutoCompleteSuggestionListPropsWithContext<StreamChatGenerics>,\n) => {\n const {\n active,\n AutoCompleteSuggestionHeader,\n AutoCompleteSuggestionItem,\n data,\n onSelect,\n queryText,\n triggerType,\n } = props;\n\n const {\n theme: {\n messageInput: {\n container: { maxHeight },\n suggestions: { item: itemStyle },\n suggestionsListContainer: { flatlist },\n },\n },\n } = useTheme();\n\n const renderItem = ({ index, item }: { index: number; item: Suggestion<StreamChatGenerics> }) => {\n switch (triggerType) {\n case 'mention':\n if (isSuggestionUser(item)) {\n return (\n <SuggestionsItem\n onPress={() => {\n onSelect(item);\n }}\n style={[\n {\n paddingBottom: index === data.length - 1 ? 8 : 0,\n paddingTop: index === 0 ? 8 : 0,\n },\n itemStyle,\n ]}\n >\n {AutoCompleteSuggestionItem && (\n <AutoCompleteSuggestionItem itemProps={item} triggerType={triggerType} />\n )}\n </SuggestionsItem>\n );\n }\n return null;\n case 'command':\n if (isSuggestionCommand(item)) {\n return (\n <SuggestionsItem\n onPress={() => {\n onSelect(item);\n }}\n style={[itemStyle]}\n >\n {AutoCompleteSuggestionItem && (\n <AutoCompleteSuggestionItem itemProps={item} triggerType={triggerType} />\n )}\n </SuggestionsItem>\n );\n }\n return null;\n case 'emoji':\n if (isSuggestionEmoji(item)) {\n return (\n <SuggestionsItem\n onPress={() => {\n onSelect(item);\n }}\n style={[itemStyle]}\n >\n {AutoCompleteSuggestionItem && (\n <AutoCompleteSuggestionItem itemProps={item} triggerType={triggerType} />\n )}\n </SuggestionsItem>\n );\n }\n return null;\n default:\n return null;\n }\n };\n\n if (!active || data.length === 0) return null;\n\n return (\n <FlatList\n data={data}\n keyboardShouldPersistTaps='always'\n keyExtractor={(item, index) =>\n `${item.name || (isSuggestionUser(item) ? item.id : '')}${index}`\n }\n ListHeaderComponent={\n AutoCompleteSuggestionHeader ? (\n <AutoCompleteSuggestionHeader queryText={queryText} triggerType={triggerType} />\n ) : null\n }\n renderItem={renderItem}\n style={[flatlist, { maxHeight }]}\n />\n );\n};\n\nconst areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(\n prevProps: AutoCompleteSuggestionListPropsWithContext<StreamChatGenerics>,\n nextProps: AutoCompleteSuggestionListPropsWithContext<StreamChatGenerics>,\n) => {\n const {\n active: prevActive,\n data: prevData,\n queryText: prevQueryText,\n triggerType: prevType,\n } = prevProps;\n const {\n active: nextActive,\n data: nextData,\n queryText: nextQueryText,\n triggerType: nextType,\n } = nextProps;\n\n const activeEqual = prevActive === nextActive;\n if (!activeEqual) return false;\n\n const queryTextEqual = prevQueryText === nextQueryText;\n if (!queryTextEqual) return false;\n\n const dataEqual = prevData === nextData;\n if (!dataEqual) return false;\n\n const typeEqual = prevType === nextType;\n if (!typeEqual) return false;\n\n return true;\n};\n\nconst MemoizedAutoCompleteSuggestionList = React.memo(\n AutoCompleteSuggestionListWithContext,\n areEqual,\n) as typeof AutoCompleteSuggestionListWithContext;\n\nexport type AutoCompleteSuggestionListProps<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = AutoCompleteSuggestionListComponentProps<StreamChatGenerics> & {\n AutoCompleteSuggestionHeader?: React.ComponentType<AutoCompleteSuggestionHeaderProps>;\n AutoCompleteSuggestionItem?: React.ComponentType<\n AutoCompleteSuggestionItemProps<StreamChatGenerics>\n >;\n};\n\nexport const AutoCompleteSuggestionList = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n props: AutoCompleteSuggestionListProps<StreamChatGenerics>,\n) => {\n const { AutoCompleteSuggestionHeader, AutoCompleteSuggestionItem } =\n useSuggestionsContext<StreamChatGenerics>();\n\n return (\n <MemoizedAutoCompleteSuggestionList\n {...{ AutoCompleteSuggestionHeader, AutoCompleteSuggestionItem }}\n {...props}\n />\n );\n};\n\nAutoCompleteSuggestionList.displayName =\n 'AutoCompleteSuggestionList{messageInput{suggestions{List}}}';\n"]}
|
|
@@ -51,7 +51,7 @@ var SendMessageDisallowedIndicator = function SendMessageDisallowedIndicator() {
|
|
|
51
51
|
__self: _this,
|
|
52
52
|
__source: {
|
|
53
53
|
fileName: _jsxFileName,
|
|
54
|
-
lineNumber:
|
|
54
|
+
lineNumber: 32,
|
|
55
55
|
columnNumber: 5
|
|
56
56
|
}
|
|
57
57
|
}, _react["default"].createElement(_reactNative.Text, {
|
|
@@ -61,7 +61,7 @@ var SendMessageDisallowedIndicator = function SendMessageDisallowedIndicator() {
|
|
|
61
61
|
__self: _this,
|
|
62
62
|
__source: {
|
|
63
63
|
fileName: _jsxFileName,
|
|
64
|
-
lineNumber:
|
|
64
|
+
lineNumber: 43,
|
|
65
65
|
columnNumber: 7
|
|
66
66
|
}
|
|
67
67
|
}, t("You can't send messages in this channel")));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["SendMessageDisallowedIndicator.tsx"],"names":["styles","StyleSheet","create","container","alignItems","borderTopWidth","height","justifyContent","text","fontSize","fontWeight","SendMessageDisallowedIndicator","t","theme","colors","border","grey_dark","messageInput","sendMessageDisallowedIndicator","borderTopColor","color"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;;;;AAEA,IAAMA,MAAM,GAAGC,wBAAWC,MAAX,CAAkB;AAC/BC,EAAAA,SAAS,EAAE;AACTC,IAAAA,UAAU,EAAE,QADH;AAETC,IAAAA,cAAc,EAAE,CAFP;AAGTC,IAAAA,MAAM,EAAE,EAHC;AAITC,IAAAA,cAAc,EAAE;AAJP,GADoB;AAO/BC,EAAAA,IAAI,EAAE;AACJC,IAAAA,QAAQ,EAAE,EADN;AAEJC,IAAAA,UAAU,EAAE;AAFR;AAPyB,CAAlB,CAAf;;AAaO,IAAMC,8BAA8B,GAAG,SAAjCA,8BAAiC,GAAM;AAClD,8BAAc,gDAAd;AAAA,MAAQC,CAAR,yBAAQA,CAAR;;AACA,kBAOI,6BAPJ;AAAA,kCACEC,KADF;AAAA,8CAEIC,MAFJ;AAAA,MAEcC,MAFd,yBAEcA,MAFd;AAAA,MAEsBC,SAFtB,yBAEsBA,SAFtB;AAAA,8CAGIC,YAHJ,CAIMC,8BAJN;AAAA,MAIwCf,SAJxC,yBAIwCA,SAJxC;AAAA,MAImDK,IAJnD,yBAImDA,IAJnD;;
|
|
1
|
+
{"version":3,"sources":["SendMessageDisallowedIndicator.tsx"],"names":["styles","StyleSheet","create","container","alignItems","borderTopWidth","height","justifyContent","text","fontSize","fontWeight","SendMessageDisallowedIndicator","t","theme","colors","border","grey_dark","messageInput","sendMessageDisallowedIndicator","borderTopColor","color"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;;;;AAEA,IAAMA,MAAM,GAAGC,wBAAWC,MAAX,CAAkB;AAC/BC,EAAAA,SAAS,EAAE;AACTC,IAAAA,UAAU,EAAE,QADH;AAETC,IAAAA,cAAc,EAAE,CAFP;AAGTC,IAAAA,MAAM,EAAE,EAHC;AAITC,IAAAA,cAAc,EAAE;AAJP,GADoB;AAO/BC,EAAAA,IAAI,EAAE;AACJC,IAAAA,QAAQ,EAAE,EADN;AAEJC,IAAAA,UAAU,EAAE;AAFR;AAPyB,CAAlB,CAAf;;AAaO,IAAMC,8BAA8B,GAAG,SAAjCA,8BAAiC,GAAM;AAClD,8BAAc,gDAAd;AAAA,MAAQC,CAAR,yBAAQA,CAAR;;AACA,kBAOI,6BAPJ;AAAA,kCACEC,KADF;AAAA,8CAEIC,MAFJ;AAAA,MAEcC,MAFd,yBAEcA,MAFd;AAAA,MAEsBC,SAFtB,yBAEsBA,SAFtB;AAAA,8CAGIC,YAHJ,CAIMC,8BAJN;AAAA,MAIwCf,SAJxC,yBAIwCA,SAJxC;AAAA,MAImDK,IAJnD,yBAImDA,IAJnD;;AASA,SACE,gCAAC,iBAAD;AACE,IAAA,KAAK,EAAE,CACLR,MAAM,CAACG,SADF,EAEL;AACEgB,MAAAA,cAAc,EAAEJ,MADlB;AAEET,MAAAA,MAAM,EAAE;AAFV,KAFK,EAMLH,SANK,CADT;AASE,IAAA,MAAM,EAAC,mCATT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAWE,gCAAC,iBAAD;AAAM,IAAA,KAAK,EAAE,CAACH,MAAM,CAACQ,IAAR,EAAc;AAAEY,MAAAA,KAAK,EAAEJ;AAAT,KAAd,EAAoCR,IAApC,CAAb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACGI,CAAC,CAAC,yCAAD,CADJ,CAXF,CADF;AAiBD,CA5BM","sourcesContent":["import React from 'react';\nimport { StyleSheet, Text, View } from 'react-native';\n\nimport { useTheme } from '../../contexts/themeContext/ThemeContext';\nimport { useTranslationContext } from '../../contexts/translationContext/TranslationContext';\n\nconst styles = StyleSheet.create({\n container: {\n alignItems: 'center',\n borderTopWidth: 1,\n height: 50,\n justifyContent: 'center',\n },\n text: {\n fontSize: 17,\n fontWeight: '400',\n },\n});\n\nexport const SendMessageDisallowedIndicator = () => {\n const { t } = useTranslationContext();\n const {\n theme: {\n colors: { border, grey_dark },\n messageInput: {\n sendMessageDisallowedIndicator: { container, text },\n },\n },\n } = useTheme();\n\n return (\n <View\n style={[\n styles.container,\n {\n borderTopColor: border,\n height: 50,\n },\n container,\n ]}\n testID='send-message-disallowed-indicator'\n >\n <Text style={[styles.text, { color: grey_dark }, text]}>\n {t(\"You can't send messages in this channel\")}\n </Text>\n </View>\n );\n};\n"]}
|
|
@@ -92,9 +92,9 @@ var getMessageType = function getMessageType(lastAttachment) {
|
|
|
92
92
|
var messageType;
|
|
93
93
|
var isLastAttachmentFile = lastAttachment.type === 'file' || lastAttachment.type === 'audio';
|
|
94
94
|
var isLastAttachmentVideo = lastAttachment.type === 'video';
|
|
95
|
-
var isLastAttachmentGiphy = lastAttachment.type === 'giphy' || lastAttachment.type === 'imgur';
|
|
96
|
-
var isLastAttachmentImageOrGiphy = lastAttachment.type === 'image' && !lastAttachment.title_link && !lastAttachment.og_scrape_url;
|
|
97
|
-
var isLastAttachmentImage = lastAttachment.image_url || lastAttachment.thumb_url;
|
|
95
|
+
var isLastAttachmentGiphy = (lastAttachment == null ? void 0 : lastAttachment.type) === 'giphy' || (lastAttachment == null ? void 0 : lastAttachment.type) === 'imgur';
|
|
96
|
+
var isLastAttachmentImageOrGiphy = (lastAttachment == null ? void 0 : lastAttachment.type) === 'image' && !(lastAttachment != null && lastAttachment.title_link) && !(lastAttachment != null && lastAttachment.og_scrape_url);
|
|
97
|
+
var isLastAttachmentImage = (lastAttachment == null ? void 0 : lastAttachment.image_url) || (lastAttachment == null ? void 0 : lastAttachment.thumb_url);
|
|
98
98
|
|
|
99
99
|
if (isLastAttachmentFile) {
|
|
100
100
|
messageType = 'file';
|
|
@@ -153,7 +153,7 @@ var ReplyWithContext = function ReplyWithContext(props) {
|
|
|
153
153
|
__self: _this,
|
|
154
154
|
__source: {
|
|
155
155
|
fileName: _jsxFileName,
|
|
156
|
-
lineNumber:
|
|
156
|
+
lineNumber: 161,
|
|
157
157
|
columnNumber: 5
|
|
158
158
|
}
|
|
159
159
|
}, _react["default"].createElement(MessageAvatar, {
|
|
@@ -164,7 +164,7 @@ var ReplyWithContext = function ReplyWithContext(props) {
|
|
|
164
164
|
__self: _this,
|
|
165
165
|
__source: {
|
|
166
166
|
fileName: _jsxFileName,
|
|
167
|
-
lineNumber:
|
|
167
|
+
lineNumber: 162,
|
|
168
168
|
columnNumber: 7
|
|
169
169
|
}
|
|
170
170
|
}), _react["default"].createElement(_reactNative.View, {
|
|
@@ -176,7 +176,7 @@ var ReplyWithContext = function ReplyWithContext(props) {
|
|
|
176
176
|
__self: _this,
|
|
177
177
|
__source: {
|
|
178
178
|
fileName: _jsxFileName,
|
|
179
|
-
lineNumber:
|
|
179
|
+
lineNumber: 163,
|
|
180
180
|
columnNumber: 7
|
|
181
181
|
}
|
|
182
182
|
}, !error && lastAttachment ? messageType === 'file' ? _react["default"].createElement(_reactNative.View, {
|
|
@@ -184,7 +184,7 @@ var ReplyWithContext = function ReplyWithContext(props) {
|
|
|
184
184
|
__self: _this,
|
|
185
185
|
__source: {
|
|
186
186
|
fileName: _jsxFileName,
|
|
187
|
-
lineNumber:
|
|
187
|
+
lineNumber: 178,
|
|
188
188
|
columnNumber: 13
|
|
189
189
|
}
|
|
190
190
|
}, _react["default"].createElement(FileAttachmentIcon, {
|
|
@@ -193,7 +193,7 @@ var ReplyWithContext = function ReplyWithContext(props) {
|
|
|
193
193
|
__self: _this,
|
|
194
194
|
__source: {
|
|
195
195
|
fileName: _jsxFileName,
|
|
196
|
-
lineNumber:
|
|
196
|
+
lineNumber: 185,
|
|
197
197
|
columnNumber: 15
|
|
198
198
|
}
|
|
199
199
|
})) : hasImage ? _react["default"].createElement(_reactNative.Image, {
|
|
@@ -211,7 +211,7 @@ var ReplyWithContext = function ReplyWithContext(props) {
|
|
|
211
211
|
__self: _this,
|
|
212
212
|
__source: {
|
|
213
213
|
fileName: _jsxFileName,
|
|
214
|
-
lineNumber:
|
|
214
|
+
lineNumber: 188,
|
|
215
215
|
columnNumber: 13
|
|
216
216
|
}
|
|
217
217
|
}) : null : null, messageType === 'video' && !lastAttachment.og_scrape_url ? _react["default"].createElement(_VideoThumbnail.VideoThumbnail, {
|
|
@@ -219,7 +219,7 @@ var ReplyWithContext = function ReplyWithContext(props) {
|
|
|
219
219
|
__self: _this,
|
|
220
220
|
__source: {
|
|
221
221
|
fileName: _jsxFileName,
|
|
222
|
-
lineNumber:
|
|
222
|
+
lineNumber: 210,
|
|
223
223
|
columnNumber: 11
|
|
224
224
|
}
|
|
225
225
|
}) : null, _react["default"].createElement(_MessageTextContainer.MessageTextContainer, {
|
|
@@ -242,7 +242,7 @@ var ReplyWithContext = function ReplyWithContext(props) {
|
|
|
242
242
|
__self: _this,
|
|
243
243
|
__source: {
|
|
244
244
|
fileName: _jsxFileName,
|
|
245
|
-
lineNumber:
|
|
245
|
+
lineNumber: 212,
|
|
246
246
|
columnNumber: 9
|
|
247
247
|
}
|
|
248
248
|
})));
|
|
@@ -286,7 +286,7 @@ var Reply = function Reply(props) {
|
|
|
286
286
|
__self: _this,
|
|
287
287
|
__source: {
|
|
288
288
|
fileName: _jsxFileName,
|
|
289
|
-
lineNumber:
|
|
289
|
+
lineNumber: 319,
|
|
290
290
|
columnNumber: 5
|
|
291
291
|
}
|
|
292
292
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Reply.tsx"],"names":["styles","StyleSheet","create","container","alignItems","flexDirection","fileAttachmentContainer","paddingLeft","paddingVertical","imageAttachment","borderRadius","height","marginLeft","marginVertical","width","messageContainer","borderBottomLeftRadius","borderBottomRightRadius","borderTopLeftRadius","borderTopRightRadius","flexGrow","flexShrink","text","fontSize","textContainer","maxWidth","undefined","paddingHorizontal","videoAttachment","getMessageType","lastAttachment","messageType","isLastAttachmentFile","type","isLastAttachmentVideo","isLastAttachmentGiphy","isLastAttachmentImageOrGiphy","title_link","og_scrape_url","isLastAttachmentImage","image_url","thumb_url","ReplyWithContext","props","FileAttachmentIcon","attachmentSize","MessageAvatar","quotedMessage","stylesProp","t","error","setError","theme","colors","blue_alice","border","grey","transparent","white","deletedText","messageSimple","content","reply","markdownStyles","attachments","slice","hasImage","onlyEmojis","emojiRegex","test","backgroundColor","borderColor","borderWidth","mime_type","uri","url","deleted_at","em","color","length","title","marginRight","Number","areEqual","prevProps","nextProps","prevQuotedMessage","nextQuotedMessage","quotedMessageEqual","id","MemoizedReply","React","memo","Reply","message","FileIconDefault","MessageAvatarDefault","editing","quotedEditingMessage","quoted_message","displayName"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AAEA;;AAIA;;AACA;;AAIA;;AAIA;;AACA;;AAKA;;AACA;;AAEA;;AACA;;AACA;;AACA;;;;;;;;;AAEA,IAAMA,MAAM,GAAGC,wBAAWC,MAAX,CAAkB;AAC/BC,EAAAA,SAAS,EAAE;AACTC,IAAAA,UAAU,EAAE,UADH;AAETC,IAAAA,aAAa,EAAE;AAFN,GADoB;AAK/BC,EAAAA,uBAAuB,EAAE;AAAEC,IAAAA,WAAW,EAAE,CAAf;AAAkBC,IAAAA,eAAe,EAAE;AAAnC,GALM;AAM/BC,EAAAA,eAAe,EAAE;AACfC,IAAAA,YAAY,EAAE,CADC;AAEfC,IAAAA,MAAM,EAAE,EAFO;AAGfC,IAAAA,UAAU,EAAE,CAHG;AAIfC,IAAAA,cAAc,EAAE,CAJD;AAKfC,IAAAA,KAAK,EAAE;AALQ,GANc;AAa/BC,EAAAA,gBAAgB,EAAE;AAChBX,IAAAA,UAAU,EAAE,YADI;AAEhBY,IAAAA,sBAAsB,EAAE,CAFR;AAGhBC,IAAAA,uBAAuB,EAAE,EAHT;AAIhBC,IAAAA,mBAAmB,EAAE,EAJL;AAK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AAAA,MAAQmD,OAAR,sBAAQA,OAAR;;AAEA,4BACE,0CADF;AAAA,kDAAQlD,kBAAR;AAAA,MAAQA,kBAAR,sCAA6BmD,kBAA7B;AAAA,kDAA8CjD,aAA9C;AAAA,MAA8CA,aAA9C,sCAA8DkD,4BAA9D;;AAGA,8BAAmC,kDAAnC;AAAA,MAAQC,OAAR,yBAAQA,OAAR;AAAA,MAAiBlD,aAAjB,yBAAiBA,aAAjB;;AAEA,MAAMmD,oBAAoB,GACxB,OAAOD,OAAP,KAAmB,SAAnB,GAA+B,CAAAA,OAAO,QAAP,YAAAA,OAAO,CAAEE,cAAT,KAA2B,KAA1D,GAAkE,KADpE;;AAIA,8BAAc,gDAAd;AAAA,MAAQlD,CAAR,yBAAQA,CAAR;;AAEA,SACE,gCAAC,aAAD;AAEIL,IAAAA,kBAAkB,EAAlBA,kBAFJ;AAGIE,IAAAA,aAAa,EAAbA,aAHJ;AAIIC,IAAAA,aAAa,EAAE+C,OAAO,GACjBA,OAAO,CAACK,cADS,GAElBpD,aAAa,IAAImD,oBANzB;AAOIjD,IAAAA,CAAC,EAADA;AAPJ,KASMN,KATN;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KADF;AAaD,CA/BM;;;AAiCPkD,KAAK,CAACO,WAAN,GAAoB,cAApB","sourcesContent":["import React, { useState } from 'react';\nimport { Image, ImageStyle, StyleSheet, View, ViewStyle } from 'react-native';\n\nimport merge from 'lodash/merge';\n\nimport type { Attachment } from 'stream-chat';\n\nimport { useMessageContext } from '../../contexts/messageContext/MessageContext';\nimport {\n MessageInputContextValue,\n useMessageInputContext,\n} from '../../contexts/messageInputContext/MessageInputContext';\nimport {\n MessagesContextValue,\n useMessagesContext,\n} from '../../contexts/messagesContext/MessagesContext';\nimport { useTheme } from '../../contexts/themeContext/ThemeContext';\nimport {\n TranslationContextValue,\n useTranslationContext,\n} from '../../contexts/translationContext/TranslationContext';\nimport type { DefaultStreamChatGenerics } from '../../types/types';\nimport { getResizedImageUrl } from '../../utils/getResizedImageUrl';\nimport { emojiRegex } from '../../utils/utils';\n\nimport { FileIcon as FileIconDefault } from '../Attachment/FileIcon';\nimport { VideoThumbnail } from '../Attachment/VideoThumbnail';\nimport { MessageAvatar as MessageAvatarDefault } from '../Message/MessageSimple/MessageAvatar';\nimport { MessageTextContainer } from '../Message/MessageSimple/MessageTextContainer';\n\nconst styles = StyleSheet.create({\n container: {\n alignItems: 'flex-end',\n flexDirection: 'row',\n },\n fileAttachmentContainer: { paddingLeft: 8, paddingVertical: 8 },\n imageAttachment: {\n borderRadius: 8,\n height: 32,\n marginLeft: 8,\n marginVertical: 8,\n width: 32,\n },\n messageContainer: {\n alignItems: 'flex-start',\n borderBottomLeftRadius: 0,\n borderBottomRightRadius: 12,\n borderTopLeftRadius: 12,\n borderTopRightRadius: 12,\n flexDirection: 'row',\n flexGrow: 1,\n flexShrink: 1,\n },\n text: { fontSize: 12 },\n textContainer: { maxWidth: undefined, paddingHorizontal: 8 },\n videoAttachment: {\n borderRadius: 8,\n height: 50,\n marginLeft: 8,\n marginVertical: 8,\n width: 50,\n },\n});\n\ntype ReplyPropsWithContext<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = Pick<MessageInputContextValue<StreamChatGenerics>, 'quotedMessage'> &\n Pick<MessagesContextValue<StreamChatGenerics>, 'FileAttachmentIcon' | 'MessageAvatar'> &\n Pick<TranslationContextValue, 't'> & {\n attachmentSize?: number;\n styles?: Partial<{\n container: ViewStyle;\n fileAttachmentContainer: ViewStyle;\n imageAttachment: ImageStyle;\n messageContainer: ViewStyle;\n textContainer: ViewStyle;\n }>;\n };\n\nconst getMessageType = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n lastAttachment: Attachment<StreamChatGenerics>,\n) => {\n let messageType;\n\n const isLastAttachmentFile = lastAttachment.type === 'file' || lastAttachment.type === 'audio';\n\n const isLastAttachmentVideo = lastAttachment.type === 'video';\n\n const isLastAttachmentGiphy = lastAttachment.type === 'giphy' || lastAttachment.type === 'imgur';\n\n const isLastAttachmentImageOrGiphy =\n lastAttachment.type === 'image' && !lastAttachment.title_link && !lastAttachment.og_scrape_url;\n\n const isLastAttachmentImage = lastAttachment.image_url || lastAttachment.thumb_url;\n\n if (isLastAttachmentFile) {\n messageType = 'file';\n } else if (isLastAttachmentVideo) {\n messageType = 'video';\n } else if (isLastAttachmentImageOrGiphy) {\n if (isLastAttachmentImage) messageType = 'image';\n else messageType = undefined;\n } else if (isLastAttachmentGiphy) messageType = 'giphy';\n else messageType = 'other';\n\n return messageType;\n};\n\nconst ReplyWithContext = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n props: ReplyPropsWithContext<StreamChatGenerics>,\n) => {\n const {\n FileAttachmentIcon,\n attachmentSize = 40,\n MessageAvatar,\n quotedMessage,\n styles: stylesProp = {},\n t,\n } = props;\n\n const [error, setError] = useState(false);\n\n const {\n theme: {\n colors: { blue_alice, border, grey, transparent, white },\n messageSimple: {\n content: { deletedText },\n },\n reply: {\n container,\n fileAttachmentContainer,\n imageAttachment,\n markdownStyles,\n messageContainer,\n textContainer,\n },\n },\n } = useTheme();\n\n if (typeof quotedMessage === 'boolean') return null;\n\n const lastAttachment = quotedMessage.attachments?.slice(-1)[0] as Attachment<StreamChatGenerics>;\n const messageType = lastAttachment && getMessageType(lastAttachment);\n\n const hasImage =\n !error &&\n lastAttachment &&\n messageType !== 'file' &&\n (lastAttachment.image_url || lastAttachment.thumb_url || lastAttachment.og_scrape_url);\n\n const onlyEmojis = !lastAttachment && !!quotedMessage.text && emojiRegex.test(quotedMessage.text);\n\n return (\n <View style={[styles.container, container, stylesProp.container]}>\n <MessageAvatar alignment={'left'} lastGroupMessage message={quotedMessage} size={24} />\n <View\n style={[\n styles.messageContainer,\n {\n backgroundColor:\n messageType === 'other' ? blue_alice : messageType === 'giphy' ? transparent : white,\n borderColor: border,\n borderWidth: messageType === 'other' ? 0 : 1,\n },\n messageContainer,\n stylesProp.messageContainer,\n ]}\n >\n {!error && lastAttachment ? (\n messageType === 'file' ? (\n <View\n style={[\n styles.fileAttachmentContainer,\n fileAttachmentContainer,\n stylesProp.fileAttachmentContainer,\n ]}\n >\n <FileAttachmentIcon mimeType={lastAttachment.mime_type} size={attachmentSize} />\n </View>\n ) : hasImage ? (\n <Image\n onError={() => setError(true)}\n source={{\n uri: getResizedImageUrl({\n height:\n stylesProp.imageAttachment?.height ||\n imageAttachment?.height ||\n styles.imageAttachment.height,\n url: (lastAttachment.image_url ||\n lastAttachment.thumb_url ||\n lastAttachment.og_scrape_url) as string,\n width:\n stylesProp.imageAttachment?.width ||\n imageAttachment?.width ||\n styles.imageAttachment.width,\n }),\n }}\n style={[styles.imageAttachment, imageAttachment, stylesProp.imageAttachment]}\n />\n ) : null\n ) : null}\n {messageType === 'video' && !lastAttachment.og_scrape_url ? (\n <VideoThumbnail style={[styles.videoAttachment]} />\n ) : null}\n <MessageTextContainer<StreamChatGenerics>\n markdownStyles={\n quotedMessage.deleted_at\n ? merge({ em: { color: grey } }, deletedText)\n : { text: styles.text, ...markdownStyles }\n }\n message={{\n ...quotedMessage,\n text: quotedMessage.deleted_at\n ? `_${t('Message deleted')}_`\n : quotedMessage.text\n ? quotedMessage.text.length > 170\n ? `${quotedMessage.text.slice(0, 170)}...`\n : quotedMessage.text\n : messageType === 'image'\n ? t('Photo')\n : messageType === 'video'\n ? 'Video'\n : messageType === 'file'\n ? lastAttachment?.title || ''\n : '',\n }}\n onlyEmojis={onlyEmojis}\n styles={{\n textContainer: [\n {\n marginRight:\n hasImage || messageType === 'video'\n ? Number(\n stylesProp.imageAttachment?.height ||\n imageAttachment.height ||\n styles.imageAttachment.height,\n ) +\n Number(\n stylesProp.imageAttachment?.marginLeft ||\n imageAttachment.marginLeft ||\n styles.imageAttachment.marginLeft,\n )\n : messageType === 'file'\n ? attachmentSize +\n Number(\n stylesProp.fileAttachmentContainer?.paddingLeft ||\n fileAttachmentContainer.paddingLeft ||\n styles.fileAttachmentContainer.paddingLeft,\n )\n : undefined,\n },\n styles.textContainer,\n textContainer,\n stylesProp.textContainer,\n ],\n }}\n />\n </View>\n </View>\n );\n};\n\nconst areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(\n prevProps: ReplyPropsWithContext<StreamChatGenerics>,\n nextProps: ReplyPropsWithContext<StreamChatGenerics>,\n) => {\n const { quotedMessage: prevQuotedMessage } = prevProps;\n const { quotedMessage: nextQuotedMessage } = nextProps;\n\n const quotedMessageEqual =\n !!prevQuotedMessage &&\n !!nextQuotedMessage &&\n typeof prevQuotedMessage !== 'boolean' &&\n typeof nextQuotedMessage !== 'boolean'\n ? prevQuotedMessage.id === nextQuotedMessage.id &&\n prevQuotedMessage.deleted_at === nextQuotedMessage.deleted_at\n : !!prevQuotedMessage === !!nextQuotedMessage;\n\n if (!quotedMessageEqual) return false;\n\n return true;\n};\n\nconst MemoizedReply = React.memo(ReplyWithContext, areEqual) as typeof ReplyWithContext;\n\nexport type ReplyProps<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = Partial<ReplyPropsWithContext<StreamChatGenerics>>;\n\n/**\n * UI Component for reply\n */\nexport const Reply = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n props: ReplyProps<StreamChatGenerics>,\n) => {\n const { message } = useMessageContext<StreamChatGenerics>();\n\n const { FileAttachmentIcon = FileIconDefault, MessageAvatar = MessageAvatarDefault } =\n useMessagesContext<StreamChatGenerics>();\n\n const { editing, quotedMessage } = useMessageInputContext<StreamChatGenerics>();\n\n const quotedEditingMessage = (\n typeof editing !== 'boolean' ? editing?.quoted_message || false : false\n ) as MessageInputContextValue<StreamChatGenerics>['quotedMessage'];\n\n const { t } = useTranslationContext();\n\n return (\n <MemoizedReply\n {...{\n FileAttachmentIcon,\n MessageAvatar,\n quotedMessage: message\n ? (message.quoted_message as MessageInputContextValue<StreamChatGenerics>['quotedMessage'])\n : quotedMessage || quotedEditingMessage,\n t,\n }}\n {...props}\n />\n );\n};\n\nReply.displayName = 'Reply{reply}';\n"]}
|
|
1
|
+
{"version":3,"sources":["Reply.tsx"],"names":["styles","StyleSheet","create","container","alignItems","flexDirection","fileAttachmentContainer","paddingLeft","paddingVertical","imageAttachment","borderRadius","height","marginLeft","marginVertical","width","messageContainer","borderBottomLeftRadius","borderBottomRightRadius","borderTopLeftRadius","borderTopRightRadius","flexGrow","flexShrink","text","fontSize","textContainer","maxWidth","undefined","paddingHorizontal","videoAttachment","getMessageType","lastAttachment","messageType","isLastAttachmentFile","type","isLastAttachmentVideo","isLastAttachmentGiphy","isLastAttachmentImageOrGiphy","title_link","og_scrape_url","isLastAttachmentImage","image_url","thumb_url","ReplyWithContext","props","FileAttachmentIcon","attachmentSize","MessageAvatar","quotedMessage","stylesProp","t","error","setError","theme","colors","blue_alice","border","grey","transparent","white","deletedText","messageSimple","content","reply","markdownStyles","attachments","slice","hasImage","onlyEmojis","emojiRegex","test","backgroundColor","borderColor","borderWidth","mime_type","uri","url","deleted_at","em","color","length","title","marginRight","Number","areEqual","prevProps","nextProps","prevQuotedMessage","nextQuotedMessage","quotedMessageEqual","id","MemoizedReply","React","memo","Reply","message","FileIconDefault","MessageAvatarDefault","editing","quotedEditingMessage","quoted_message","displayName"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AAEA;;AAIA;;AACA;;AAIA;;AAIA;;AACA;;AAKA;;AACA;;AAEA;;AACA;;AACA;;AACA;;;;;;;;;AAEA,IAAMA,MAAM,GAAGC,wBAAWC,MAAX,CAAkB;AAC/BC,EAAAA,SAAS,EAAE;AACTC,IAAAA,UAAU,EAAE,UADH;AAETC,IAAAA,aAAa,EAAE;AAFN,GADoB;AAK/BC,EAAAA,uBAAuB,EAAE;AAAEC,IAAAA,WAAW,EAAE,CAAf;AAAkBC,IAAAA,eAAe,EAAE;AAAnC,GALM;AAM/BC,EAAAA,eA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AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KADF;AAaD,CA/BM;;;AAiCPkD,KAAK,CAACO,WAAN,GAAoB,cAApB","sourcesContent":["import React, { useState } from 'react';\nimport { Image, ImageStyle, StyleSheet, View, ViewStyle } from 'react-native';\n\nimport merge from 'lodash/merge';\n\nimport type { Attachment } from 'stream-chat';\n\nimport { useMessageContext } from '../../contexts/messageContext/MessageContext';\nimport {\n MessageInputContextValue,\n useMessageInputContext,\n} from '../../contexts/messageInputContext/MessageInputContext';\nimport {\n MessagesContextValue,\n useMessagesContext,\n} from '../../contexts/messagesContext/MessagesContext';\nimport { useTheme } from '../../contexts/themeContext/ThemeContext';\nimport {\n TranslationContextValue,\n useTranslationContext,\n} from '../../contexts/translationContext/TranslationContext';\nimport type { DefaultStreamChatGenerics } from '../../types/types';\nimport { getResizedImageUrl } from '../../utils/getResizedImageUrl';\nimport { emojiRegex } from '../../utils/utils';\n\nimport { FileIcon as FileIconDefault } from '../Attachment/FileIcon';\nimport { VideoThumbnail } from '../Attachment/VideoThumbnail';\nimport { MessageAvatar as MessageAvatarDefault } from '../Message/MessageSimple/MessageAvatar';\nimport { MessageTextContainer } from '../Message/MessageSimple/MessageTextContainer';\n\nconst styles = StyleSheet.create({\n container: {\n alignItems: 'flex-end',\n flexDirection: 'row',\n },\n fileAttachmentContainer: { paddingLeft: 8, paddingVertical: 8 },\n imageAttachment: {\n borderRadius: 8,\n height: 32,\n marginLeft: 8,\n marginVertical: 8,\n width: 32,\n },\n messageContainer: {\n alignItems: 'flex-start',\n borderBottomLeftRadius: 0,\n borderBottomRightRadius: 12,\n borderTopLeftRadius: 12,\n borderTopRightRadius: 12,\n flexDirection: 'row',\n flexGrow: 1,\n flexShrink: 1,\n },\n text: { fontSize: 12 },\n textContainer: { maxWidth: undefined, paddingHorizontal: 8 },\n videoAttachment: {\n borderRadius: 8,\n height: 50,\n marginLeft: 8,\n marginVertical: 8,\n width: 50,\n },\n});\n\ntype ReplyPropsWithContext<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = Pick<MessageInputContextValue<StreamChatGenerics>, 'quotedMessage'> &\n Pick<MessagesContextValue<StreamChatGenerics>, 'FileAttachmentIcon' | 'MessageAvatar'> &\n Pick<TranslationContextValue, 't'> & {\n attachmentSize?: number;\n styles?: Partial<{\n container: ViewStyle;\n fileAttachmentContainer: ViewStyle;\n imageAttachment: ImageStyle;\n messageContainer: ViewStyle;\n textContainer: ViewStyle;\n }>;\n };\n\nconst getMessageType = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n lastAttachment: Attachment<StreamChatGenerics>,\n) => {\n let messageType;\n\n const isLastAttachmentFile = lastAttachment.type === 'file' || lastAttachment.type === 'audio';\n\n const isLastAttachmentVideo = lastAttachment.type === 'video';\n\n const isLastAttachmentGiphy =\n lastAttachment?.type === 'giphy' || lastAttachment?.type === 'imgur';\n\n const isLastAttachmentImageOrGiphy =\n lastAttachment?.type === 'image' &&\n !lastAttachment?.title_link &&\n !lastAttachment?.og_scrape_url;\n\n const isLastAttachmentImage = lastAttachment?.image_url || lastAttachment?.thumb_url;\n\n if (isLastAttachmentFile) {\n messageType = 'file';\n } else if (isLastAttachmentVideo) {\n messageType = 'video';\n } else if (isLastAttachmentImageOrGiphy) {\n if (isLastAttachmentImage) messageType = 'image';\n else messageType = undefined;\n } else if (isLastAttachmentGiphy) messageType = 'giphy';\n else messageType = 'other';\n\n return messageType;\n};\n\nconst ReplyWithContext = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n props: ReplyPropsWithContext<StreamChatGenerics>,\n) => {\n const {\n FileAttachmentIcon,\n attachmentSize = 40,\n MessageAvatar,\n quotedMessage,\n styles: stylesProp = {},\n t,\n } = props;\n\n const [error, setError] = useState(false);\n\n const {\n theme: {\n colors: { blue_alice, border, grey, transparent, white },\n messageSimple: {\n content: { deletedText },\n },\n reply: {\n container,\n fileAttachmentContainer,\n imageAttachment,\n markdownStyles,\n messageContainer,\n textContainer,\n },\n },\n } = useTheme();\n\n if (typeof quotedMessage === 'boolean') return null;\n\n const lastAttachment = quotedMessage.attachments?.slice(-1)[0] as Attachment<StreamChatGenerics>;\n const messageType = lastAttachment && getMessageType(lastAttachment);\n\n const hasImage =\n !error &&\n lastAttachment &&\n messageType !== 'file' &&\n (lastAttachment.image_url || lastAttachment.thumb_url || lastAttachment.og_scrape_url);\n\n const onlyEmojis = !lastAttachment && !!quotedMessage.text && emojiRegex.test(quotedMessage.text);\n\n return (\n <View style={[styles.container, container, stylesProp.container]}>\n <MessageAvatar alignment={'left'} lastGroupMessage message={quotedMessage} size={24} />\n <View\n style={[\n styles.messageContainer,\n {\n backgroundColor:\n messageType === 'other' ? blue_alice : messageType === 'giphy' ? transparent : white,\n borderColor: border,\n borderWidth: messageType === 'other' ? 0 : 1,\n },\n messageContainer,\n stylesProp.messageContainer,\n ]}\n >\n {!error && lastAttachment ? (\n messageType === 'file' ? (\n <View\n style={[\n styles.fileAttachmentContainer,\n fileAttachmentContainer,\n stylesProp.fileAttachmentContainer,\n ]}\n >\n <FileAttachmentIcon mimeType={lastAttachment.mime_type} size={attachmentSize} />\n </View>\n ) : hasImage ? (\n <Image\n onError={() => setError(true)}\n source={{\n uri: getResizedImageUrl({\n height:\n stylesProp.imageAttachment?.height ||\n imageAttachment?.height ||\n styles.imageAttachment.height,\n url: (lastAttachment.image_url ||\n lastAttachment.thumb_url ||\n lastAttachment.og_scrape_url) as string,\n width:\n stylesProp.imageAttachment?.width ||\n imageAttachment?.width ||\n styles.imageAttachment.width,\n }),\n }}\n style={[styles.imageAttachment, imageAttachment, stylesProp.imageAttachment]}\n />\n ) : null\n ) : null}\n {messageType === 'video' && !lastAttachment.og_scrape_url ? (\n <VideoThumbnail style={[styles.videoAttachment]} />\n ) : null}\n <MessageTextContainer<StreamChatGenerics>\n markdownStyles={\n quotedMessage.deleted_at\n ? merge({ em: { color: grey } }, deletedText)\n : { text: styles.text, ...markdownStyles }\n }\n message={{\n ...quotedMessage,\n text: quotedMessage.deleted_at\n ? `_${t('Message deleted')}_`\n : quotedMessage.text\n ? quotedMessage.text.length > 170\n ? `${quotedMessage.text.slice(0, 170)}...`\n : quotedMessage.text\n : messageType === 'image'\n ? t('Photo')\n : messageType === 'video'\n ? 'Video'\n : messageType === 'file'\n ? lastAttachment?.title || ''\n : '',\n }}\n onlyEmojis={onlyEmojis}\n styles={{\n textContainer: [\n {\n marginRight:\n hasImage || messageType === 'video'\n ? Number(\n stylesProp.imageAttachment?.height ||\n imageAttachment.height ||\n styles.imageAttachment.height,\n ) +\n Number(\n stylesProp.imageAttachment?.marginLeft ||\n imageAttachment.marginLeft ||\n styles.imageAttachment.marginLeft,\n )\n : messageType === 'file'\n ? attachmentSize +\n Number(\n stylesProp.fileAttachmentContainer?.paddingLeft ||\n fileAttachmentContainer.paddingLeft ||\n styles.fileAttachmentContainer.paddingLeft,\n )\n : undefined,\n },\n styles.textContainer,\n textContainer,\n stylesProp.textContainer,\n ],\n }}\n />\n </View>\n </View>\n );\n};\n\nconst areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(\n prevProps: ReplyPropsWithContext<StreamChatGenerics>,\n nextProps: ReplyPropsWithContext<StreamChatGenerics>,\n) => {\n const { quotedMessage: prevQuotedMessage } = prevProps;\n const { quotedMessage: nextQuotedMessage } = nextProps;\n\n const quotedMessageEqual =\n !!prevQuotedMessage &&\n !!nextQuotedMessage &&\n typeof prevQuotedMessage !== 'boolean' &&\n typeof nextQuotedMessage !== 'boolean'\n ? prevQuotedMessage.id === nextQuotedMessage.id &&\n prevQuotedMessage.deleted_at === nextQuotedMessage.deleted_at\n : !!prevQuotedMessage === !!nextQuotedMessage;\n\n if (!quotedMessageEqual) return false;\n\n return true;\n};\n\nconst MemoizedReply = React.memo(ReplyWithContext, areEqual) as typeof ReplyWithContext;\n\nexport type ReplyProps<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = Partial<ReplyPropsWithContext<StreamChatGenerics>>;\n\n/**\n * UI Component for reply\n */\nexport const Reply = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n props: ReplyProps<StreamChatGenerics>,\n) => {\n const { message } = useMessageContext<StreamChatGenerics>();\n\n const { FileAttachmentIcon = FileIconDefault, MessageAvatar = MessageAvatarDefault } =\n useMessagesContext<StreamChatGenerics>();\n\n const { editing, quotedMessage } = useMessageInputContext<StreamChatGenerics>();\n\n const quotedEditingMessage = (\n typeof editing !== 'boolean' ? editing?.quoted_message || false : false\n ) as MessageInputContextValue<StreamChatGenerics>['quotedMessage'];\n\n const { t } = useTranslationContext();\n\n return (\n <MemoizedReply\n {...{\n FileAttachmentIcon,\n MessageAvatar,\n quotedMessage: message\n ? (message.quoted_message as MessageInputContextValue<StreamChatGenerics>['quotedMessage'])\n : quotedMessage || quotedEditingMessage,\n t,\n }}\n {...props}\n />\n );\n};\n\nReply.displayName = 'Reply{reply}';\n"]}
|
|
@@ -32,7 +32,7 @@ var ActiveChannelsProvider = function ActiveChannelsProvider(_ref) {
|
|
|
32
32
|
__self: _this,
|
|
33
33
|
__source: {
|
|
34
34
|
fileName: _jsxFileName,
|
|
35
|
-
lineNumber:
|
|
35
|
+
lineNumber: 16,
|
|
36
36
|
columnNumber: 8
|
|
37
37
|
}
|
|
38
38
|
}, children);
|
|
@@ -54,7 +54,7 @@ var withActiveChannelsRefContext = function withActiveChannelsRefContext(Compone
|
|
|
54
54
|
__self: _this,
|
|
55
55
|
__source: {
|
|
56
56
|
fileName: _jsxFileName,
|
|
57
|
-
lineNumber:
|
|
57
|
+
lineNumber: 27,
|
|
58
58
|
columnNumber: 12
|
|
59
59
|
}
|
|
60
60
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ActiveChannelsRefContext.tsx"],"names":["ActiveChannelsContext","React","createContext","current","ActiveChannelsProvider","children","value","useActiveChannelsRefContext","withActiveChannelsRefContext","Component","WithActiveChannelsContextComponent","props","displayName"],"mappings":";;;;;;;;;;;AAAA;;
|
|
1
|
+
{"version":3,"sources":["ActiveChannelsRefContext.tsx"],"names":["ActiveChannelsContext","React","createContext","current","ActiveChannelsProvider","children","value","useActiveChannelsRefContext","withActiveChannelsRefContext","Component","WithActiveChannelsContextComponent","props","displayName"],"mappings":";;;;;;;;;;;AAAA;;AAIA;;;;;;;;;AAIA,IAAMA,qBAAqB,GAAGC,kBAAMC,aAAN,CAAoB;AAAEC,EAAAA,OAAO,EAAE;AAAX,CAApB,CAA9B;;AAEO,IAAMC,sBAAsB,GAAG,SAAzBA,sBAAyB;AAAA,MACpCC,QADoC,QACpCA,QADoC;AAAA,MAEpCC,KAFoC,QAEpCA,KAFoC;AAAA,SAK/B,gCAAC,qBAAD,CAAuB,QAAvB;AAAgC,IAAA,KAAK,EAAEA,KAAvC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAA+CD,QAA/C,CAL+B;AAAA,CAA/B;;;;AAOA,IAAME,2BAA2B,GAAG,SAA9BA,2BAA8B;AAAA,SACzC,uBAAWP,qBAAX,CADyC;AAAA,CAApC;;;;AAGA,IAAMQ,4BAA4B,GAAG,SAA/BA,4BAA+B,CAC1CC,SAD0C,EAEF;AACxC,MAAMC,kCAAkC,GAAG,SAArCA,kCAAqC,CAACC,KAAD,EAAsC;AAC/E,QAAMX,qBAAqB,GAAGO,2BAA2B,EAAzD;AAEA,WAAO,gCAAC,SAAD,gCAAgBI,KAAhB;AAA6B,MAAA,cAAc,EAAEX,qBAA7C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,OAAP;AACD,GAJD;;AAKAU,EAAAA,kCAAkC,CAACE,WAAnC,iCAA6E,oCAC3EH,SAD2E,CAA7E;AAGA,SAAOC,kCAAP;AACD,CAZM","sourcesContent":["import React, { PropsWithChildren, useContext } from 'react';\n\nimport type { UnknownType } from '../../types/types';\n\nimport { getDisplayName } from '../utils/getDisplayName';\n\ntype ActiveChannels = React.MutableRefObject<string[]>;\n\nconst ActiveChannelsContext = React.createContext({ current: [] } as ActiveChannels);\n\nexport const ActiveChannelsProvider = ({\n children,\n value,\n}: PropsWithChildren<{\n value: ActiveChannels;\n}>) => <ActiveChannelsContext.Provider value={value}>{children}</ActiveChannelsContext.Provider>;\n\nexport const useActiveChannelsRefContext = () =>\n useContext(ActiveChannelsContext) as unknown as ActiveChannels;\n\nexport const withActiveChannelsRefContext = <P extends UnknownType>(\n Component: React.ComponentType<P>,\n): React.FC<Omit<P, 'activeChannels'>> => {\n const WithActiveChannelsContextComponent = (props: Omit<P, 'activeChannels'>) => {\n const ActiveChannelsContext = useActiveChannelsRefContext();\n\n return <Component {...(props as P)} activeChannels={ActiveChannelsContext} />;\n };\n WithActiveChannelsContextComponent.displayName = `WithActiveChannelsContext${getDisplayName(\n Component,\n )}`;\n return WithActiveChannelsContextComponent;\n};\n"]}
|
|
@@ -13,8 +13,12 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
13
13
|
|
|
14
14
|
var _react = _interopRequireWildcard(require("react"));
|
|
15
15
|
|
|
16
|
+
var _defaultBaseContextValue = require("../utils/defaultBaseContextValue");
|
|
17
|
+
|
|
16
18
|
var _getDisplayName = require("../utils/getDisplayName");
|
|
17
19
|
|
|
20
|
+
var _isTestEnvironment = require("../utils/isTestEnvironment");
|
|
21
|
+
|
|
18
22
|
var _this = this,
|
|
19
23
|
_jsxFileName = "/home/runner/work/stream-chat-react-native/stream-chat-react-native/package/src/contexts/attachmentPickerContext/AttachmentPickerContext.tsx";
|
|
20
24
|
|
|
@@ -22,7 +26,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
22
26
|
|
|
23
27
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
24
28
|
|
|
25
|
-
var AttachmentPickerContext = _react["default"].createContext(
|
|
29
|
+
var AttachmentPickerContext = _react["default"].createContext(_defaultBaseContextValue.DEFAULT_BASE_CONTEXT_VALUE);
|
|
26
30
|
|
|
27
31
|
exports.AttachmentPickerContext = AttachmentPickerContext;
|
|
28
32
|
|
|
@@ -90,7 +94,7 @@ var AttachmentPickerProvider = function AttachmentPickerProvider(_ref) {
|
|
|
90
94
|
__self: _this,
|
|
91
95
|
__source: {
|
|
92
96
|
fileName: _jsxFileName,
|
|
93
|
-
lineNumber:
|
|
97
|
+
lineNumber: 116,
|
|
94
98
|
columnNumber: 5
|
|
95
99
|
}
|
|
96
100
|
}, children);
|
|
@@ -99,7 +103,13 @@ var AttachmentPickerProvider = function AttachmentPickerProvider(_ref) {
|
|
|
99
103
|
exports.AttachmentPickerProvider = AttachmentPickerProvider;
|
|
100
104
|
|
|
101
105
|
var useAttachmentPickerContext = function useAttachmentPickerContext() {
|
|
102
|
-
|
|
106
|
+
var contextValue = (0, _react.useContext)(AttachmentPickerContext);
|
|
107
|
+
|
|
108
|
+
if (contextValue === _defaultBaseContextValue.DEFAULT_BASE_CONTEXT_VALUE && !(0, _isTestEnvironment.isTestEnvironment)()) {
|
|
109
|
+
throw new Error("The useAttachmentPickerContext hook was called outside the AttachmentPickerContext provider. Make sure you have configured OverlayProvider component correctly - https://getstream.io/chat/docs/sdk/reactnative/basics/hello_stream_chat/#overlay-provider");
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return contextValue;
|
|
103
113
|
};
|
|
104
114
|
|
|
105
115
|
exports.useAttachmentPickerContext = useAttachmentPickerContext;
|
|
@@ -111,7 +121,7 @@ var withAttachmentPickerContext = function withAttachmentPickerContext(Component
|
|
|
111
121
|
__self: _this,
|
|
112
122
|
__source: {
|
|
113
123
|
fileName: _jsxFileName,
|
|
114
|
-
lineNumber:
|
|
124
|
+
lineNumber: 148,
|
|
115
125
|
columnNumber: 12
|
|
116
126
|
}
|
|
117
127
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["AttachmentPickerContext.tsx"],"names":["AttachmentPickerContext","React","createContext","AttachmentPickerProvider","children","value","bottomInsetValue","bottomInset","topInsetValue","topInset","setBottomInset","maxNumberOfFiles","setMaxNumberOfFiles","selectedImages","setSelectedImages","selectedFiles","setSelectedFiles","selectedPicker","setSelectedPicker","setTopInset","combinedValue","useAttachmentPickerContext","withAttachmentPickerContext","Component","WithAttachmentPickerContextComponent","props","attachmentPickerContext","displayName"],"mappings":";;;;;;;;;;;;;AAAA;;AAGA;;;;;;;;;AAsDO,IAAMA,uBAAuB,GAAGC,kBAAMC,aAAN,
|
|
1
|
+
{"version":3,"sources":["AttachmentPickerContext.tsx"],"names":["AttachmentPickerContext","React","createContext","DEFAULT_BASE_CONTEXT_VALUE","AttachmentPickerProvider","children","value","bottomInsetValue","bottomInset","topInsetValue","topInset","setBottomInset","maxNumberOfFiles","setMaxNumberOfFiles","selectedImages","setSelectedImages","selectedFiles","setSelectedFiles","selectedPicker","setSelectedPicker","setTopInset","combinedValue","useAttachmentPickerContext","contextValue","Error","withAttachmentPickerContext","Component","WithAttachmentPickerContextComponent","props","attachmentPickerContext","displayName"],"mappings":";;;;;;;;;;;;;AAAA;;AAGA;;AAEA;;AACA;;;;;;;;;AAsDO,IAAMA,uBAAuB,GAAGC,kBAAMC,aAAN,CACrCC,mDADqC,CAAhC;;;;AAIA,IAAMC,wBAA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A,cALiB;AAMjBE,IAAAA,mBAAmB,EAAnBA,mBANiB;AAOjBI,IAAAA,gBAAgB,EAAhBA,gBAPiB;AAQjBF,IAAAA,iBAAiB,EAAjBA,iBARiB;AASjBI,IAAAA,iBAAiB,EAAjBA,iBATiB;AAUjBC,IAAAA,WAAW,EAAXA;AAViB,KAWdd,KAXc;AAYjBE,IAAAA,WAAW,EAAXA,WAZiB;AAajBE,IAAAA,QAAQ,EAARA;AAbiB,IAAnB;AAgBA,SACE,gCAAC,uBAAD,CAAyB,QAAzB;AACE,IAAA,KAAK,EAAEW,aADT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAGGhB,QAHH,CADF;AAOD,CAzDM;;;;AA2DA,IAAMiB,0BAA0B,GAAG,SAA7BA,0BAA6B,GAAM;AAC9C,MAAMC,YAAY,GAAG,uBACnBvB,uBADmB,CAArB;;AAIA,MAAIuB,YAAY,KAAKpB,mDAAjB,IAA+C,CAAC,2CAApD,EAAyE;AACvE,UAAM,IAAIqB,KAAJ,8PAAN;AAGD;;AAED,SAAOD,YAAP;AACD,CAZM;;;;AAcA,IAAME,2BAA2B,GAAG,SAA9BA,2BAA8B,CAGzCC,SAHyC,EAIkC;AAC3E,MAAMC,oCAAoC,GAAG,SAAvCA,oCAAuC,CAC3CC,KAD2C,EAExC;AACH,QAAMC,uBAAuB,GAAGP,0BAA0B,EAA1D;AAEA,WAAO,gCAAC,SAAD,gCAAgBM,KAAhB,EAAkDC,uBAAlD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,OAAP;AACD,GAND;;AAOAF,EAAAA,oCAAoC,CAACG,WAArC,mCAAiF,oCAC/EJ,SAD+E,CAAjF;AAGA,SAAOC,oCAAP;AACD,CAhBM","sourcesContent":["import React, { PropsWithChildren, useContext, useEffect, useState } from 'react';\n\nimport type { Asset, DefaultStreamChatGenerics, File } from '../../types/types';\nimport { DEFAULT_BASE_CONTEXT_VALUE } from '../utils/defaultBaseContextValue';\n\nimport { getDisplayName } from '../utils/getDisplayName';\nimport { isTestEnvironment } from '../utils/isTestEnvironment';\n\nexport type AttachmentPickerIconProps = {\n numberOfImageUploads: number;\n selectedPicker?: 'images';\n};\n\nexport type AttachmentPickerContextValue = {\n /**\n * `bottomInset` determine the height of the `AttachmentPicker` and the underlying shift to the `MessageList` when it is opened.\n * This can also be set via the `setBottomInset` function provided by the `useAttachmentPickerContext` hook.\n *\n * Please check [OverlayProvider](https://github.com/GetStream/stream-chat-react-native/wiki/Cookbook-v3.0#overlayprovider) section in Cookbook\n * for more details.\n */\n bottomInset: number;\n /**\n * Custom UI component for [camera selector icon](https://github.com/GetStream/stream-chat-react-native/blob/main/screenshots/docs/1.png)\n *\n * **Default: ** [CameraSelectorIcon](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/AttachmentPicker/components/CameraSelectorIcon.tsx)\n */\n CameraSelectorIcon: React.ComponentType<AttachmentPickerIconProps>;\n closePicker: () => void;\n /**\n * Custom UI component for [file selector icon](https://github.com/GetStream/stream-chat-react-native/blob/main/screenshots/docs/1.png)\n *\n * **Default: ** [FileSelectorIcon](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/AttachmentPicker/components/FileSelectorIcon.tsx)\n */\n FileSelectorIcon: React.ComponentType<AttachmentPickerIconProps>;\n /**\n * Custom UI component for [image selector icon](https://github.com/GetStream/stream-chat-react-native/blob/main/screenshots/docs/1.png)\n *\n * **Default: ** [ImageSelectorIcon](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/AttachmentPicker/components/ImageSelectorIcon.tsx)\n */\n ImageSelectorIcon: React.ComponentType<AttachmentPickerIconProps>;\n /**\n * Limit for maximum files that can be attached per message.\n */\n maxNumberOfFiles: number;\n openPicker: () => void;\n selectedFiles: File[];\n selectedImages: Asset[];\n setBottomInset: React.Dispatch<React.SetStateAction<number>>;\n setMaxNumberOfFiles: React.Dispatch<React.SetStateAction<number>>;\n setSelectedFiles: React.Dispatch<React.SetStateAction<File[]>>;\n setSelectedImages: React.Dispatch<React.SetStateAction<Asset[]>>;\n setSelectedPicker: React.Dispatch<React.SetStateAction<'images' | undefined>>;\n setTopInset: React.Dispatch<React.SetStateAction<number>>;\n topInset: number;\n attachmentPickerBottomSheetHeight?: number;\n attachmentSelectionBarHeight?: number;\n selectedPicker?: 'images';\n};\n\nexport const AttachmentPickerContext = React.createContext(\n DEFAULT_BASE_CONTEXT_VALUE as AttachmentPickerContextValue,\n);\n\nexport const AttachmentPickerProvider = ({\n children,\n value,\n}: PropsWithChildren<{\n value?: Pick<\n AttachmentPickerContextValue,\n | 'attachmentSelectionBarHeight'\n | 'attachmentPickerBottomSheetHeight'\n | 'CameraSelectorIcon'\n | 'closePicker'\n | 'FileSelectorIcon'\n | 'ImageSelectorIcon'\n | 'openPicker'\n > &\n Partial<Pick<AttachmentPickerContextValue, 'bottomInset' | 'topInset'>>;\n}>) => {\n const bottomInsetValue = value?.bottomInset;\n const topInsetValue = value?.topInset;\n\n const [bottomInset, setBottomInset] = useState<number>(bottomInsetValue ?? 0);\n const [maxNumberOfFiles, setMaxNumberOfFiles] = useState(10);\n const [selectedImages, setSelectedImages] = useState<Asset[]>([]);\n const [selectedFiles, setSelectedFiles] = useState<File[]>([]);\n const [selectedPicker, setSelectedPicker] = useState<'images'>();\n const [topInset, setTopInset] = useState<number>(value?.topInset ?? 0);\n\n useEffect(() => {\n setBottomInset(bottomInsetValue ?? 0);\n }, [bottomInsetValue]);\n\n useEffect(() => {\n setTopInset(topInsetValue ?? 0);\n }, [topInsetValue]);\n\n const combinedValue = {\n maxNumberOfFiles,\n selectedFiles,\n selectedImages,\n selectedPicker,\n setBottomInset,\n setMaxNumberOfFiles,\n setSelectedFiles,\n setSelectedImages,\n setSelectedPicker,\n setTopInset,\n ...value,\n bottomInset,\n topInset,\n };\n\n return (\n <AttachmentPickerContext.Provider\n value={combinedValue as unknown as AttachmentPickerContextValue}\n >\n {children}\n </AttachmentPickerContext.Provider>\n );\n};\n\nexport const useAttachmentPickerContext = () => {\n const contextValue = useContext(\n AttachmentPickerContext,\n ) as unknown as AttachmentPickerContextValue;\n\n if (contextValue === DEFAULT_BASE_CONTEXT_VALUE && !isTestEnvironment()) {\n throw new Error(\n `The useAttachmentPickerContext hook was called outside the AttachmentPickerContext provider. Make sure you have configured OverlayProvider component correctly - https://getstream.io/chat/docs/sdk/reactnative/basics/hello_stream_chat/#overlay-provider`,\n );\n }\n\n return contextValue;\n};\n\nexport const withAttachmentPickerContext = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n Component: React.ComponentType<StreamChatGenerics>,\n): React.FC<Omit<StreamChatGenerics, keyof AttachmentPickerContextValue>> => {\n const WithAttachmentPickerContextComponent = (\n props: Omit<StreamChatGenerics, keyof AttachmentPickerContextValue>,\n ) => {\n const attachmentPickerContext = useAttachmentPickerContext();\n\n return <Component {...(props as StreamChatGenerics)} {...attachmentPickerContext} />;\n };\n WithAttachmentPickerContextComponent.displayName = `WithAttachmentPickerContext${getDisplayName(\n Component as React.ComponentType,\n )}`;\n return WithAttachmentPickerContextComponent;\n};\n"]}
|
|
@@ -11,8 +11,12 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
11
11
|
|
|
12
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
13
|
|
|
14
|
+
var _defaultBaseContextValue = require("../utils/defaultBaseContextValue");
|
|
15
|
+
|
|
14
16
|
var _getDisplayName = require("../utils/getDisplayName");
|
|
15
17
|
|
|
18
|
+
var _isTestEnvironment = require("../utils/isTestEnvironment");
|
|
19
|
+
|
|
16
20
|
var _this = this,
|
|
17
21
|
_jsxFileName = "/home/runner/work/stream-chat-react-native/stream-chat-react-native/package/src/contexts/channelContext/ChannelContext.tsx";
|
|
18
22
|
|
|
@@ -20,7 +24,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
20
24
|
|
|
21
25
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
22
26
|
|
|
23
|
-
var ChannelContext = _react["default"].createContext(
|
|
27
|
+
var ChannelContext = _react["default"].createContext(_defaultBaseContextValue.DEFAULT_BASE_CONTEXT_VALUE);
|
|
24
28
|
|
|
25
29
|
exports.ChannelContext = ChannelContext;
|
|
26
30
|
|
|
@@ -32,7 +36,7 @@ var ChannelProvider = function ChannelProvider(_ref) {
|
|
|
32
36
|
__self: _this,
|
|
33
37
|
__source: {
|
|
34
38
|
fileName: _jsxFileName,
|
|
35
|
-
lineNumber:
|
|
39
|
+
lineNumber: 185,
|
|
36
40
|
columnNumber: 3
|
|
37
41
|
}
|
|
38
42
|
}, children);
|
|
@@ -41,7 +45,13 @@ var ChannelProvider = function ChannelProvider(_ref) {
|
|
|
41
45
|
exports.ChannelProvider = ChannelProvider;
|
|
42
46
|
|
|
43
47
|
var useChannelContext = function useChannelContext() {
|
|
44
|
-
|
|
48
|
+
var contextValue = (0, _react.useContext)(ChannelContext);
|
|
49
|
+
|
|
50
|
+
if (contextValue === _defaultBaseContextValue.DEFAULT_BASE_CONTEXT_VALUE && !(0, _isTestEnvironment.isTestEnvironment)()) {
|
|
51
|
+
throw new Error("The useChannelContext hook was called outside of the ChannelContext provider. Make sure you have configured Channel component correctly - https://getstream.io/chat/docs/sdk/reactnative/basics/hello_stream_chat/#channel");
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return contextValue;
|
|
45
55
|
};
|
|
46
56
|
|
|
47
57
|
exports.useChannelContext = useChannelContext;
|
|
@@ -53,7 +63,7 @@ var withChannelContext = function withChannelContext(Component) {
|
|
|
53
63
|
__self: _this,
|
|
54
64
|
__source: {
|
|
55
65
|
fileName: _jsxFileName,
|
|
56
|
-
lineNumber:
|
|
66
|
+
lineNumber: 221,
|
|
57
67
|
columnNumber: 12
|
|
58
68
|
}
|
|
59
69
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ChannelContext.tsx"],"names":["ChannelContext","React","createContext","ChannelProvider","children","value","useChannelContext","withChannelContext","Component","WithChannelContextComponent","props","channelContext","displayName"],"mappings":";;;;;;;;;;;AAAA;;AAOA;;;;;;;;;AAkKO,IAAMA,cAAc,GAAGC,kBAAMC,aAAN,
|
|
1
|
+
{"version":3,"sources":["ChannelContext.tsx"],"names":["ChannelContext","React","createContext","DEFAULT_BASE_CONTEXT_VALUE","ChannelProvider","children","value","useChannelContext","contextValue","Error","withChannelContext","Component","WithChannelContextComponent","props","channelContext","displayName"],"mappings":";;;;;;;;;;;AAAA;;AAOA;;AAEA;;AACA;;;;;;;;;AAkKO,IAAMA,cAAc,GAAGC,kBAAMC,aAAN,CAC5BC,mDAD4B,CAAvB;;;;AAIA,IAAMC,eAAe,GAAG,SAAlBA,eAAkB;AAAA,MAG7BC,QAH6B,QAG7BA,QAH6B;AAAA,MAI7BC,KAJ6B,QAI7BA,KAJ6B;AAAA,SAQ7B,gCAAC,cAAD,CAAgB,QAAhB;AAAyB,IAAA,KAAK,EAAEA,KAAhC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACGD,QADH,CAR6B;AAAA,CAAxB;;;;AAaA,IAAME,iBAAiB,GAAG,SAApBA,iBAAoB,GAE1B;AACL,MAAMC,YAAY,GAAG,uBACnBR,cADmB,CAArB;;AAIA,MAAIQ,YAAY,KAAKL,mDAAjB,IAA+C,CAAC,2CAApD,EAAyE;AACvE,UAAM,IAAIM,KAAJ,8NAAN;AAGD;;AAED,SAAOD,YAAP;AACD,CAdM;;;;AAoBA,IAAME,kBAAkB,GAAG,SAArBA,kBAAqB,CAIhCC,SAJgC,EAKqC;AACrE,MAAMC,2BAA2B,GAAG,SAA9BA,2BAA8B,CAClCC,KADkC,EAE/B;AACH,QAAMC,cAAc,GAAGP,iBAAiB,EAAxC;AAEA,WAAO,gCAAC,SAAD,gCAAgBM,KAAhB,EAAiCC,cAAjC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,OAAP;AACD,GAND;;AAOAF,EAAAA,2BAA2B,CAACG,WAA5B,0BAA+D,oCAAeJ,SAAf,CAA/D;AACA,SAAOC,2BAAP;AACD,CAfM","sourcesContent":["import React, { PropsWithChildren, useContext } from 'react';\n\nimport type { Channel, ChannelState } from 'stream-chat';\n\nimport type { EmptyStateProps } from '../../components/Indicators/EmptyStateIndicator';\nimport type { LoadingProps } from '../../components/Indicators/LoadingIndicator';\nimport type { DefaultStreamChatGenerics, UnknownType } from '../../types/types';\nimport { DEFAULT_BASE_CONTEXT_VALUE } from '../utils/defaultBaseContextValue';\n\nimport { getDisplayName } from '../utils/getDisplayName';\nimport { isTestEnvironment } from '../utils/isTestEnvironment';\n\nexport type ChannelContextValue<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = {\n /**\n * Instance of channel object from stream-chat package.\n *\n * Please check the docs around how to create or query channel - https://getstream.io/chat/docs/javascript/creating_channels/?language=javascript\n *\n * ```\n * import { StreamChat, Channel } from 'stream-chat';\n * import { Chat, Channel} from 'stream-chat-react-native';\n *\n * const client = StreamChat.getInstance('api_key');\n * await client.connectUser('user_id', 'user_token');\n * const channel = client.channel('messaging', 'channel_id');\n * await channel.watch();\n *\n * <Chat client={client}>\n * <Channel channel={channel}>\n * </Channel>\n * </Chat>\n * ```\n *\n * @overrideType Channel\n */\n channel: Channel<StreamChatGenerics>;\n /**\n * Custom UI component to display empty state when channel has no messages.\n *\n * **Default** [EmptyStateIndicator](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Indicators/EmptyStateIndicator.tsx)\n */\n EmptyStateIndicator: React.ComponentType<EmptyStateProps>;\n /**\n * When set to true, reactions will be limited to 1 per user. If user selects another reaction\n * then his previous reaction will be removed and replaced with new one.\n *\n * This is similar to reaction UX on [iMessage application](https://en.wikipedia.org/wiki/IMessage).\n */\n enforceUniqueReaction: boolean;\n error: boolean | Error;\n /**\n * When set to false, it will disable giphy command on MessageInput component.\n */\n giphyEnabled: boolean;\n /**\n * Hide inline date separators on channel\n */\n hideDateSeparators: boolean;\n hideStickyDateHeader: boolean;\n /**\n * Returns true if the current user has admin privileges\n */\n isAdmin: boolean;\n /**\n * Returns true if the current user is a moderator\n */\n isModerator: boolean;\n /**\n * Returns true if the current user is a owner\n */\n isOwner: boolean;\n loadChannelAtMessage: ({\n after,\n before,\n messageId,\n }: {\n after?: number;\n before?: number;\n messageId?: string;\n }) => Promise<void>;\n loading: boolean;\n /**\n * Custom loading indicator to override the Stream default\n */\n LoadingIndicator: React.ComponentType<LoadingProps>;\n markRead: () => void;\n /**\n *\n * ```json\n * {\n * \"thierry-123\": {\n * \"id\": \"thierry-123\",\n * \"role\": \"user\",\n * \"created_at\": \"2019-04-03T14:42:47.087869Z\",\n * \"updated_at\": \"2019-04-16T09:20:03.982283Z\",\n * \"last_active\": \"2019-04-16T11:23:51.168113408+02:00\",\n * \"online\": true\n * },\n * \"vishal-123\": {\n * \"id\": \"vishal-123\",\n * \"role\": \"user\",\n * \"created_at\": \"2019-05-03T14:42:47.087869Z\",\n * \"updated_at\": \"2019-05-16T09:20:03.982283Z\",\n * \"last_active\": \"2019-06-16T11:23:51.168113408+02:00\",\n * \"online\": false\n * }\n * }\n * ```\n */\n members: ChannelState<StreamChatGenerics>['members'];\n /**\n * Custom network down indicator to override the Stream default\n */\n NetworkDownIndicator: React.ComponentType;\n read: ChannelState<StreamChatGenerics>['read'];\n reloadChannel: () => Promise<void>;\n /**\n * When true, messagelist will be scrolled to first unread message, when opened.\n */\n scrollToFirstUnreadThreshold: number;\n setLastRead: React.Dispatch<React.SetStateAction<Date | undefined>>;\n setTargetedMessage: (messageId: string) => void;\n /**\n *\n * ```json\n * {\n * \"thierry-123\": {\n * \"id\": \"thierry-123\",\n * \"role\": \"user\",\n * \"created_at\": \"2019-04-03T14:42:47.087869Z\",\n * \"updated_at\": \"2019-04-16T09:20:03.982283Z\",\n * \"last_active\": \"2019-04-16T11:23:51.168113408+02:00\",\n * \"online\": true\n * },\n * \"vishal-123\": {\n * \"id\": \"vishal-123\",\n * \"role\": \"user\",\n * \"created_at\": \"2019-05-03T14:42:47.087869Z\",\n * \"updated_at\": \"2019-05-16T09:20:03.982283Z\",\n * \"last_active\": \"2019-06-16T11:23:51.168113408+02:00\",\n * \"online\": false\n * }\n * }\n * ```\n */\n watchers: ChannelState<StreamChatGenerics>['watchers'];\n disabled?: boolean;\n enableMessageGroupingByUser?: boolean;\n isChannelActive?: boolean;\n lastRead?: Date;\n /**\n * Maximum time in milliseconds that should occur between messages\n * to still consider them grouped together\n */\n maxTimeBetweenGroupedMessages?: number;\n /**\n * Custom UI component for sticky header of channel.\n *\n * **Default** [DateHeader](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/MessageList/DateHeader.tsx)\n */\n StickyHeader?: React.ComponentType<{ dateString: string }>;\n /**\n * Id of message, around which Channel/MessageList gets loaded when opened.\n * You will see a highlighted background for targetted message, when opened.\n */\n targetedMessage?: string;\n threadList?: boolean;\n watcherCount?: ChannelState<StreamChatGenerics>['watcher_count'];\n};\n\nexport const ChannelContext = React.createContext(\n DEFAULT_BASE_CONTEXT_VALUE as ChannelContextValue,\n);\n\nexport const ChannelProvider = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>({\n children,\n value,\n}: PropsWithChildren<{\n value: ChannelContextValue<StreamChatGenerics>;\n}>) => (\n <ChannelContext.Provider value={value as unknown as ChannelContextValue}>\n {children}\n </ChannelContext.Provider>\n);\n\nexport const useChannelContext = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>() => {\n const contextValue = useContext(\n ChannelContext,\n ) as unknown as ChannelContextValue<StreamChatGenerics>;\n\n if (contextValue === DEFAULT_BASE_CONTEXT_VALUE && !isTestEnvironment()) {\n throw new Error(\n `The useChannelContext hook was called outside of the ChannelContext provider. Make sure you have configured Channel component correctly - https://getstream.io/chat/docs/sdk/reactnative/basics/hello_stream_chat/#channel`,\n );\n }\n\n return contextValue;\n};\n/**\n * Typescript currently does not support partial inference so if ChatContext\n * typing is desired while using the HOC withChannelContext the Props for the\n * wrapped component must be provided as the first generic.\n */\nexport const withChannelContext = <\n P extends UnknownType,\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n Component: React.ComponentType<P>,\n): React.FC<Omit<P, keyof ChannelContextValue<StreamChatGenerics>>> => {\n const WithChannelContextComponent = (\n props: Omit<P, keyof ChannelContextValue<StreamChatGenerics>>,\n ) => {\n const channelContext = useChannelContext<StreamChatGenerics>();\n\n return <Component {...(props as P)} {...channelContext} />;\n };\n WithChannelContextComponent.displayName = `WithChannelContext${getDisplayName(Component)}`;\n return WithChannelContextComponent;\n};\n"]}
|
|
@@ -11,8 +11,12 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
11
11
|
|
|
12
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
13
|
|
|
14
|
+
var _defaultBaseContextValue = require("../utils/defaultBaseContextValue");
|
|
15
|
+
|
|
14
16
|
var _getDisplayName = require("../utils/getDisplayName");
|
|
15
17
|
|
|
18
|
+
var _isTestEnvironment = require("../utils/isTestEnvironment");
|
|
19
|
+
|
|
16
20
|
var _this = this,
|
|
17
21
|
_jsxFileName = "/home/runner/work/stream-chat-react-native/stream-chat-react-native/package/src/contexts/channelsContext/ChannelsContext.tsx";
|
|
18
22
|
|
|
@@ -20,7 +24,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
20
24
|
|
|
21
25
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
22
26
|
|
|
23
|
-
var ChannelsContext = _react["default"].createContext(
|
|
27
|
+
var ChannelsContext = _react["default"].createContext(_defaultBaseContextValue.DEFAULT_BASE_CONTEXT_VALUE);
|
|
24
28
|
|
|
25
29
|
exports.ChannelsContext = ChannelsContext;
|
|
26
30
|
|
|
@@ -32,7 +36,7 @@ var ChannelsProvider = function ChannelsProvider(_ref) {
|
|
|
32
36
|
__self: _this,
|
|
33
37
|
__source: {
|
|
34
38
|
fileName: _jsxFileName,
|
|
35
|
-
lineNumber:
|
|
39
|
+
lineNumber: 225,
|
|
36
40
|
columnNumber: 3
|
|
37
41
|
}
|
|
38
42
|
}, children);
|
|
@@ -41,7 +45,13 @@ var ChannelsProvider = function ChannelsProvider(_ref) {
|
|
|
41
45
|
exports.ChannelsProvider = ChannelsProvider;
|
|
42
46
|
|
|
43
47
|
var useChannelsContext = function useChannelsContext() {
|
|
44
|
-
|
|
48
|
+
var contextValue = (0, _react.useContext)(ChannelsContext);
|
|
49
|
+
|
|
50
|
+
if (contextValue === _defaultBaseContextValue.DEFAULT_BASE_CONTEXT_VALUE && !(0, _isTestEnvironment.isTestEnvironment)()) {
|
|
51
|
+
throw new Error("The useChannelsContext hook was called outside of the ChannelsContext provider. Make sure you have configured ChannelList component correctly - https://getstream.io/chat/docs/sdk/reactnative/basics/hello_stream_chat/#channel-list");
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return contextValue;
|
|
45
55
|
};
|
|
46
56
|
|
|
47
57
|
exports.useChannelsContext = useChannelsContext;
|
|
@@ -53,7 +63,7 @@ var withChannelsContext = function withChannelsContext(Component) {
|
|
|
53
63
|
__self: _this,
|
|
54
64
|
__source: {
|
|
55
65
|
fileName: _jsxFileName,
|
|
56
|
-
lineNumber:
|
|
66
|
+
lineNumber: 261,
|
|
57
67
|
columnNumber: 12
|
|
58
68
|
}
|
|
59
69
|
}));
|