stream-chat-react-native-core 4.12.0-beta.4 → 4.12.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/AudioAttachment.js +27 -56
- package/lib/commonjs/components/Attachment/AudioAttachment.js.map +1 -1
- package/lib/commonjs/components/Attachment/FileAttachmentGroup.js +31 -14
- package/lib/commonjs/components/Attachment/FileAttachmentGroup.js.map +1 -1
- package/lib/commonjs/components/Channel/Channel.js +14 -14
- package/lib/commonjs/components/Channel/Channel.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js +0 -2
- package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.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/MessageInput/FileUploadPreview.js +31 -16
- package/lib/commonjs/components/MessageInput/FileUploadPreview.js.map +1 -1
- package/lib/commonjs/components/MessageOverlay/MessageOverlay.js +10 -9
- package/lib/commonjs/components/MessageOverlay/MessageOverlay.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js +2 -2
- package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +0 -2
- package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.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/AudioAttachment.js +27 -56
- package/lib/module/components/Attachment/AudioAttachment.js.map +1 -1
- package/lib/module/components/Attachment/FileAttachmentGroup.js +31 -14
- package/lib/module/components/Attachment/FileAttachmentGroup.js.map +1 -1
- package/lib/module/components/Channel/Channel.js +14 -14
- package/lib/module/components/Channel/Channel.js.map +1 -1
- package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js +0 -2
- package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.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/MessageInput/FileUploadPreview.js +31 -16
- package/lib/module/components/MessageInput/FileUploadPreview.js.map +1 -1
- package/lib/module/components/MessageOverlay/MessageOverlay.js +10 -9
- package/lib/module/components/MessageOverlay/MessageOverlay.js.map +1 -1
- package/lib/module/contexts/messageInputContext/MessageInputContext.js +2 -2
- package/lib/module/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +0 -2
- package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.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/AudioAttachment.d.ts +4 -7
- package/lib/typescript/components/Attachment/FileAttachmentGroup.d.ts +1 -2
- package/lib/typescript/components/Channel/Channel.d.ts +1 -1
- package/lib/typescript/components/Channel/hooks/useCreateInputMessageInputContext.d.ts +1 -1
- package/lib/typescript/components/Channel/hooks/useCreateMessagesContext.d.ts +1 -1
- package/lib/typescript/components/MessageInput/FileUploadPreview.d.ts +1 -1
- package/lib/typescript/contexts/messageContext/MessageContext.d.ts +1 -1
- package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts +1 -4
- package/lib/typescript/contexts/messageInputContext/hooks/useCreateMessageInputContext.d.ts +1 -1
- package/lib/typescript/contexts/messagesContext/MessagesContext.d.ts +3 -0
- package/package.json +1 -1
- package/src/components/Attachment/AudioAttachment.tsx +72 -116
- package/src/components/Attachment/FileAttachmentGroup.tsx +32 -11
- package/src/components/Channel/Channel.tsx +2 -1
- package/src/components/Channel/hooks/useCreateInputMessageInputContext.ts +0 -2
- package/src/components/Channel/hooks/useCreateMessagesContext.ts +2 -0
- package/src/components/MessageInput/FileUploadPreview.tsx +29 -12
- package/src/components/MessageInput/__tests__/AudioAttachmentUploadPreviewExpo.test.tsx +13 -3
- package/src/components/MessageInput/__tests__/AudioAttachmentUploadPreviewNative.test.tsx +13 -3
- package/src/components/MessageOverlay/MessageOverlay.tsx +1 -0
- package/src/contexts/messageInputContext/MessageInputContext.tsx +0 -4
- package/src/contexts/messageInputContext/hooks/useCreateMessageInputContext.ts +0 -2
- package/src/contexts/messagesContext/MessagesContext.tsx +3 -0
- package/src/version.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useCreateMessageInputContext.ts"],"names":["useCreateMessageInputContext","additionalTextInputProps","appendText","asyncIds","asyncUploads","AttachButton","AudioAttachment","autoCompleteSuggestionsLimit","clearEditingState","clearQuotedMessageState","closeAttachmentPicker","CommandsButton","compressImageQuality","cooldownEndsAt","CooldownTimer","doDocUploadRequest","doImageUploadRequest","editing","editMessage","FileUploadPreview","fileUploads","giphyActive","hasCommands","hasFilePicker","hasImagePicker","ImageUploadPreview","imageUploads","initialValue","Input","inputBoxRef","InputButtons","InputEditingStateHeader","InputGiphySearch","InputReplyStateHeader","isValidMessage","maxMessageLength","maxNumberOfFiles","mentionAllAppUsersEnabled","mentionAllAppUsersQuery","mentionedUsers","MoreOptionsButton","numberOfLines","numberOfUploads","onChange","onChangeText","onSelectItem","openAttachmentPicker","openCommandsPicker","openFilePicker","openMentionsPicker","pickFile","quotedMessage","removeFile","removeImage","resetInput","selectedPicker","SendButton","sendImageAsync","sending","sendMessage","sendMessageAsync","SendMessageDisallowedIndicator","sendThreadMessageInChannel","setAsyncIds","setAsyncUploads","setFileUploads","setGiphyActive","setImageUploads","setInputBoxRef","setInputRef","setMentionedUsers","setNumberOfUploads","setQuotedMessageState","setSendThreadMessageInChannel","setShowMoreOptions","setText","showMoreOptions","ShowThreadMessageInChannelButton","text","thread","toggleAttachmentPicker","triggerSettings","updateMessage","uploadFile","uploadImage","uploadNewFile","uploadNewImage","UploadProgressIndicator","editingExists","fileUploadsValue","map","duration","paused","progress","state","join","imageUploadsValue","mentionedUsersLength","length","quotedMessageId","id","threadId","messageInputContext"],"mappings":";;;;;AAAA;;AAMO,IAAMA,4BAA4B,GAAG,SAA/BA,4BAA+B,OA2FiB;AAAA,MAxF3DC,wBAwF2D,QAxF3DA,wBAwF2D;AAAA,MAvF3DC,UAuF2D,QAvF3DA,UAuF2D;AAAA,MAtF3DC,QAsF2D,QAtF3DA,QAsF2D;AAAA,MArF3DC,YAqF2D,QArF3DA,YAqF2D;AAAA,MApF3DC,YAoF2D,QApF3DA,YAoF2D;AAAA,MAnF3DC,eAmF2D,QAnF3DA,eAmF2D;AAAA,MAlF3DC,4BAkF2D,QAlF3DA,4BAkF2D;AAAA,MAjF3DC,iBAiF2D,QAjF3DA,iBAiF2D;AAAA,MAhF3DC,uBAgF2D,QAhF3DA,uBAgF2D;AAAA,MA/E3DC,qBA+E2D,QA/E3DA,qBA+E2D;AAAA,MA9E3DC,cA8E2D,QA9E3DA,cA8E2D;AAAA,MA7E3DC,oBA6E2D,QA7E3DA,oBA6E2D;AAAA,MA5E3DC,cA4E2D,QA5E3DA,cA4E2D;AAAA,MA3E3DC,aA2E2D,QA3E3DA,aA2E2D;AAAA,MA1E3DC,kBA0E2D,QA1E3DA,kBA0E2D;AAAA,MAzE3DC,oBAyE2D,QAzE3DA,oBAyE2D;AAAA,MAxE3DC,OAwE2D,QAxE3DA,OAwE2D;AAAA,MAvE3DC,WAuE2D,QAvE3DA,WAuE2D;AAAA,MAtE3DC,iBAsE2D,QAtE3DA,iBAsE2D;AAAA,MArE3DC,WAqE2D,QArE3DA,WAqE2D;AAAA,MApE3DC,WAoE2D,QApE3DA,WAoE2D;AAAA,MAnE3DC,WAmE2D,QAnE3DA,WAmE2D;AAAA,MA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6BAzEK;AA0ELC,MAAAA,kBAAkB,EAAlBA,kBA1EK;AA2ELC,MAAAA,OAAO,EAAPA,OA3EK;AA4ELC,MAAAA,eAAe,EAAfA,eA5EK;AA6ELC,MAAAA,gCAAgC,EAAhCA,gCA7EK;AA8ELC,MAAAA,IAAI,EAAJA,IA9EK;AA+ELE,MAAAA,sBAAsB,EAAtBA,sBA/EK;AAgFLC,MAAAA,eAAe,EAAfA,eAhFK;AAiFLC,MAAAA,aAAa,EAAbA,aAjFK;AAkFLC,MAAAA,UAAU,EAAVA,UAlFK;AAmFLC,MAAAA,WAAW,EAAXA,WAnFK;AAoFLC,MAAAA,aAAa,EAAbA,aApFK;AAqFLC,MAAAA,cAAc,EAAdA,cArFK;AAsFLC,MAAAA,uBAAuB,EAAvBA;AAtFK,KAAP;AAAA,GADwE,EAyFxE,CACE1E,cADF,EAEE2E,aAFF,EAGEC,gBAHF,EAIEpE,WAJF,EAKE2E,iBALF,EAME7D,gBANF,EAOE8D,oBAPF,EAQEE,eARF,EASE5C,cATF,EAUEO,0BAVF,EAWEc,eAXF,EAYEE,IAZF,EAaEuB,QAbF,CAzFwE,CAA1E;AA0GA,SAAOC,mBAAP;AACD,CApNM","sourcesContent":["import { useMemo } from 'react';\n\nimport type { DefaultStreamChatGenerics } from '../../../types/types';\nimport type { ThreadContextValue } from '../../threadContext/ThreadContext';\nimport type { MessageInputContextValue } from '../MessageInputContext';\n\nexport const useCreateMessageInputContext = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>({\n additionalTextInputProps,\n appendText,\n asyncIds,\n asyncUploads,\n AttachButton,\n AudioAttachment,\n autoCompleteSuggestionsLimit,\n clearEditingState,\n clearQuotedMessageState,\n closeAttachmentPicker,\n CommandsButton,\n compressImageQuality,\n cooldownEndsAt,\n CooldownTimer,\n doDocUploadRequest,\n doImageUploadRequest,\n editing,\n editMessage,\n FileUploadPreview,\n fileUploads,\n giphyActive,\n hasCommands,\n hasFilePicker,\n hasImagePicker,\n ImageUploadPreview,\n imageUploads,\n initialValue,\n Input,\n inputBoxRef,\n InputButtons,\n InputEditingStateHeader,\n InputGiphySearch,\n InputReplyStateHeader,\n isValidMessage,\n maxMessageLength,\n maxNumberOfFiles,\n mentionAllAppUsersEnabled,\n mentionAllAppUsersQuery,\n mentionedUsers,\n MoreOptionsButton,\n numberOfLines,\n numberOfUploads,\n onChange,\n onChangeText,\n onSelectItem,\n openAttachmentPicker,\n openCommandsPicker,\n openFilePicker,\n openMentionsPicker,\n pickFile,\n quotedMessage,\n removeFile,\n removeImage,\n resetInput,\n selectedPicker,\n SendButton,\n sendImageAsync,\n sending,\n sendMessage,\n sendMessageAsync,\n SendMessageDisallowedIndicator,\n sendThreadMessageInChannel,\n setAsyncIds,\n setAsyncUploads,\n setFileUploads,\n setGiphyActive,\n setImageUploads,\n setInputBoxRef,\n setInputRef,\n setMentionedUsers,\n setNumberOfUploads,\n setQuotedMessageState,\n setSendThreadMessageInChannel,\n setShowMoreOptions,\n setText,\n showMoreOptions,\n ShowThreadMessageInChannelButton,\n text,\n thread,\n toggleAttachmentPicker,\n triggerSettings,\n updateMessage,\n uploadFile,\n uploadImage,\n uploadNewFile,\n uploadNewImage,\n UploadProgressIndicator,\n}: MessageInputContextValue<StreamChatGenerics> &\n Pick<ThreadContextValue<StreamChatGenerics>, 'thread'>) => {\n const editingExists = !!editing;\n const fileUploadsValue = fileUploads\n .map(({ duration, paused, progress, state }) => `${state},${paused},${progress},${duration}`)\n .join();\n const imageUploadsValue = imageUploads.map(({ state }) => state).join();\n const mentionedUsersLength = mentionedUsers.length;\n const quotedMessageId = quotedMessage\n ? typeof quotedMessage === 'boolean'\n ? ''\n : quotedMessage.id\n : '';\n const threadId = thread?.id;\n\n const messageInputContext: MessageInputContextValue<StreamChatGenerics> = useMemo(\n () => ({\n additionalTextInputProps,\n appendText,\n asyncIds,\n asyncUploads,\n AttachButton,\n AudioAttachment,\n autoCompleteSuggestionsLimit,\n clearEditingState,\n clearQuotedMessageState,\n closeAttachmentPicker,\n CommandsButton,\n compressImageQuality,\n cooldownEndsAt,\n CooldownTimer,\n doDocUploadRequest,\n doImageUploadRequest,\n editing,\n editMessage,\n FileUploadPreview,\n fileUploads,\n giphyActive,\n hasCommands,\n hasFilePicker,\n hasImagePicker,\n ImageUploadPreview,\n imageUploads,\n initialValue,\n Input,\n inputBoxRef,\n InputButtons,\n InputEditingStateHeader,\n InputGiphySearch,\n InputReplyStateHeader,\n isValidMessage,\n maxMessageLength,\n maxNumberOfFiles,\n mentionAllAppUsersEnabled,\n mentionAllAppUsersQuery,\n mentionedUsers,\n MoreOptionsButton,\n numberOfLines,\n numberOfUploads,\n onChange,\n onChangeText,\n onSelectItem,\n openAttachmentPicker,\n openCommandsPicker,\n openFilePicker,\n openMentionsPicker,\n pickFile,\n quotedMessage,\n removeFile,\n removeImage,\n resetInput,\n selectedPicker,\n SendButton,\n sendImageAsync,\n sending,\n sendMessage,\n sendMessageAsync,\n SendMessageDisallowedIndicator,\n sendThreadMessageInChannel,\n setAsyncIds,\n setAsyncUploads,\n setFileUploads,\n setGiphyActive,\n setImageUploads,\n setInputBoxRef,\n setInputRef,\n setMentionedUsers,\n setNumberOfUploads,\n setQuotedMessageState,\n setSendThreadMessageInChannel,\n setShowMoreOptions,\n setText,\n showMoreOptions,\n ShowThreadMessageInChannelButton,\n text,\n toggleAttachmentPicker,\n triggerSettings,\n updateMessage,\n uploadFile,\n uploadImage,\n uploadNewFile,\n uploadNewImage,\n UploadProgressIndicator,\n }),\n [\n cooldownEndsAt,\n editingExists,\n fileUploadsValue,\n giphyActive,\n imageUploadsValue,\n maxMessageLength,\n mentionedUsersLength,\n quotedMessageId,\n selectedPicker,\n sendThreadMessageInChannel,\n showMoreOptions,\n text,\n threadId,\n ],\n );\n\n return messageInputContext;\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["useCreateMessageInputContext.ts"],"names":["useCreateMessageInputContext","additionalTextInputProps","appendText","asyncIds","asyncUploads","AttachButton","autoCompleteSuggestionsLimit","clearEditingState","clearQuotedMessageState","closeAttachmentPicker","CommandsButton","compressImageQuality","cooldownEndsAt","CooldownTimer","doDocUploadRequest","doImageUploadRequest","editing","editMessage","FileUploadPreview","fileUploads","giphyActive","hasCommands","hasFilePicker","hasImagePicker","ImageUploadPreview","imageUploads","initialValue","Input","inputBoxRef","InputButtons","InputEditingStateHeader","InputGiphySearch","InputReplyStateHeader","isValidMessage","maxMessageLength","maxNumberOfFiles","mentionAllAppUsersEnabled","mentionAllAppUsersQuery","mentionedUsers","MoreOptionsButton","numberOfLines","numberOfUploads","onChange","onChangeText","onSelectItem","openAttachmentPicker","openCommandsPicker","openFilePicker","openMentionsPicker","pickFile","quotedMessage","removeFile","removeImage","resetInput","selectedPicker","SendButton","sendImageAsync","sending","sendMessage","sendMessageAsync","SendMessageDisallowedIndicator","sendThreadMessageInChannel","setAsyncIds","setAsyncUploads","setFileUploads","setGiphyActive","setImageUploads","setInputBoxRef","setInputRef","setMentionedUsers","setNumberOfUploads","setQuotedMessageState","setSendThreadMessageInChannel","setShowMoreOptions","setText","showMoreOptions","ShowThreadMessageInChannelButton","text","thread","toggleAttachmentPicker","triggerSettings","updateMessage","uploadFile","uploadImage","uploadNewFile","uploadNewImage","UploadProgressIndicator","editingExists","fileUploadsValue","map","duration","paused","progress","state","join","imageUploadsValue","mentionedUsersLength","length","quotedMessageId","id","threadId","messageInputContext"],"mappings":";;;;;AAAA;;AAMO,IAAMA,4BAA4B,GAAG,SAA/BA,4BAA+B,OA0FiB;AAAA,MAvF3DC,wBAuF2D,QAvF3DA,wBAuF2D;AAAA,MAtF3DC,UAsF2D,QAtF3DA,UAsF2D;AAAA,MArF3DC,QAqF2D,QArF3DA,QAqF2D;AAAA,MApF3DC,YAoF2D,QApF3DA,YAoF2D;AAAA,MAnF3DC,YAmF2D,QAnF3DA,YAmF2D;AAAA,MAlF3DC,4BAkF2D,QAlF3DA,4BAkF2D;AAAA,MAjF3DC,iBAiF2D,QAjF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EO,0BAVF,EAWEc,eAXF,EAYEE,IAZF,EAaEuB,QAbF,CAxFwE,CAA1E;AAyGA,SAAOC,mBAAP;AACD,CAlNM","sourcesContent":["import { useMemo } from 'react';\n\nimport type { DefaultStreamChatGenerics } from '../../../types/types';\nimport type { ThreadContextValue } from '../../threadContext/ThreadContext';\nimport type { MessageInputContextValue } from '../MessageInputContext';\n\nexport const useCreateMessageInputContext = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>({\n additionalTextInputProps,\n appendText,\n asyncIds,\n asyncUploads,\n AttachButton,\n autoCompleteSuggestionsLimit,\n clearEditingState,\n clearQuotedMessageState,\n closeAttachmentPicker,\n CommandsButton,\n compressImageQuality,\n cooldownEndsAt,\n CooldownTimer,\n doDocUploadRequest,\n doImageUploadRequest,\n editing,\n editMessage,\n FileUploadPreview,\n fileUploads,\n giphyActive,\n hasCommands,\n hasFilePicker,\n hasImagePicker,\n ImageUploadPreview,\n imageUploads,\n initialValue,\n Input,\n inputBoxRef,\n InputButtons,\n InputEditingStateHeader,\n InputGiphySearch,\n InputReplyStateHeader,\n isValidMessage,\n maxMessageLength,\n maxNumberOfFiles,\n mentionAllAppUsersEnabled,\n mentionAllAppUsersQuery,\n mentionedUsers,\n MoreOptionsButton,\n numberOfLines,\n numberOfUploads,\n onChange,\n onChangeText,\n onSelectItem,\n openAttachmentPicker,\n openCommandsPicker,\n openFilePicker,\n openMentionsPicker,\n pickFile,\n quotedMessage,\n removeFile,\n removeImage,\n resetInput,\n selectedPicker,\n SendButton,\n sendImageAsync,\n sending,\n sendMessage,\n sendMessageAsync,\n SendMessageDisallowedIndicator,\n sendThreadMessageInChannel,\n setAsyncIds,\n setAsyncUploads,\n setFileUploads,\n setGiphyActive,\n setImageUploads,\n setInputBoxRef,\n setInputRef,\n setMentionedUsers,\n setNumberOfUploads,\n setQuotedMessageState,\n setSendThreadMessageInChannel,\n setShowMoreOptions,\n setText,\n showMoreOptions,\n ShowThreadMessageInChannelButton,\n text,\n thread,\n toggleAttachmentPicker,\n triggerSettings,\n updateMessage,\n uploadFile,\n uploadImage,\n uploadNewFile,\n uploadNewImage,\n UploadProgressIndicator,\n}: MessageInputContextValue<StreamChatGenerics> &\n Pick<ThreadContextValue<StreamChatGenerics>, 'thread'>) => {\n const editingExists = !!editing;\n const fileUploadsValue = fileUploads\n .map(({ duration, paused, progress, state }) => `${state},${paused},${progress},${duration}`)\n .join();\n const imageUploadsValue = imageUploads.map(({ state }) => state).join();\n const mentionedUsersLength = mentionedUsers.length;\n const quotedMessageId = quotedMessage\n ? typeof quotedMessage === 'boolean'\n ? ''\n : quotedMessage.id\n : '';\n const threadId = thread?.id;\n\n const messageInputContext: MessageInputContextValue<StreamChatGenerics> = useMemo(\n () => ({\n additionalTextInputProps,\n appendText,\n asyncIds,\n asyncUploads,\n AttachButton,\n autoCompleteSuggestionsLimit,\n clearEditingState,\n clearQuotedMessageState,\n closeAttachmentPicker,\n CommandsButton,\n compressImageQuality,\n cooldownEndsAt,\n CooldownTimer,\n doDocUploadRequest,\n doImageUploadRequest,\n editing,\n editMessage,\n FileUploadPreview,\n fileUploads,\n giphyActive,\n hasCommands,\n hasFilePicker,\n hasImagePicker,\n ImageUploadPreview,\n imageUploads,\n initialValue,\n Input,\n inputBoxRef,\n InputButtons,\n InputEditingStateHeader,\n InputGiphySearch,\n InputReplyStateHeader,\n isValidMessage,\n maxMessageLength,\n maxNumberOfFiles,\n mentionAllAppUsersEnabled,\n mentionAllAppUsersQuery,\n mentionedUsers,\n MoreOptionsButton,\n numberOfLines,\n numberOfUploads,\n onChange,\n onChangeText,\n onSelectItem,\n openAttachmentPicker,\n openCommandsPicker,\n openFilePicker,\n openMentionsPicker,\n pickFile,\n quotedMessage,\n removeFile,\n removeImage,\n resetInput,\n selectedPicker,\n SendButton,\n sendImageAsync,\n sending,\n sendMessage,\n sendMessageAsync,\n SendMessageDisallowedIndicator,\n sendThreadMessageInChannel,\n setAsyncIds,\n setAsyncUploads,\n setFileUploads,\n setGiphyActive,\n setImageUploads,\n setInputBoxRef,\n setInputRef,\n setMentionedUsers,\n setNumberOfUploads,\n setQuotedMessageState,\n setSendThreadMessageInChannel,\n setShowMoreOptions,\n setText,\n showMoreOptions,\n ShowThreadMessageInChannelButton,\n text,\n toggleAttachmentPicker,\n triggerSettings,\n updateMessage,\n uploadFile,\n uploadImage,\n uploadNewFile,\n uploadNewImage,\n UploadProgressIndicator,\n }),\n [\n cooldownEndsAt,\n editingExists,\n fileUploadsValue,\n giphyActive,\n imageUploadsValue,\n maxMessageLength,\n mentionedUsersLength,\n quotedMessageId,\n selectedPicker,\n sendThreadMessageInChannel,\n showMoreOptions,\n text,\n threadId,\n ],\n );\n\n return messageInputContext;\n};\n"]}
|
|
@@ -36,7 +36,7 @@ var MessagesProvider = function MessagesProvider(_ref) {
|
|
|
36
36
|
__self: _this,
|
|
37
37
|
__source: {
|
|
38
38
|
fileName: _jsxFileName,
|
|
39
|
-
lineNumber:
|
|
39
|
+
lineNumber: 498,
|
|
40
40
|
columnNumber: 3
|
|
41
41
|
}
|
|
42
42
|
}, children);
|
|
@@ -63,7 +63,7 @@ var withMessagesContext = function withMessagesContext(Component) {
|
|
|
63
63
|
__self: _this,
|
|
64
64
|
__source: {
|
|
65
65
|
fileName: _jsxFileName,
|
|
66
|
-
lineNumber:
|
|
66
|
+
lineNumber: 535,
|
|
67
67
|
columnNumber: 12
|
|
68
68
|
}
|
|
69
69
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["MessagesContext.tsx"],"names":["MessagesContext","React","createContext","DEFAULT_BASE_CONTEXT_VALUE","MessagesProvider","children","value","useMessagesContext","contextValue","Error","withMessagesContext","Component","WithMessagesContextComponent","props","messagesContext","displayName"],"mappings":";;;;;;;;;;;AAAA;;AAsDA;;AAEA;;AACA;;;;;;;;;AAyaO,IAAMA,eAAe,GAAGC,kBAAMC,aAAN,CAC7BC,mDAD6B,CAAxB;;;;AAIA,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAmB;AAAA,MAG9BC,QAH8B,QAG9BA,QAH8B;AAAA,MAI9BC,KAJ8B,QAI9BA,KAJ8B;AAAA,SAQ9B,gCAAC,eAAD,CAAiB,QAAjB;AAA0B,IAAA,KAAK,EAAEA,KAAjC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACGD,QADH,CAR8B;AAAA,CAAzB;;;;AAaA,IAAME,kBAAkB,GAAG,SAArBA,kBAAqB,GAE3B;AACL,MAAMC,YAAY,GAAG,uBACnBR,eADmB,CAArB;;AAIA,MAAIQ,YAAY,KAAKL,mDAAjB,IAA+C,CAAC,2CAApD,EAAyE;AACvE,UAAM,IAAIM,KAAJ,yOAAN;AAGD;;AAED,SAAOD,YAAP;AACD,CAdM;;;;AAqBA,IAAME,mBAAmB,GAAG,SAAtBA,mBAAsB,CAIjCC,SAJiC,EAKqC;AACtE,MAAMC,4BAA4B,GAAG,SAA/BA,4BAA+B,CACnCC,KADmC,EAEhC;AACH,QAAMC,eAAe,GAAGP,kBAAkB,EAA1C;AAEA,WAAO,gCAAC,SAAD,gCAAgBM,KAAhB,EAAiCC,eAAjC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,OAAP;AACD,GAND;;AAOAF,EAAAA,4BAA4B,CAACG,WAA7B,2BAAiE,oCAAeJ,SAAf,CAAjE;AACA,SAAOC,4BAAP;AACD,CAfM","sourcesContent":["import React, { PropsWithChildren, useContext } from 'react';\n\nimport type { TouchableOpacityProps } from 'react-native';\n\nimport type { ImageLoadingFailedIndicatorProps } from 'src/components/Attachment/ImageLoadingFailedIndicator';\nimport type { ImageLoadingIndicatorProps } from 'src/components/Attachment/ImageLoadingIndicator';\n\nimport type { MessagePinnedHeaderProps } from 'src/components/Message/MessageSimple/MessagePinnedHeader';\n\nimport type { Attachment, ChannelState, MessageResponse } from 'stream-chat';\n\nimport type { AttachmentProps } from '../../components/Attachment/Attachment';\nimport type { AttachmentActionsProps } from '../../components/Attachment/AttachmentActions';\nimport type { CardProps } from '../../components/Attachment/Card';\nimport type { FileAttachmentProps } from '../../components/Attachment/FileAttachment';\nimport type { FileAttachmentGroupProps } from '../../components/Attachment/FileAttachmentGroup';\nimport type { FileIconProps } from '../../components/Attachment/FileIcon';\nimport type { GalleryProps } from '../../components/Attachment/Gallery';\nimport type { GiphyProps } from '../../components/Attachment/Giphy';\nimport type { VideoThumbnailProps } from '../../components/Attachment/VideoThumbnail';\nimport type {\n MessageProps,\n MessageTouchableHandlerPayload,\n} from '../../components/Message/Message';\nimport type { MessageAvatarProps } from '../../components/Message/MessageSimple/MessageAvatar';\nimport type { MessageContentProps } from '../../components/Message/MessageSimple/MessageContent';\nimport type { MessageDeletedProps } from '../../components/Message/MessageSimple/MessageDeleted';\nimport type { MessageFooterProps } from '../../components/Message/MessageSimple/MessageFooter';\n\nimport type { MessageRepliesProps } from '../../components/Message/MessageSimple/MessageReplies';\nimport type { MessageRepliesAvatarsProps } from '../../components/Message/MessageSimple/MessageRepliesAvatars';\nimport type { MessageSimpleProps } from '../../components/Message/MessageSimple/MessageSimple';\nimport type { MessageStatusProps } from '../../components/Message/MessageSimple/MessageStatus';\nimport type { MessageTextProps } from '../../components/Message/MessageSimple/MessageTextContainer';\nimport type { ReactionListProps } from '../../components/Message/MessageSimple/ReactionList';\nimport type { MarkdownRules } from '../../components/Message/MessageSimple/utils/renderText';\nimport type { MessageActionsParams } from '../../components/Message/utils/messageActions';\nimport type { DateHeaderProps } from '../../components/MessageList/DateHeader';\nimport type { MessageType } from '../../components/MessageList/hooks/useMessageList';\nimport type { InlineDateSeparatorProps } from '../../components/MessageList/InlineDateSeparator';\nimport type { MessageListProps } from '../../components/MessageList/MessageList';\nimport type { MessageSystemProps } from '../../components/MessageList/MessageSystem';\nimport type { ScrollToBottomButtonProps } from '../../components/MessageList/ScrollToBottomButton';\nimport type { MessageActionType } from '../../components/MessageOverlay/MessageActionListItem';\nimport type { OverlayReactionListProps } from '../../components/MessageOverlay/OverlayReactionList';\nimport type { ReplyProps } from '../../components/Reply/Reply';\nimport type { FlatList } from '../../native';\nimport type { DefaultStreamChatGenerics, UnknownType } from '../../types/types';\nimport type { ReactionData } from '../../utils/utils';\nimport type { Alignment } from '../messageContext/MessageContext';\nimport type { SuggestionCommand } from '../suggestionsContext/SuggestionsContext';\nimport type { DeepPartial } from '../themeContext/ThemeContext';\nimport type { Theme } from '../themeContext/utils/theme';\nimport type { TDateTimeParserInput } from '../translationContext/TranslationContext';\nimport { DEFAULT_BASE_CONTEXT_VALUE } from '../utils/defaultBaseContextValue';\n\nimport { getDisplayName } from '../utils/getDisplayName';\nimport { isTestEnvironment } from '../utils/isTestEnvironment';\n\nexport type MessageContentType = 'attachments' | 'files' | 'gallery' | 'quoted_reply' | 'text';\n\nexport type MessagesContextValue<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = {\n /**\n * UI component for Attachment.\n * Defaults to: [Attachment](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Attachment/Attachment.tsx)\n */\n Attachment: React.ComponentType<AttachmentProps<StreamChatGenerics>>;\n /**\n * UI component to display AttachmentActions. e.g., send, shuffle, cancel in case of giphy\n * Defaults to: [AttachmentActions](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Attachment/AttachmentActions.tsx)\n */\n AttachmentActions: React.ComponentType<AttachmentActionsProps<StreamChatGenerics>>;\n /**\n * UI component to display generic media type e.g. giphy, url preview etc\n * Defaults to: [Card](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Attachment/Card.tsx)\n */\n Card: React.ComponentType<CardProps<StreamChatGenerics>>;\n /**\n * UI component for DateHeader\n * Defaults to: [DateHeader](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/MessageList/DateHeader.tsx)\n **/\n DateHeader: React.ComponentType<DateHeaderProps>;\n\n /** Should keyboard be dismissed when messaged is touched */\n dismissKeyboardOnMessageTouch: boolean;\n\n enableMessageGroupingByUser: boolean;\n\n /**\n * UI component to display File type attachment.\n * Defaults to: [FileAttachment](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Attachment/FileAttachment.tsx)\n */\n FileAttachment: React.ComponentType<FileAttachmentProps<StreamChatGenerics>>;\n /**\n * UI component to display group of File type attachments or multiple file attachments (in single message).\n * Defaults to: [FileAttachmentGroup](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Attachment/FileAttachmentGroup.tsx)\n */\n FileAttachmentGroup: React.ComponentType<FileAttachmentGroupProps<StreamChatGenerics>>;\n /**\n * UI component for attachment icon for type 'file' attachment.\n * Defaults to: https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Attachment/FileIcon.tsx\n */\n FileAttachmentIcon: React.ComponentType<FileIconProps>;\n FlatList: typeof FlatList;\n /**\n * UI component to display image attachments\n * Defaults to: [Gallery](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Attachment/Gallery.tsx)\n */\n Gallery: React.ComponentType<GalleryProps<StreamChatGenerics>>;\n /**\n * UI component for Giphy\n * Defaults to: [Giphy](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Attachment/Giphy.tsx)\n */\n Giphy: React.ComponentType<GiphyProps<StreamChatGenerics>>;\n /**\n * The giphy version to render - check the keys of the [Image Object](https://developers.giphy.com/docs/api/schema#image-object) for possible values. Uses 'fixed_height' by default\n * */\n giphyVersion: keyof NonNullable<Attachment['giphy']>;\n\n /**\n * The indicator rendered when loading an image fails.\n */\n ImageLoadingFailedIndicator: React.ComponentType<ImageLoadingFailedIndicatorProps>;\n\n /**\n * The indicator rendered when image is loading. By default renders <ActivityIndicator/>\n */\n ImageLoadingIndicator: React.ComponentType<ImageLoadingIndicatorProps>;\n\n /**\n * When true, messageList will be scrolled at first unread message, when opened.\n */\n initialScrollToFirstUnreadMessage: boolean;\n /**\n * UI component for Message Date Separator Component\n * Defaults to: [InlineDateSeparator](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/MessageList/InlineDateSeparator.tsx)\n */\n InlineDateSeparator: React.ComponentType<InlineDateSeparatorProps>;\n /**\n * UI component for InlineUnreadIndicator\n * Defaults to: [InlineUnreadIndicator](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Message/MessageSimple/InlineUnreadIndicator.tsx)\n **/\n InlineUnreadIndicator: React.ComponentType;\n\n Message: React.ComponentType<MessageProps<StreamChatGenerics>>;\n /**\n * UI component for MessageAvatar\n * Defaults to: [MessageAvatar](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Message/MessageSimple/MessageAvatar.tsx)\n **/\n MessageAvatar: React.ComponentType<MessageAvatarProps<StreamChatGenerics>>;\n /**\n * UI component for MessageContent\n * Defaults to: [MessageContent](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Message/MessageSimple/MessageContent.tsx)\n */\n MessageContent: React.ComponentType<MessageContentProps<StreamChatGenerics>>;\n /** Order to render the message content */\n messageContentOrder: MessageContentType[];\n /**\n * UI component for MessageDeleted\n * Defaults to: [MessageDeleted](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/MessageSimple/MessageDeleted.tsx)\n */\n MessageDeleted: React.ComponentType<MessageDeletedProps<StreamChatGenerics>>;\n /**\n * Custom message footer component\n */\n MessageFooter: React.ComponentType<MessageFooterProps<StreamChatGenerics>>;\n MessageList: React.ComponentType<MessageListProps<StreamChatGenerics>>;\n /**\n * Custom message pinned component\n */\n MessagePinnedHeader: React.ComponentType<MessagePinnedHeaderProps<StreamChatGenerics>>;\n /**\n * UI component for MessageReplies\n * Defaults to: [MessageReplies](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/MessageSimple/MessageReplies.tsx)\n */\n\n MessageReplies: React.ComponentType<MessageRepliesProps<StreamChatGenerics>>;\n /**\n * UI Component for MessageRepliesAvatars\n * Defaults to: [MessageRepliesAvatars](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/MessageSimple/MessageRepliesAvatars.tsx)\n */\n MessageRepliesAvatars: React.ComponentType<MessageRepliesAvatarsProps<StreamChatGenerics>>;\n /**\n * UI component for MessageSimple\n * Defaults to: [MessageSimple](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Message/MessageSimple/MessageSimple.tsx)\n */\n MessageSimple: React.ComponentType<MessageSimpleProps<StreamChatGenerics>>;\n /**\n * UI component for MessageStatus (delivered/read)\n * Defaults to: [MessageStatus](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Message/MessageSimple/MessageStatus.tsx)\n */\n MessageStatus: React.ComponentType<MessageStatusProps<StreamChatGenerics>>;\n /**\n * UI component for MessageSystem\n * Defaults to: [MessageSystem](https://getstream.io/chat/docs/sdk/reactnative/ui-components/message-system/)\n */\n MessageSystem: React.ComponentType<MessageSystemProps<StreamChatGenerics>>;\n /**\n * UI component for OverlayReactionList\n */\n OverlayReactionList: React.ComponentType<OverlayReactionListProps<StreamChatGenerics>>;\n /**\n * UI component for ReactionList\n * Defaults to: [ReactionList](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Reaction/ReactionList.tsx)\n */\n ReactionList: React.ComponentType<ReactionListProps<StreamChatGenerics>>;\n removeMessage: (message: { id: string; parent_id?: string }) => void;\n /**\n * UI component for Reply\n * Defaults to: [Reply](https://getstream.io/chat/docs/sdk/reactnative/ui-components/reply/)\n */\n Reply: React.ComponentType<ReplyProps<StreamChatGenerics>>;\n /**\n * Override the api request for retry message functionality.\n */\n retrySendMessage: (message: MessageResponse<StreamChatGenerics>) => Promise<void>;\n /**\n * UI component for ScrollToBottomButton\n * Defaults to: [ScrollToBottomButton](https://getstream.io/chat/docs/sdk/reactnative/ui-components/scroll-to-bottom-button/)\n */\n ScrollToBottomButton: React.ComponentType<ScrollToBottomButtonProps>;\n setEditingState: (message: MessageType<StreamChatGenerics>) => void;\n setQuotedMessageState: (message: MessageType<StreamChatGenerics>) => void;\n supportedReactions: ReactionData[];\n /**\n * UI component for TypingIndicator\n * Defaults to: [TypingIndicator](https://getstream.io/chat/docs/sdk/reactnative/ui-components/typing-indicator/)\n */\n TypingIndicator: React.ComponentType;\n /**\n * UI component for TypingIndicatorContainer\n * Defaults to: [TypingIndicatorContainer](https://getstream.io/chat/docs/sdk/reactnative/contexts/messages-context/#typingindicatorcontainer)\n */\n TypingIndicatorContainer: React.ComponentType;\n updateMessage: (\n updatedMessage: MessageResponse<StreamChatGenerics>,\n extraState?: {\n commands?: SuggestionCommand<StreamChatGenerics>[];\n messageInput?: string;\n threadMessages?: ChannelState<StreamChatGenerics>['threads'][string];\n },\n ) => void;\n /**\n * Custom UI component to display enriched url preview.\n * Defaults to https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Attachment/Card.tsx\n */\n UrlPreview: React.ComponentType<CardProps<StreamChatGenerics>>;\n VideoThumbnail: React.ComponentType<VideoThumbnailProps>;\n /**\n * Provide any additional props for `TouchableOpacity` which wraps inner MessageContent component here.\n * Please check docs for TouchableOpacity for supported props - https://reactnative.dev/docs/touchableopacity#props\n *\n * @overrideType Object\n */\n additionalTouchableProps?: Omit<TouchableOpacityProps, 'style'>;\n /**\n * Custom UI component to override default cover (between Header and Footer) of Card component.\n * Accepts the same props as Card component.\n */\n CardCover?: React.ComponentType<CardProps<StreamChatGenerics>>;\n /**\n * Custom UI component to override default Footer of Card component.\n * Accepts the same props as Card component.\n */\n CardFooter?: React.ComponentType<CardProps<StreamChatGenerics>>;\n /**\n * Custom UI component to override default header of Card component.\n * Accepts the same props as Card component.\n */\n CardHeader?: React.ComponentType<CardProps<StreamChatGenerics>>;\n\n /**\n * Full override of the delete message button in the Message Actions\n *\n * Please check [cookbook](https://github.com/GetStream/stream-chat-react-native/wiki/Cookbook-v3.0#override-or-intercept-message-actions-edit-delete-reaction-reply-etc) for details.\n */\n\n /** Control if the deleted message is visible to both the send and reciever, either of them or none */\n deletedMessagesVisibilityType?: 'always' | 'never' | 'receiver' | 'sender';\n\n disableTypingIndicator?: boolean;\n\n /**\n * Whether messages should be aligned to right or left part of screen.\n * By default, messages will be received messages will be aligned to left and\n * sent messages will be aligned to right.\n */\n forceAlignMessages?: Alignment | boolean;\n /**\n * Optional function to custom format the message date\n */\n formatDate?: (date: TDateTimeParserInput) => string;\n handleBlock?: (message: MessageType<StreamChatGenerics>) => Promise<void>;\n /** Handler to access when a copy message action is invoked */\n handleCopy?: (message: MessageType<StreamChatGenerics>) => Promise<void>;\n /** Handler to access when a delete message action is invoked */\n handleDelete?: (message: MessageType<StreamChatGenerics>) => Promise<void>;\n /** Handler to access when an edit message action is invoked */\n handleEdit?: (message: MessageType<StreamChatGenerics>) => void;\n /** Handler to access when a flag message action is invoked */\n handleFlag?: (message: MessageType<StreamChatGenerics>) => Promise<void>;\n /** Handler to access when a mute user action is invoked */\n handleMute?: (message: MessageType<StreamChatGenerics>) => Promise<void>;\n /** Handler to access when a pin/unpin user action is invoked*/\n handlePinMessage?: ((message: MessageType<StreamChatGenerics>) => MessageActionType) | null;\n /** Handler to access when a quoted reply action is invoked */\n handleQuotedReply?: (message: MessageType<StreamChatGenerics>) => Promise<void>;\n /** Handler to process a reaction */\n handleReaction?: (\n message: MessageType<StreamChatGenerics>,\n reactionType: string,\n ) => Promise<void>;\n /** Handler to access when a retry action is invoked */\n handleRetry?: (message: MessageType<StreamChatGenerics>) => Promise<void>;\n /** Handler to access when a thread reply action is invoked */\n handleThreadReply?: (message: MessageType<StreamChatGenerics>) => Promise<void>;\n /** Handler to deal with custom memoization logic of Attachment */\n isAttachmentEqual?: (\n prevAttachment: Attachment<StreamChatGenerics>,\n nextAttachment: Attachment<StreamChatGenerics>,\n ) => boolean;\n legacyImageViewerSwipeBehaviour?: boolean;\n /** Object specifying rules defined within simple-markdown https://github.com/Khan/simple-markdown#adding-a-simple-extension */\n markdownRules?: MarkdownRules;\n /**\n * Use this prop to override message actions (which pop-up in message overlay).\n *\n * You can either completely override the default messageActions object.\n *\n * ```\n * <Channel\n * messageActions=[\n * {\n * action: () => { someAction() };\n * title: \"Pin Message\";\n * icon: PinIcon;\n * titleStyle: {};\n * },\n * {\n * action: () => { someAction() };\n * title: \"Delete Message\";\n * icon: PinIcon;\n * titleStyle: {};\n * }\n * ]\n * >\n * </Channel>\n * ```\n *\n * Or you can selectly keep certain action and remove some:\n *\n * e.g. Lets say you only want to keep threadReply and copyMessage actions\n *\n * ```\n * <Channel\n * messageActions={({\n * blockUser,\n * copyMessage,\n * deleteMessage,\n * editMessage,\n * flagMessage,\n * muteUser,\n * quotedReply,\n * retry,\n * threadReply,\n * }) => ([\n * threadReply, copyMessage\n * ])}\n * >\n * </Channel>\n * ```\n *\n * @overrideType Function | Array<Objects>\n */\n messageActions?: (param: MessageActionsParams<StreamChatGenerics>) => MessageActionType[];\n /**\n * Custom message header component\n */\n MessageHeader?: React.ComponentType<MessageFooterProps<StreamChatGenerics>>;\n /** Custom UI component for message text */\n MessageText?: React.ComponentType<MessageTextProps<StreamChatGenerics>>;\n\n /**\n * Theme provided only to messages that are the current users\n */\n myMessageTheme?: DeepPartial<Theme>;\n /**\n * Override default handler for onLongPress on message. You have access to payload of that handler as param:\n *\n * ```\n * <Channel\n * onLongPressMessage={({\n * actionHandlers: {\n * deleteMessage, // () => Promise<void>;\n * editMessage, // () => void;\n * quotedReply, // () => void;\n * resendMessage, // () => Promise<void>;\n * showMessageOverlay, // () => void;\n * toggleBanUser, // () => Promise<void>;\n * toggleMuteUser, // () => Promise<void>;\n * toggleReaction, // (reactionType: string) => Promise<void>;\n * },\n * defaultHandler, // () => void\n * event, // any event object corresponding to touchable feedback\n * emitter, // which component trigged this touchable feedback e.g. card, fileAttachment, gallery, message ... etc\n * message // message object on which longPress occured\n * }) => {\n * // Your custom action\n * }}\n * />\n * ```\n */\n onLongPressMessage?: (payload: MessageTouchableHandlerPayload<StreamChatGenerics>) => void;\n /**\n * Add onPressIn handler for attachments. You have access to payload of that handler as param:\n *\n * ```\n * <Channel\n * onPressInMessage={({\n * actionHandlers: {\n * deleteMessage, // () => Promise<void>;\n * editMessage, // () => void;\n * quotedReply, // () => void;\n * resendMessage, // () => Promise<void>;\n * showMessageOverlay, // () => void;\n * toggleBanUser, // () => Promise<void>;\n * toggleMuteUser, // () => Promise<void>;\n * toggleReaction, // (reactionType: string) => Promise<void>;\n * },\n * defaultHandler, // () => void\n * event, // any event object corresponding to touchable feedback\n * emitter, // which component trigged this touchable feedback e.g. card, fileAttachment, gallery, message ... etc\n * message // message object on which longPress occured\n * }) => {\n * // Your custom action\n * }}\n * />\n * ```\n */\n onPressInMessage?: (payload: MessageTouchableHandlerPayload<StreamChatGenerics>) => void;\n /**\n * Override onPress handler for message. You have access to payload of that handler as param:\n *\n * ```\n * <Channel\n * onPressMessage={({\n * actionHandlers: {\n * deleteMessage, // () => Promise<void>;\n * editMessage, // () => void;\n * quotedReply, // () => void;\n * resendMessage, // () => Promise<void>;\n * showMessageOverlay, // () => void;\n * toggleBanUser, // () => Promise<void>;\n * toggleMuteUser, // () => Promise<void>;\n * toggleReaction, // (reactionType: string) => Promise<void>;\n * },\n * defaultHandler, // () => void\n * event, // any event object corresponding to touchable feedback\n * emitter, // which component trigged this touchable feedback e.g. card, fileAttachment, gallery, message ... etc\n * message // message object on which longPress occurred\n * }) => {\n * // Your custom action\n * }}\n * />\n * ```\n */\n onPressMessage?: (payload: MessageTouchableHandlerPayload<StreamChatGenerics>) => void;\n\n /**\n * Full override of the reaction function on Message and Message Overlay\n *\n * Please check [cookbook](https://github.com/GetStream/stream-chat-react-native/wiki/Cookbook-v3.0#override-or-intercept-message-actions-edit-delete-reaction-reply-etc) for details.\n * */\n selectReaction?: (\n message: MessageType<StreamChatGenerics>,\n ) => (reactionType: string) => Promise<void>;\n\n targetedMessage?: string;\n};\n\nexport const MessagesContext = React.createContext(\n DEFAULT_BASE_CONTEXT_VALUE as MessagesContextValue,\n);\n\nexport const MessagesProvider = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>({\n children,\n value,\n}: PropsWithChildren<{\n value?: MessagesContextValue<StreamChatGenerics>;\n}>) => (\n <MessagesContext.Provider value={value as unknown as MessagesContextValue}>\n {children}\n </MessagesContext.Provider>\n);\n\nexport const useMessagesContext = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>() => {\n const contextValue = useContext(\n MessagesContext,\n ) as unknown as MessagesContextValue<StreamChatGenerics>;\n\n if (contextValue === DEFAULT_BASE_CONTEXT_VALUE && !isTestEnvironment()) {\n throw new Error(\n `The useMessagesContext hook was called outside of the MessagesContext provider. Make sure you have configured MessageList component correctly - https://getstream.io/chat/docs/sdk/reactnative/basics/hello_stream_chat/#message-list`,\n );\n }\n\n return contextValue;\n};\n\n/**\n * Typescript currently does not support partial inference so if MessagesContext\n * typing is desired while using the HOC withMessagesContext the Props for the\n * wrapped component must be provided as the first generic.\n */\nexport const withMessagesContext = <\n P extends UnknownType,\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n Component: React.ComponentType<P>,\n): React.FC<Omit<P, keyof MessagesContextValue<StreamChatGenerics>>> => {\n const WithMessagesContextComponent = (\n props: Omit<P, keyof MessagesContextValue<StreamChatGenerics>>,\n ) => {\n const messagesContext = useMessagesContext<StreamChatGenerics>();\n\n return <Component {...(props as P)} {...messagesContext} />;\n };\n WithMessagesContextComponent.displayName = `WithMessagesContext${getDisplayName(Component)}`;\n return WithMessagesContextComponent;\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["MessagesContext.tsx"],"names":["MessagesContext","React","createContext","DEFAULT_BASE_CONTEXT_VALUE","MessagesProvider","children","value","useMessagesContext","contextValue","Error","withMessagesContext","Component","WithMessagesContextComponent","props","messagesContext","displayName"],"mappings":";;;;;;;;;;;AAAA;;AAuDA;;AAEA;;AACA;;;;;;;;;AA2aO,IAAMA,eAAe,GAAGC,kBAAMC,aAAN,CAC7BC,mDAD6B,CAAxB;;;;AAIA,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAmB;AAAA,MAG9BC,QAH8B,QAG9BA,QAH8B;AAAA,MAI9BC,KAJ8B,QAI9BA,KAJ8B;AAAA,SAQ9B,gCAAC,eAAD,CAAiB,QAAjB;AAA0B,IAAA,KAAK,EAAEA,KAAjC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACGD,QADH,CAR8B;AAAA,CAAzB;;;;AAaA,IAAME,kBAAkB,GAAG,SAArBA,kBAAqB,GAE3B;AACL,MAAMC,YAAY,GAAG,uBACnBR,eADmB,CAArB;;AAIA,MAAIQ,YAAY,KAAKL,mDAAjB,IAA+C,CAAC,2CAApD,EAAyE;AACvE,UAAM,IAAIM,KAAJ,yOAAN;AAGD;;AAED,SAAOD,YAAP;AACD,CAdM;;;;AAqBA,IAAME,mBAAmB,GAAG,SAAtBA,mBAAsB,CAIjCC,SAJiC,EAKqC;AACtE,MAAMC,4BAA4B,GAAG,SAA/BA,4BAA+B,CACnCC,KADmC,EAEhC;AACH,QAAMC,eAAe,GAAGP,kBAAkB,EAA1C;AAEA,WAAO,gCAAC,SAAD,gCAAgBM,KAAhB,EAAiCC,eAAjC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,OAAP;AACD,GAND;;AAOAF,EAAAA,4BAA4B,CAACG,WAA7B,2BAAiE,oCAAeJ,SAAf,CAAjE;AACA,SAAOC,4BAAP;AACD,CAfM","sourcesContent":["import React, { PropsWithChildren, useContext } from 'react';\n\nimport type { TouchableOpacityProps } from 'react-native';\n\nimport type { ImageLoadingFailedIndicatorProps } from 'src/components/Attachment/ImageLoadingFailedIndicator';\nimport type { ImageLoadingIndicatorProps } from 'src/components/Attachment/ImageLoadingIndicator';\n\nimport type { MessagePinnedHeaderProps } from 'src/components/Message/MessageSimple/MessagePinnedHeader';\n\nimport type { Attachment, ChannelState, MessageResponse } from 'stream-chat';\n\nimport type { AttachmentProps } from '../../components/Attachment/Attachment';\nimport type { AttachmentActionsProps } from '../../components/Attachment/AttachmentActions';\nimport type { AudioAttachmentProps } from '../../components/Attachment/AudioAttachment';\nimport type { CardProps } from '../../components/Attachment/Card';\nimport type { FileAttachmentProps } from '../../components/Attachment/FileAttachment';\nimport type { FileAttachmentGroupProps } from '../../components/Attachment/FileAttachmentGroup';\nimport type { FileIconProps } from '../../components/Attachment/FileIcon';\nimport type { GalleryProps } from '../../components/Attachment/Gallery';\nimport type { GiphyProps } from '../../components/Attachment/Giphy';\nimport type { VideoThumbnailProps } from '../../components/Attachment/VideoThumbnail';\nimport type {\n MessageProps,\n MessageTouchableHandlerPayload,\n} from '../../components/Message/Message';\nimport type { MessageAvatarProps } from '../../components/Message/MessageSimple/MessageAvatar';\nimport type { MessageContentProps } from '../../components/Message/MessageSimple/MessageContent';\nimport type { MessageDeletedProps } from '../../components/Message/MessageSimple/MessageDeleted';\nimport type { MessageFooterProps } from '../../components/Message/MessageSimple/MessageFooter';\n\nimport type { MessageRepliesProps } from '../../components/Message/MessageSimple/MessageReplies';\nimport type { MessageRepliesAvatarsProps } from '../../components/Message/MessageSimple/MessageRepliesAvatars';\nimport type { MessageSimpleProps } from '../../components/Message/MessageSimple/MessageSimple';\nimport type { MessageStatusProps } from '../../components/Message/MessageSimple/MessageStatus';\nimport type { MessageTextProps } from '../../components/Message/MessageSimple/MessageTextContainer';\nimport type { ReactionListProps } from '../../components/Message/MessageSimple/ReactionList';\nimport type { MarkdownRules } from '../../components/Message/MessageSimple/utils/renderText';\nimport type { MessageActionsParams } from '../../components/Message/utils/messageActions';\nimport type { DateHeaderProps } from '../../components/MessageList/DateHeader';\nimport type { MessageType } from '../../components/MessageList/hooks/useMessageList';\nimport type { InlineDateSeparatorProps } from '../../components/MessageList/InlineDateSeparator';\nimport type { MessageListProps } from '../../components/MessageList/MessageList';\nimport type { MessageSystemProps } from '../../components/MessageList/MessageSystem';\nimport type { ScrollToBottomButtonProps } from '../../components/MessageList/ScrollToBottomButton';\nimport type { MessageActionType } from '../../components/MessageOverlay/MessageActionListItem';\nimport type { OverlayReactionListProps } from '../../components/MessageOverlay/OverlayReactionList';\nimport type { ReplyProps } from '../../components/Reply/Reply';\nimport type { FlatList } from '../../native';\nimport type { DefaultStreamChatGenerics, UnknownType } from '../../types/types';\nimport type { ReactionData } from '../../utils/utils';\nimport type { Alignment } from '../messageContext/MessageContext';\nimport type { SuggestionCommand } from '../suggestionsContext/SuggestionsContext';\nimport type { DeepPartial } from '../themeContext/ThemeContext';\nimport type { Theme } from '../themeContext/utils/theme';\nimport type { TDateTimeParserInput } from '../translationContext/TranslationContext';\nimport { DEFAULT_BASE_CONTEXT_VALUE } from '../utils/defaultBaseContextValue';\n\nimport { getDisplayName } from '../utils/getDisplayName';\nimport { isTestEnvironment } from '../utils/isTestEnvironment';\n\nexport type MessageContentType = 'attachments' | 'files' | 'gallery' | 'quoted_reply' | 'text';\n\nexport type MessagesContextValue<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = {\n /**\n * UI component for Attachment.\n * Defaults to: [Attachment](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Attachment/Attachment.tsx)\n */\n Attachment: React.ComponentType<AttachmentProps<StreamChatGenerics>>;\n /**\n * UI component to display AttachmentActions. e.g., send, shuffle, cancel in case of giphy\n * Defaults to: [AttachmentActions](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Attachment/AttachmentActions.tsx)\n */\n AttachmentActions: React.ComponentType<AttachmentActionsProps<StreamChatGenerics>>;\n /** Custom UI component for AudioAttachment. */\n AudioAttachment: React.ComponentType<AudioAttachmentProps>;\n /**\n * UI component to display generic media type e.g. giphy, url preview etc\n * Defaults to: [Card](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Attachment/Card.tsx)\n */\n Card: React.ComponentType<CardProps<StreamChatGenerics>>;\n /**\n * UI component for DateHeader\n * Defaults to: [DateHeader](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/MessageList/DateHeader.tsx)\n **/\n DateHeader: React.ComponentType<DateHeaderProps>;\n\n /** Should keyboard be dismissed when messaged is touched */\n dismissKeyboardOnMessageTouch: boolean;\n\n enableMessageGroupingByUser: boolean;\n\n /**\n * UI component to display File type attachment.\n * Defaults to: [FileAttachment](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Attachment/FileAttachment.tsx)\n */\n FileAttachment: React.ComponentType<FileAttachmentProps<StreamChatGenerics>>;\n /**\n * UI component to display group of File type attachments or multiple file attachments (in single message).\n * Defaults to: [FileAttachmentGroup](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Attachment/FileAttachmentGroup.tsx)\n */\n FileAttachmentGroup: React.ComponentType<FileAttachmentGroupProps<StreamChatGenerics>>;\n /**\n * UI component for attachment icon for type 'file' attachment.\n * Defaults to: https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Attachment/FileIcon.tsx\n */\n FileAttachmentIcon: React.ComponentType<FileIconProps>;\n FlatList: typeof FlatList;\n /**\n * UI component to display image attachments\n * Defaults to: [Gallery](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Attachment/Gallery.tsx)\n */\n Gallery: React.ComponentType<GalleryProps<StreamChatGenerics>>;\n /**\n * UI component for Giphy\n * Defaults to: [Giphy](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Attachment/Giphy.tsx)\n */\n Giphy: React.ComponentType<GiphyProps<StreamChatGenerics>>;\n /**\n * The giphy version to render - check the keys of the [Image Object](https://developers.giphy.com/docs/api/schema#image-object) for possible values. Uses 'fixed_height' by default\n * */\n giphyVersion: keyof NonNullable<Attachment['giphy']>;\n\n /**\n * The indicator rendered when loading an image fails.\n */\n ImageLoadingFailedIndicator: React.ComponentType<ImageLoadingFailedIndicatorProps>;\n\n /**\n * The indicator rendered when image is loading. By default renders <ActivityIndicator/>\n */\n ImageLoadingIndicator: React.ComponentType<ImageLoadingIndicatorProps>;\n\n /**\n * When true, messageList will be scrolled at first unread message, when opened.\n */\n initialScrollToFirstUnreadMessage: boolean;\n /**\n * UI component for Message Date Separator Component\n * Defaults to: [InlineDateSeparator](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/MessageList/InlineDateSeparator.tsx)\n */\n InlineDateSeparator: React.ComponentType<InlineDateSeparatorProps>;\n /**\n * UI component for InlineUnreadIndicator\n * Defaults to: [InlineUnreadIndicator](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Message/MessageSimple/InlineUnreadIndicator.tsx)\n **/\n InlineUnreadIndicator: React.ComponentType;\n\n Message: React.ComponentType<MessageProps<StreamChatGenerics>>;\n /**\n * UI component for MessageAvatar\n * Defaults to: [MessageAvatar](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Message/MessageSimple/MessageAvatar.tsx)\n **/\n MessageAvatar: React.ComponentType<MessageAvatarProps<StreamChatGenerics>>;\n /**\n * UI component for MessageContent\n * Defaults to: [MessageContent](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Message/MessageSimple/MessageContent.tsx)\n */\n MessageContent: React.ComponentType<MessageContentProps<StreamChatGenerics>>;\n /** Order to render the message content */\n messageContentOrder: MessageContentType[];\n /**\n * UI component for MessageDeleted\n * Defaults to: [MessageDeleted](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/MessageSimple/MessageDeleted.tsx)\n */\n MessageDeleted: React.ComponentType<MessageDeletedProps<StreamChatGenerics>>;\n /**\n * Custom message footer component\n */\n MessageFooter: React.ComponentType<MessageFooterProps<StreamChatGenerics>>;\n MessageList: React.ComponentType<MessageListProps<StreamChatGenerics>>;\n /**\n * Custom message pinned component\n */\n MessagePinnedHeader: React.ComponentType<MessagePinnedHeaderProps<StreamChatGenerics>>;\n /**\n * UI component for MessageReplies\n * Defaults to: [MessageReplies](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/MessageSimple/MessageReplies.tsx)\n */\n\n MessageReplies: React.ComponentType<MessageRepliesProps<StreamChatGenerics>>;\n /**\n * UI Component for MessageRepliesAvatars\n * Defaults to: [MessageRepliesAvatars](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/MessageSimple/MessageRepliesAvatars.tsx)\n */\n MessageRepliesAvatars: React.ComponentType<MessageRepliesAvatarsProps<StreamChatGenerics>>;\n /**\n * UI component for MessageSimple\n * Defaults to: [MessageSimple](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Message/MessageSimple/MessageSimple.tsx)\n */\n MessageSimple: React.ComponentType<MessageSimpleProps<StreamChatGenerics>>;\n /**\n * UI component for MessageStatus (delivered/read)\n * Defaults to: [MessageStatus](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Message/MessageSimple/MessageStatus.tsx)\n */\n MessageStatus: React.ComponentType<MessageStatusProps<StreamChatGenerics>>;\n /**\n * UI component for MessageSystem\n * Defaults to: [MessageSystem](https://getstream.io/chat/docs/sdk/reactnative/ui-components/message-system/)\n */\n MessageSystem: React.ComponentType<MessageSystemProps<StreamChatGenerics>>;\n /**\n * UI component for OverlayReactionList\n */\n OverlayReactionList: React.ComponentType<OverlayReactionListProps<StreamChatGenerics>>;\n /**\n * UI component for ReactionList\n * Defaults to: [ReactionList](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Reaction/ReactionList.tsx)\n */\n ReactionList: React.ComponentType<ReactionListProps<StreamChatGenerics>>;\n removeMessage: (message: { id: string; parent_id?: string }) => void;\n /**\n * UI component for Reply\n * Defaults to: [Reply](https://getstream.io/chat/docs/sdk/reactnative/ui-components/reply/)\n */\n Reply: React.ComponentType<ReplyProps<StreamChatGenerics>>;\n /**\n * Override the api request for retry message functionality.\n */\n retrySendMessage: (message: MessageResponse<StreamChatGenerics>) => Promise<void>;\n /**\n * UI component for ScrollToBottomButton\n * Defaults to: [ScrollToBottomButton](https://getstream.io/chat/docs/sdk/reactnative/ui-components/scroll-to-bottom-button/)\n */\n ScrollToBottomButton: React.ComponentType<ScrollToBottomButtonProps>;\n setEditingState: (message: MessageType<StreamChatGenerics>) => void;\n setQuotedMessageState: (message: MessageType<StreamChatGenerics>) => void;\n supportedReactions: ReactionData[];\n /**\n * UI component for TypingIndicator\n * Defaults to: [TypingIndicator](https://getstream.io/chat/docs/sdk/reactnative/ui-components/typing-indicator/)\n */\n TypingIndicator: React.ComponentType;\n /**\n * UI component for TypingIndicatorContainer\n * Defaults to: [TypingIndicatorContainer](https://getstream.io/chat/docs/sdk/reactnative/contexts/messages-context/#typingindicatorcontainer)\n */\n TypingIndicatorContainer: React.ComponentType;\n updateMessage: (\n updatedMessage: MessageResponse<StreamChatGenerics>,\n extraState?: {\n commands?: SuggestionCommand<StreamChatGenerics>[];\n messageInput?: string;\n threadMessages?: ChannelState<StreamChatGenerics>['threads'][string];\n },\n ) => void;\n /**\n * Custom UI component to display enriched url preview.\n * Defaults to https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Attachment/Card.tsx\n */\n UrlPreview: React.ComponentType<CardProps<StreamChatGenerics>>;\n VideoThumbnail: React.ComponentType<VideoThumbnailProps>;\n /**\n * Provide any additional props for `TouchableOpacity` which wraps inner MessageContent component here.\n * Please check docs for TouchableOpacity for supported props - https://reactnative.dev/docs/touchableopacity#props\n *\n * @overrideType Object\n */\n additionalTouchableProps?: Omit<TouchableOpacityProps, 'style'>;\n /**\n * Custom UI component to override default cover (between Header and Footer) of Card component.\n * Accepts the same props as Card component.\n */\n CardCover?: React.ComponentType<CardProps<StreamChatGenerics>>;\n /**\n * Custom UI component to override default Footer of Card component.\n * Accepts the same props as Card component.\n */\n CardFooter?: React.ComponentType<CardProps<StreamChatGenerics>>;\n /**\n * Custom UI component to override default header of Card component.\n * Accepts the same props as Card component.\n */\n CardHeader?: React.ComponentType<CardProps<StreamChatGenerics>>;\n\n /**\n * Full override of the delete message button in the Message Actions\n *\n * Please check [cookbook](https://github.com/GetStream/stream-chat-react-native/wiki/Cookbook-v3.0#override-or-intercept-message-actions-edit-delete-reaction-reply-etc) for details.\n */\n\n /** Control if the deleted message is visible to both the send and reciever, either of them or none */\n deletedMessagesVisibilityType?: 'always' | 'never' | 'receiver' | 'sender';\n\n disableTypingIndicator?: boolean;\n\n /**\n * Whether messages should be aligned to right or left part of screen.\n * By default, messages will be received messages will be aligned to left and\n * sent messages will be aligned to right.\n */\n forceAlignMessages?: Alignment | boolean;\n /**\n * Optional function to custom format the message date\n */\n formatDate?: (date: TDateTimeParserInput) => string;\n handleBlock?: (message: MessageType<StreamChatGenerics>) => Promise<void>;\n /** Handler to access when a copy message action is invoked */\n handleCopy?: (message: MessageType<StreamChatGenerics>) => Promise<void>;\n /** Handler to access when a delete message action is invoked */\n handleDelete?: (message: MessageType<StreamChatGenerics>) => Promise<void>;\n /** Handler to access when an edit message action is invoked */\n handleEdit?: (message: MessageType<StreamChatGenerics>) => void;\n /** Handler to access when a flag message action is invoked */\n handleFlag?: (message: MessageType<StreamChatGenerics>) => Promise<void>;\n /** Handler to access when a mute user action is invoked */\n handleMute?: (message: MessageType<StreamChatGenerics>) => Promise<void>;\n /** Handler to access when a pin/unpin user action is invoked*/\n handlePinMessage?: ((message: MessageType<StreamChatGenerics>) => MessageActionType) | null;\n /** Handler to access when a quoted reply action is invoked */\n handleQuotedReply?: (message: MessageType<StreamChatGenerics>) => Promise<void>;\n /** Handler to process a reaction */\n handleReaction?: (\n message: MessageType<StreamChatGenerics>,\n reactionType: string,\n ) => Promise<void>;\n /** Handler to access when a retry action is invoked */\n handleRetry?: (message: MessageType<StreamChatGenerics>) => Promise<void>;\n /** Handler to access when a thread reply action is invoked */\n handleThreadReply?: (message: MessageType<StreamChatGenerics>) => Promise<void>;\n /** Handler to deal with custom memoization logic of Attachment */\n isAttachmentEqual?: (\n prevAttachment: Attachment<StreamChatGenerics>,\n nextAttachment: Attachment<StreamChatGenerics>,\n ) => boolean;\n legacyImageViewerSwipeBehaviour?: boolean;\n /** Object specifying rules defined within simple-markdown https://github.com/Khan/simple-markdown#adding-a-simple-extension */\n markdownRules?: MarkdownRules;\n /**\n * Use this prop to override message actions (which pop-up in message overlay).\n *\n * You can either completely override the default messageActions object.\n *\n * ```\n * <Channel\n * messageActions=[\n * {\n * action: () => { someAction() };\n * title: \"Pin Message\";\n * icon: PinIcon;\n * titleStyle: {};\n * },\n * {\n * action: () => { someAction() };\n * title: \"Delete Message\";\n * icon: PinIcon;\n * titleStyle: {};\n * }\n * ]\n * >\n * </Channel>\n * ```\n *\n * Or you can selectly keep certain action and remove some:\n *\n * e.g. Lets say you only want to keep threadReply and copyMessage actions\n *\n * ```\n * <Channel\n * messageActions={({\n * blockUser,\n * copyMessage,\n * deleteMessage,\n * editMessage,\n * flagMessage,\n * muteUser,\n * quotedReply,\n * retry,\n * threadReply,\n * }) => ([\n * threadReply, copyMessage\n * ])}\n * >\n * </Channel>\n * ```\n *\n * @overrideType Function | Array<Objects>\n */\n messageActions?: (param: MessageActionsParams<StreamChatGenerics>) => MessageActionType[];\n /**\n * Custom message header component\n */\n MessageHeader?: React.ComponentType<MessageFooterProps<StreamChatGenerics>>;\n /** Custom UI component for message text */\n MessageText?: React.ComponentType<MessageTextProps<StreamChatGenerics>>;\n\n /**\n * Theme provided only to messages that are the current users\n */\n myMessageTheme?: DeepPartial<Theme>;\n /**\n * Override default handler for onLongPress on message. You have access to payload of that handler as param:\n *\n * ```\n * <Channel\n * onLongPressMessage={({\n * actionHandlers: {\n * deleteMessage, // () => Promise<void>;\n * editMessage, // () => void;\n * quotedReply, // () => void;\n * resendMessage, // () => Promise<void>;\n * showMessageOverlay, // () => void;\n * toggleBanUser, // () => Promise<void>;\n * toggleMuteUser, // () => Promise<void>;\n * toggleReaction, // (reactionType: string) => Promise<void>;\n * },\n * defaultHandler, // () => void\n * event, // any event object corresponding to touchable feedback\n * emitter, // which component trigged this touchable feedback e.g. card, fileAttachment, gallery, message ... etc\n * message // message object on which longPress occured\n * }) => {\n * // Your custom action\n * }}\n * />\n * ```\n */\n onLongPressMessage?: (payload: MessageTouchableHandlerPayload<StreamChatGenerics>) => void;\n /**\n * Add onPressIn handler for attachments. You have access to payload of that handler as param:\n *\n * ```\n * <Channel\n * onPressInMessage={({\n * actionHandlers: {\n * deleteMessage, // () => Promise<void>;\n * editMessage, // () => void;\n * quotedReply, // () => void;\n * resendMessage, // () => Promise<void>;\n * showMessageOverlay, // () => void;\n * toggleBanUser, // () => Promise<void>;\n * toggleMuteUser, // () => Promise<void>;\n * toggleReaction, // (reactionType: string) => Promise<void>;\n * },\n * defaultHandler, // () => void\n * event, // any event object corresponding to touchable feedback\n * emitter, // which component trigged this touchable feedback e.g. card, fileAttachment, gallery, message ... etc\n * message // message object on which longPress occured\n * }) => {\n * // Your custom action\n * }}\n * />\n * ```\n */\n onPressInMessage?: (payload: MessageTouchableHandlerPayload<StreamChatGenerics>) => void;\n /**\n * Override onPress handler for message. You have access to payload of that handler as param:\n *\n * ```\n * <Channel\n * onPressMessage={({\n * actionHandlers: {\n * deleteMessage, // () => Promise<void>;\n * editMessage, // () => void;\n * quotedReply, // () => void;\n * resendMessage, // () => Promise<void>;\n * showMessageOverlay, // () => void;\n * toggleBanUser, // () => Promise<void>;\n * toggleMuteUser, // () => Promise<void>;\n * toggleReaction, // (reactionType: string) => Promise<void>;\n * },\n * defaultHandler, // () => void\n * event, // any event object corresponding to touchable feedback\n * emitter, // which component trigged this touchable feedback e.g. card, fileAttachment, gallery, message ... etc\n * message // message object on which longPress occurred\n * }) => {\n * // Your custom action\n * }}\n * />\n * ```\n */\n onPressMessage?: (payload: MessageTouchableHandlerPayload<StreamChatGenerics>) => void;\n\n /**\n * Full override of the reaction function on Message and Message Overlay\n *\n * Please check [cookbook](https://github.com/GetStream/stream-chat-react-native/wiki/Cookbook-v3.0#override-or-intercept-message-actions-edit-delete-reaction-reply-etc) for details.\n * */\n selectReaction?: (\n message: MessageType<StreamChatGenerics>,\n ) => (reactionType: string) => Promise<void>;\n\n targetedMessage?: string;\n};\n\nexport const MessagesContext = React.createContext(\n DEFAULT_BASE_CONTEXT_VALUE as MessagesContextValue,\n);\n\nexport const MessagesProvider = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>({\n children,\n value,\n}: PropsWithChildren<{\n value?: MessagesContextValue<StreamChatGenerics>;\n}>) => (\n <MessagesContext.Provider value={value as unknown as MessagesContextValue}>\n {children}\n </MessagesContext.Provider>\n);\n\nexport const useMessagesContext = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>() => {\n const contextValue = useContext(\n MessagesContext,\n ) as unknown as MessagesContextValue<StreamChatGenerics>;\n\n if (contextValue === DEFAULT_BASE_CONTEXT_VALUE && !isTestEnvironment()) {\n throw new Error(\n `The useMessagesContext hook was called outside of the MessagesContext provider. Make sure you have configured MessageList component correctly - https://getstream.io/chat/docs/sdk/reactnative/basics/hello_stream_chat/#message-list`,\n );\n }\n\n return contextValue;\n};\n\n/**\n * Typescript currently does not support partial inference so if MessagesContext\n * typing is desired while using the HOC withMessagesContext the Props for the\n * wrapped component must be provided as the first generic.\n */\nexport const withMessagesContext = <\n P extends UnknownType,\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n Component: React.ComponentType<P>,\n): React.FC<Omit<P, keyof MessagesContextValue<StreamChatGenerics>>> => {\n const WithMessagesContextComponent = (\n props: Omit<P, keyof MessagesContextValue<StreamChatGenerics>>,\n ) => {\n const messagesContext = useMessagesContext<StreamChatGenerics>();\n\n return <Component {...(props as P)} {...messagesContext} />;\n };\n WithMessagesContextComponent.displayName = `WithMessagesContext${getDisplayName(Component)}`;\n return WithMessagesContextComponent;\n};\n"]}
|
|
@@ -100,9 +100,7 @@ var styles = _reactNative.StyleSheet.create({
|
|
|
100
100
|
var AudioAttachmentWithContext = function AudioAttachmentWithContext(props) {
|
|
101
101
|
var soundRef = _react["default"].useRef(null);
|
|
102
102
|
|
|
103
|
-
var
|
|
104
|
-
index = props.index,
|
|
105
|
-
item = props.item,
|
|
103
|
+
var item = props.item,
|
|
106
104
|
onLoad = props.onLoad,
|
|
107
105
|
onPlayPause = props.onPlayPause,
|
|
108
106
|
onProgress = props.onProgress;
|
|
@@ -355,16 +353,13 @@ var AudioAttachmentWithContext = function AudioAttachmentWithContext(props) {
|
|
|
355
353
|
accent_blue = _useTheme$theme$color.accent_blue,
|
|
356
354
|
black = _useTheme$theme$color.black,
|
|
357
355
|
grey_dark = _useTheme$theme$color.grey_dark,
|
|
358
|
-
grey_whisper = _useTheme$theme$color.grey_whisper,
|
|
359
356
|
static_black = _useTheme$theme$color.static_black,
|
|
360
357
|
static_white = _useTheme$theme$color.static_white,
|
|
361
|
-
white = _useTheme$theme$color.white,
|
|
362
358
|
_useTheme$theme$messa = _useTheme$theme.messageInput.fileUploadPreview,
|
|
363
359
|
_useTheme$theme$messa2 = _useTheme$theme$messa.audioAttachment,
|
|
364
360
|
progressControlView = _useTheme$theme$messa2.progressControlView,
|
|
365
361
|
progressDurationText = _useTheme$theme$messa2.progressDurationText,
|
|
366
362
|
roundedView = _useTheme$theme$messa2.roundedView,
|
|
367
|
-
fileContainer = _useTheme$theme$messa.fileContainer,
|
|
368
363
|
fileContentContainer = _useTheme$theme$messa.fileContentContainer,
|
|
369
364
|
filenameText = _useTheme$theme$messa.filenameText,
|
|
370
365
|
fileTextContainer = _useTheme$theme$messa.fileTextContainer;
|
|
@@ -373,27 +368,12 @@ var AudioAttachmentWithContext = function AudioAttachmentWithContext(props) {
|
|
|
373
368
|
var progressDuration = progressValueInSeconds ? progressValueInSeconds / 3600 >= 1 ? _dayjs["default"].duration(progressValueInSeconds, 'second').format('HH:mm:ss') : _dayjs["default"].duration(progressValueInSeconds, 'second').format('mm:ss') : '00:00';
|
|
374
369
|
var lastIndexOfDot = item.file.name.lastIndexOf('.');
|
|
375
370
|
return _react["default"].createElement(_reactNative.View, {
|
|
376
|
-
style: [styles.fileContainer, index === fileUploads.length - 1 ? {
|
|
377
|
-
marginBottom: 0
|
|
378
|
-
} : {}, {
|
|
379
|
-
backgroundColor: white,
|
|
380
|
-
borderColor: grey_whisper,
|
|
381
|
-
width: -16
|
|
382
|
-
}, fileContainer],
|
|
383
|
-
testID: "audio-attachment-upload-preview",
|
|
384
|
-
__self: _this,
|
|
385
|
-
__source: {
|
|
386
|
-
fileName: _jsxFileName,
|
|
387
|
-
lineNumber: 239,
|
|
388
|
-
columnNumber: 5
|
|
389
|
-
}
|
|
390
|
-
}, _react["default"].createElement(_reactNative.View, {
|
|
391
371
|
style: [styles.fileContentContainer, fileContentContainer],
|
|
392
372
|
__self: _this,
|
|
393
373
|
__source: {
|
|
394
374
|
fileName: _jsxFileName,
|
|
395
|
-
lineNumber:
|
|
396
|
-
columnNumber:
|
|
375
|
+
lineNumber: 222,
|
|
376
|
+
columnNumber: 5
|
|
397
377
|
}
|
|
398
378
|
}, _react["default"].createElement(_reactNative.TouchableOpacity, {
|
|
399
379
|
accessibilityLabel: "Play Pause Button",
|
|
@@ -407,8 +387,8 @@ var AudioAttachmentWithContext = function AudioAttachmentWithContext(props) {
|
|
|
407
387
|
__self: _this,
|
|
408
388
|
__source: {
|
|
409
389
|
fileName: _jsxFileName,
|
|
410
|
-
lineNumber:
|
|
411
|
-
columnNumber:
|
|
390
|
+
lineNumber: 223,
|
|
391
|
+
columnNumber: 7
|
|
412
392
|
}
|
|
413
393
|
}, item.paused ? _react["default"].createElement(_icons.Play, {
|
|
414
394
|
height: 24,
|
|
@@ -417,8 +397,8 @@ var AudioAttachmentWithContext = function AudioAttachmentWithContext(props) {
|
|
|
417
397
|
__self: _this,
|
|
418
398
|
__source: {
|
|
419
399
|
fileName: _jsxFileName,
|
|
420
|
-
lineNumber:
|
|
421
|
-
columnNumber:
|
|
400
|
+
lineNumber: 233,
|
|
401
|
+
columnNumber: 11
|
|
422
402
|
}
|
|
423
403
|
}) : _react["default"].createElement(_icons.Pause, {
|
|
424
404
|
height: 24,
|
|
@@ -427,16 +407,16 @@ var AudioAttachmentWithContext = function AudioAttachmentWithContext(props) {
|
|
|
427
407
|
__self: _this,
|
|
428
408
|
__source: {
|
|
429
409
|
fileName: _jsxFileName,
|
|
430
|
-
lineNumber:
|
|
431
|
-
columnNumber:
|
|
410
|
+
lineNumber: 235,
|
|
411
|
+
columnNumber: 11
|
|
432
412
|
}
|
|
433
413
|
})), _react["default"].createElement(_reactNative.View, {
|
|
434
414
|
style: [styles.fileTextContainer, fileTextContainer],
|
|
435
415
|
__self: _this,
|
|
436
416
|
__source: {
|
|
437
417
|
fileName: _jsxFileName,
|
|
438
|
-
lineNumber:
|
|
439
|
-
columnNumber:
|
|
418
|
+
lineNumber: 238,
|
|
419
|
+
columnNumber: 7
|
|
440
420
|
}
|
|
441
421
|
}, _react["default"].createElement(_reactNative.Text, {
|
|
442
422
|
accessibilityLabel: "File Name",
|
|
@@ -452,8 +432,8 @@ var AudioAttachmentWithContext = function AudioAttachmentWithContext(props) {
|
|
|
452
432
|
__self: _this,
|
|
453
433
|
__source: {
|
|
454
434
|
fileName: _jsxFileName,
|
|
455
|
-
lineNumber:
|
|
456
|
-
columnNumber:
|
|
435
|
+
lineNumber: 239,
|
|
436
|
+
columnNumber: 9
|
|
457
437
|
}
|
|
458
438
|
}, item.file.name.slice(0, 12) + '...' + item.file.name.slice(lastIndexOfDot)), _react["default"].createElement(_reactNative.View, {
|
|
459
439
|
style: {
|
|
@@ -464,8 +444,8 @@ var AudioAttachmentWithContext = function AudioAttachmentWithContext(props) {
|
|
|
464
444
|
__self: _this,
|
|
465
445
|
__source: {
|
|
466
446
|
fileName: _jsxFileName,
|
|
467
|
-
lineNumber:
|
|
468
|
-
columnNumber:
|
|
447
|
+
lineNumber: 258,
|
|
448
|
+
columnNumber: 9
|
|
469
449
|
}
|
|
470
450
|
}, _native.Sound.Player && _react["default"].createElement(_native.Sound.Player, {
|
|
471
451
|
onEnd: handleEnd,
|
|
@@ -478,8 +458,8 @@ var AudioAttachmentWithContext = function AudioAttachmentWithContext(props) {
|
|
|
478
458
|
__self: _this,
|
|
479
459
|
__source: {
|
|
480
460
|
fileName: _jsxFileName,
|
|
481
|
-
lineNumber:
|
|
482
|
-
columnNumber:
|
|
461
|
+
lineNumber: 267,
|
|
462
|
+
columnNumber: 13
|
|
483
463
|
}
|
|
484
464
|
}), _react["default"].createElement(_reactNative.Text, {
|
|
485
465
|
style: [styles.progressDurationText, {
|
|
@@ -488,16 +468,16 @@ var AudioAttachmentWithContext = function AudioAttachmentWithContext(props) {
|
|
|
488
468
|
__self: _this,
|
|
489
469
|
__source: {
|
|
490
470
|
fileName: _jsxFileName,
|
|
491
|
-
lineNumber:
|
|
492
|
-
columnNumber:
|
|
471
|
+
lineNumber: 277,
|
|
472
|
+
columnNumber: 11
|
|
493
473
|
}
|
|
494
474
|
}, progressDuration), _react["default"].createElement(_reactNative.View, {
|
|
495
475
|
style: [styles.progressControlView, progressControlView],
|
|
496
476
|
__self: _this,
|
|
497
477
|
__source: {
|
|
498
478
|
fileName: _jsxFileName,
|
|
499
|
-
lineNumber:
|
|
500
|
-
columnNumber:
|
|
479
|
+
lineNumber: 280,
|
|
480
|
+
columnNumber: 11
|
|
501
481
|
}
|
|
502
482
|
}, _react["default"].createElement(_ProgressControl.ProgressControl, {
|
|
503
483
|
duration: item.duration,
|
|
@@ -510,28 +490,19 @@ var AudioAttachmentWithContext = function AudioAttachmentWithContext(props) {
|
|
|
510
490
|
__self: _this,
|
|
511
491
|
__source: {
|
|
512
492
|
fileName: _jsxFileName,
|
|
513
|
-
lineNumber:
|
|
514
|
-
columnNumber:
|
|
493
|
+
lineNumber: 281,
|
|
494
|
+
columnNumber: 13
|
|
515
495
|
}
|
|
516
|
-
})))))
|
|
496
|
+
})))));
|
|
517
497
|
};
|
|
518
498
|
|
|
519
499
|
var AudioAttachment = function AudioAttachment(props) {
|
|
520
|
-
|
|
521
|
-
fileUploads = _useMessageInputConte.fileUploads,
|
|
522
|
-
removeFile = _useMessageInputConte.removeFile,
|
|
523
|
-
uploadFile = _useMessageInputConte.uploadFile;
|
|
524
|
-
|
|
525
|
-
return _react["default"].createElement(AudioAttachmentWithContext, (0, _extends2["default"])({
|
|
526
|
-
fileUploads: fileUploads,
|
|
527
|
-
removeFile: removeFile,
|
|
528
|
-
uploadFile: uploadFile
|
|
529
|
-
}, props, {
|
|
500
|
+
return _react["default"].createElement(AudioAttachmentWithContext, (0, _extends2["default"])({}, props, {
|
|
530
501
|
__self: _this,
|
|
531
502
|
__source: {
|
|
532
503
|
fileName: _jsxFileName,
|
|
533
|
-
lineNumber:
|
|
534
|
-
columnNumber:
|
|
504
|
+
lineNumber: 310,
|
|
505
|
+
columnNumber: 3
|
|
535
506
|
}
|
|
536
507
|
}));
|
|
537
508
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["AudioAttachment.tsx"],"names":["dayjs","extend","duration","FILE_PREVIEW_HEIGHT","styles","StyleSheet","create","fileContainer","borderRadius","borderWidth","flexDirection","height","paddingLeft","paddingRight","fileContentContainer","filenameText","fontSize","fontWeight","fileTextContainer","justifyContent","flatList","marginBottom","maxHeight","overlay","marginLeft","marginRight","progressControlView","flex","progressDurationText","roundedView","alignItems","alignSelf","display","elevation","shadowOffset","width","shadowOpacity","shadowRadius","AudioAttachmentWithContext","props","soundRef","React","useRef","fileUploads","index","item","onLoad","onPlayPause","onProgress","handleLoad","payload","id","handleProgress","data","currentTime","seekableDuration","handlePlayPause","isPausedStatusAvailable","current","undefined","progress","seek","setPositionAsync","paused","playAsync","pauseAsync","handleProgressDrag","position","handleEnd","onPlaybackStatusUpdate","playbackStatus","isLoaded","error","console","log","durationMillis","positionMillis","isPlaying","isBuffering","didJustFinish","isLooping","Sound","Player","initiateSound","file","uri","initializeSound","stopAsync","unloadAsync","initalPlayPause","theme","colors","accent_blue","black","grey_dark","grey_whisper","static_black","static_white","white","messageInput","fileUploadPreview","audioAttachment","progressValueInSeconds","progressDuration","format","lastIndexOfDot","name","lastIndexOf","length","backgroundColor","borderColor","shadowColor","color","I18nManager","isRTL","writingDirection","slice","AudioAttachment","removeFile","uploadFile","displayName"],"mappings":";;;;;;;;;;;;;;;AAAA;;AACA;;AAEA;;AACA;;AAEA;;AAMA;;AACA;;AAQA;;;;;;;;;AAEAA,kBAAMC,MAAN,CAAaC,o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AW,EAAXA,WAAlC;AAA+C2E,IAAAA,UAAU,EAAVA,UAA/C;AAA2DC,IAAAA,UAAU,EAAVA;AAA3D,KAA6EhF,KAA7E;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAAP;AACD,CARM;;;AAUP8E,eAAe,CAACG,WAAhB,GAA8B,+CAA9B","sourcesContent":["import React, { useEffect } from 'react';\nimport { I18nManager, StyleSheet, Text, TouchableOpacity, View } from 'react-native';\n\nimport dayjs from 'dayjs';\nimport duration from 'dayjs/plugin/duration';\n\nimport {\n FileUpload,\n MessageInputContextValue,\n useMessageInputContext,\n useTheme,\n} from '../../contexts';\nimport { Pause, Play } from '../../icons';\nimport {\n PlaybackStatus,\n Sound,\n SoundReturnType,\n VideoPayloadData,\n VideoProgressData,\n} from '../../native';\nimport type { DefaultStreamChatGenerics } from '../../types/types';\nimport { ProgressControl } from '../ProgressControl/ProgressControl';\n\ndayjs.extend(duration);\n\nconst FILE_PREVIEW_HEIGHT = 70;\n\nconst styles = StyleSheet.create({\n fileContainer: {\n borderRadius: 12,\n borderWidth: 1,\n flexDirection: 'row',\n height: FILE_PREVIEW_HEIGHT,\n paddingLeft: 8,\n paddingRight: 8,\n },\n fileContentContainer: { flexDirection: 'row', paddingRight: 40 },\n filenameText: {\n fontSize: 14,\n fontWeight: 'bold',\n paddingLeft: 10,\n },\n fileTextContainer: {\n justifyContent: 'space-around',\n },\n flatList: { marginBottom: 12, maxHeight: FILE_PREVIEW_HEIGHT * 2.5 + 16 },\n overlay: {\n borderRadius: 12,\n marginLeft: 8,\n marginRight: 8,\n },\n progressControlView: {\n flex: 8,\n },\n progressDurationText: {\n flex: 4,\n fontSize: 12,\n paddingLeft: 10,\n paddingRight: 8,\n },\n roundedView: {\n alignItems: 'center',\n alignSelf: 'center',\n borderRadius: 50,\n display: 'flex',\n elevation: 4,\n height: 36,\n justifyContent: 'center',\n shadowOffset: {\n height: 2,\n width: 0,\n },\n shadowOpacity: 0.23,\n shadowRadius: 2.62,\n width: 36,\n },\n});\n\nexport type AudioAttachmentPropsWithContext<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = Pick<\n MessageInputContextValue<StreamChatGenerics>,\n 'fileUploads' | 'removeFile' | 'uploadFile'\n> & {\n index: number;\n item: Omit<FileUpload, 'state'>;\n onLoad: (index: string, duration: number) => void;\n onPlayPause: (index: string, pausedStatus?: boolean) => void;\n onProgress: (index: string, currentTime?: number, hasEnd?: boolean) => void;\n testID?: string;\n};\n\nconst AudioAttachmentWithContext = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n props: AudioAttachmentPropsWithContext<StreamChatGenerics>,\n) => {\n const soundRef = React.useRef<SoundReturnType | null>(null);\n const { fileUploads, index, item, onLoad, onPlayPause, onProgress } = props;\n\n const handleLoad = (payload: VideoPayloadData) => {\n onLoad(item.id, payload.duration);\n };\n\n const handleProgress = (data: VideoProgressData) => {\n if (data.currentTime && data.seekableDuration) {\n onProgress(item.id, data.currentTime);\n }\n };\n\n const handlePlayPause = async (isPausedStatusAvailable?: boolean) => {\n if (soundRef.current) {\n if (isPausedStatusAvailable === undefined) {\n if (item.progress === 1) {\n // For native CLI\n if (soundRef.current.seek) soundRef.current.seek(0);\n // For expo CLI\n if (soundRef.current.setPositionAsync) soundRef.current.setPositionAsync(0);\n }\n if (item.paused) {\n if (soundRef.current.playAsync) await soundRef.current.playAsync();\n onPlayPause(item.id, false);\n } else {\n if (soundRef.current.pauseAsync) await soundRef.current.pauseAsync();\n onPlayPause(item.id, true);\n }\n } else {\n onPlayPause(item.id, isPausedStatusAvailable);\n }\n }\n };\n\n const handleProgressDrag = async (position: number) => {\n onProgress(item.id, position);\n if (soundRef.current?.seek) soundRef.current.seek(position);\n if (soundRef.current?.setPositionAsync) {\n await soundRef.current.setPositionAsync(position * 1000);\n }\n };\n\n const handleEnd = () => {\n onPlayPause(item.id, true);\n onProgress(item.id, item.duration, true);\n };\n\n const onPlaybackStatusUpdate = (playbackStatus: PlaybackStatus) => {\n if (!playbackStatus.isLoaded) {\n // Update your UI for the unloaded state\n if (playbackStatus.error) {\n console.log(`Encountered a fatal error during playback: ${playbackStatus.error}`);\n }\n } else {\n const { durationMillis, positionMillis } = playbackStatus;\n onLoad(item.id, durationMillis / 1000);\n // Update your UI for the loaded state\n if (playbackStatus.isPlaying) {\n // Update your UI for the playing state\n onProgress(item.id, positionMillis / 1000);\n } else {\n // Update your UI for the paused state\n }\n\n if (playbackStatus.isBuffering) {\n // Update your UI for the buffering state\n }\n\n if (playbackStatus.didJustFinish && !playbackStatus.isLooping) {\n // The player has just finished playing and will stop. Maybe you want to play something else?\n // status: opposite of pause,says i am playing\n handleEnd();\n }\n }\n };\n\n useEffect(() => {\n if (Sound.Player === null) {\n const initiateSound = async () => {\n if (item && item.file && item.file.uri) {\n soundRef.current = await Sound.initializeSound(\n { uri: item.file.uri },\n {},\n onPlaybackStatusUpdate,\n );\n }\n };\n initiateSound();\n }\n\n return () => {\n if (soundRef.current?.stopAsync && soundRef.current.unloadAsync) {\n soundRef.current.stopAsync();\n soundRef.current.unloadAsync();\n }\n };\n }, []);\n\n // This is needed for expo applications where the rerender doesn't occur on time thefore you need to update the state of the sound.\n useEffect(() => {\n const initalPlayPause = async () => {\n if (soundRef.current) {\n if (item.paused) {\n if (soundRef.current.pauseAsync) await soundRef.current.pauseAsync();\n } else {\n if (soundRef.current.playAsync) await soundRef.current.playAsync();\n }\n }\n };\n if (!Sound.Player) {\n initalPlayPause();\n }\n }, [item.paused]);\n\n const {\n theme: {\n colors: { accent_blue, black, grey_dark, grey_whisper, static_black, static_white, white },\n messageInput: {\n fileUploadPreview: {\n audioAttachment: { progressControlView, progressDurationText, roundedView },\n fileContainer,\n fileContentContainer,\n filenameText,\n fileTextContainer,\n },\n },\n },\n } = useTheme();\n\n const progressValueInSeconds = (item.duration as number) * (item.progress as number);\n\n const progressDuration = progressValueInSeconds\n ? progressValueInSeconds / 3600 >= 1\n ? dayjs.duration(progressValueInSeconds, 'second').format('HH:mm:ss')\n : dayjs.duration(progressValueInSeconds, 'second').format('mm:ss')\n : '00:00';\n\n const lastIndexOfDot = item.file.name.lastIndexOf('.');\n\n return (\n <View\n style={[\n styles.fileContainer,\n index === fileUploads.length - 1\n ? {\n marginBottom: 0,\n }\n : {},\n {\n backgroundColor: white,\n borderColor: grey_whisper,\n width: -16,\n },\n fileContainer,\n ]}\n testID='audio-attachment-upload-preview'\n >\n <View style={[styles.fileContentContainer, fileContentContainer]}>\n <TouchableOpacity\n accessibilityLabel='Play Pause Button'\n onPress={() => handlePlayPause()}\n style={[\n styles.roundedView,\n roundedView,\n { backgroundColor: static_white, shadowColor: black },\n ]}\n >\n {item.paused ? (\n <Play height={24} pathFill={static_black} width={24} />\n ) : (\n <Pause height={24} pathFill={static_black} width={24} />\n )}\n </TouchableOpacity>\n <View style={[styles.fileTextContainer, fileTextContainer]}>\n <Text\n accessibilityLabel='File Name'\n numberOfLines={1}\n style={[\n styles.filenameText,\n {\n color: black,\n width:\n 16 - // 16 = horizontal padding\n 40 - // 40 = file icon size\n 24 - // 24 = close icon size\n 24, // 24 = internal padding\n },\n I18nManager.isRTL ? { writingDirection: 'rtl' } : { writingDirection: 'ltr' },\n filenameText,\n ]}\n >\n {item.file.name.slice(0, 12) + '...' + item.file.name.slice(lastIndexOfDot)}\n </Text>\n <View\n style={{\n alignItems: 'center',\n display: 'flex',\n flexDirection: 'row',\n }}\n >\n {/* <ExpoSoundPlayer filePaused={!!item.paused} soundRef={soundRef} /> */}\n {Sound.Player && (\n <Sound.Player\n onEnd={handleEnd}\n onLoad={handleLoad}\n onProgress={handleProgress}\n paused={item.paused as boolean}\n soundRef={soundRef}\n testID='sound-player'\n uri={item.file.uri}\n />\n )}\n <Text style={[styles.progressDurationText, { color: grey_dark }, progressDurationText]}>\n {progressDuration}\n </Text>\n <View style={[styles.progressControlView, progressControlView]}>\n <ProgressControl\n duration={item.duration as number}\n filledColor={accent_blue}\n onPlayPause={handlePlayPause}\n onProgressDrag={handleProgressDrag}\n progress={item.progress as number}\n testID='progress-control'\n width={120}\n />\n </View>\n </View>\n </View>\n </View>\n </View>\n );\n};\n\nexport type AudioAttachmentProps<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = Partial<AudioAttachmentPropsWithContext<StreamChatGenerics>> & {\n index: number;\n item: Omit<FileUpload, 'state'>;\n onLoad: (index: string, duration: number) => void;\n onPlayPause: (index: string, pausedStatus?: boolean) => void;\n onProgress: (index: string, currentTime?: number, hasEnd?: boolean) => void;\n testID: string;\n};\n\n/**\n * AudioAttachment\n * UI Component to preview the audio files\n */\nexport const AudioAttachment = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n props: AudioAttachmentProps<StreamChatGenerics>,\n) => {\n const { fileUploads, removeFile, uploadFile } = useMessageInputContext<StreamChatGenerics>();\n\n return <AudioAttachmentWithContext {...{ fileUploads, removeFile, uploadFile }} {...props} />;\n};\n\nAudioAttachment.displayName = 'AudioAttachment{messageInput{autoAttachment}}';\n"]}
|
|
1
|
+
{"version":3,"sources":["AudioAttachment.tsx"],"names":["dayjs","extend","duration","FILE_PREVIEW_HEIGHT","styles","StyleSheet","create","fileContainer","borderRadius","borderWidth","flexDirection","height","paddingLeft","paddingRight","fileContentContainer","filenameText","fontSize","fontWeight","fileTextContainer","justifyContent","flatList","marginBottom","maxHeight","overlay","marginLeft","marginRight","progressControlView","flex","progressDurationText","roundedView","alignItems","alignSelf","display","elevation","shadowOffset","width","shadowOpacity","shadowRadius","AudioAttachmentWithContext","props","soundRef","React","useRef","item","onLoad","onPlayPause","onProgress","handleLoad","payload","id","handleProgress","data","currentTime","seekableDuration","handlePlayPause","isPausedStatusAvailable","current","undefined","progress","seek","setPositionAsync","paused","playAsync","pauseAsync","handleProgressDrag","position","handleEnd","onPlaybackStatusUpdate","playbackStatus","isLoaded","error","console","log","durationMillis","positionMillis","isPlaying","isBuffering","didJustFinish","isLooping","Sound","Player","initiateSound","file","uri","initializeSound","stopAsync","unloadAsync","initalPlayPause","theme","colors","accent_blue","black","grey_dark","static_black","static_white","messageInput","fileUploadPreview","audioAttachment","progressValueInSeconds","progressDuration","format","lastIndexOfDot","name","lastIndexOf","backgroundColor","shadowColor","color","I18nManager","isRTL","writingDirection","slice","AudioAttachment","displayName"],"mappings":";;;;;;;;;;;;;;;AAAA;;AACA;;AAEA;;AACA;;AAEA;;AACA;;AACA;;AAOA;;;;;;;;;AAEAA,kBAAMC,MAAN,CAAaC,oBAAb;;AAEA,IAAMC,mBAAmB,GAAG,EAA5B;;AAEA,IAAMC,MAAM,GAAGC,wBAAWC,MAAX,CAAkB;AAC/BC,EAAAA,aAAa,EAAE;AACbC,IAAAA,YAAY,EAAE,EADD;AAEbC,IAAAA,WAAW,EAAE,CAFA;AAGbC,IAAAA,aAAa,EAAE,KAHF;AAIbC,IAAAA,MAAM,EAAER,mBAJK;AAKbS,IAAAA,WAAW,EAAE,CALA;AAMbC,IAAAA,YAAY,EAAE;AAND,GADgB;AAS/BC,EAAAA,oBAAoB,EAAE;AAAEJ,IAAAA,aAAa,EAAE,KAAjB;AAAwBG,IAAAA,YAAY,EAAE;AAAtC,GATS;AAU/BE,EAAAA,YAAY,EAAE;AACZC,IAAAA,QAAQ,EAAE,EADE;AAEZC,IAAAA,UAAU,EAAE,MAFA;AAGZL,IAAAA,WAAW,EAAE;AAHD,GAViB;AAe/BM,EAAAA,iBAAiB,EAAE;AACjBC,IAAAA,cAAc,EAAE;AADC,GAfY;AAkB/BC,EAAAA,QAAQ,EAAE;AAAEC,IAAAA,YAAY,EAAE,EAAhB;AAAoBC,IAAAA,SAAS,EAAEnB,mBAAmB,GAAG,GAAtB,GAA4B;AAA3D,GAlBqB;AAmB/BoB,EAAAA,OAAO,EAAE;AACPf,IAAAA,YAAY,EAAE,EADP;AAEPgB,IAAAA,UAAU,EAAE,CAFL;AAGPC,IAAAA,WAAW,EAAE;AAHN,GAnB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,IATJ,EAmBE,gCAAC,iBAAD;AAAM,IAAA,KAAK,EAAE,CAAC/E,MAAM,CAACwB,oBAAR,EAA8B;AAAE8E,MAAAA,KAAK,EAAEd;AAAT,KAA9B,EAAoDhE,oBAApD,CAAb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACGuE,gBADH,CAnBF,EAsBE,gCAAC,iBAAD;AAAM,IAAA,KAAK,EAAE,CAAC/F,MAAM,CAACsB,mBAAR,EAA6BA,mBAA7B,CAAb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACE,gCAAC,gCAAD;AACE,IAAA,QAAQ,EAAEiB,IAAI,CAACzC,QADjB;AAEE,IAAA,WAAW,EAAEwF,WAFf;AAGE,IAAA,WAAW,EAAEpC,eAHf;AAIE,IAAA,cAAc,EAAEU,kBAJlB;AAKE,IAAA,QAAQ,EAAErB,IAAI,CAACe,QALjB;AAME,IAAA,MAAM,EAAC,kBANT;AAOE,IAAA,KAAK,EAAE,GAPT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IADF,CAtBF,CApBF,CAhBF,CADF;AA0ED,CAtND;;AAoOO,IAAMqD,eAAe,GAAG,SAAlBA,eAAkB,CAACxE,KAAD;AAAA,SAC7B,gCAAC,0BAAD,gCAAgCA,KAAhC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAD6B;AAAA,CAAxB;;;AAIPwE,eAAe,CAACC,WAAhB,GAA8B,+CAA9B","sourcesContent":["import React, { useEffect } from 'react';\nimport { I18nManager, StyleSheet, Text, TouchableOpacity, View } from 'react-native';\n\nimport dayjs from 'dayjs';\nimport duration from 'dayjs/plugin/duration';\n\nimport { FileUpload, useTheme } from '../../contexts';\nimport { Pause, Play } from '../../icons';\nimport {\n PlaybackStatus,\n Sound,\n SoundReturnType,\n VideoPayloadData,\n VideoProgressData,\n} from '../../native';\nimport { ProgressControl } from '../ProgressControl/ProgressControl';\n\ndayjs.extend(duration);\n\nconst FILE_PREVIEW_HEIGHT = 70;\n\nconst styles = StyleSheet.create({\n fileContainer: {\n borderRadius: 12,\n borderWidth: 1,\n flexDirection: 'row',\n height: FILE_PREVIEW_HEIGHT,\n paddingLeft: 8,\n paddingRight: 8,\n },\n fileContentContainer: { flexDirection: 'row', paddingRight: 40 },\n filenameText: {\n fontSize: 14,\n fontWeight: 'bold',\n paddingLeft: 10,\n },\n fileTextContainer: {\n justifyContent: 'space-around',\n },\n flatList: { marginBottom: 12, maxHeight: FILE_PREVIEW_HEIGHT * 2.5 + 16 },\n overlay: {\n borderRadius: 12,\n marginLeft: 8,\n marginRight: 8,\n },\n progressControlView: {\n flex: 8,\n },\n progressDurationText: {\n flex: 4,\n fontSize: 12,\n paddingLeft: 10,\n paddingRight: 8,\n },\n roundedView: {\n alignItems: 'center',\n alignSelf: 'center',\n borderRadius: 50,\n display: 'flex',\n elevation: 4,\n height: 36,\n justifyContent: 'center',\n shadowOffset: {\n height: 2,\n width: 0,\n },\n shadowOpacity: 0.23,\n shadowRadius: 2.62,\n width: 36,\n },\n});\n\nexport type AudioAttachmentPropsWithContext = {\n item: Omit<FileUpload, 'state'>;\n onLoad: (index: string, duration: number) => void;\n onPlayPause: (index: string, pausedStatus?: boolean) => void;\n onProgress: (index: string, currentTime?: number, hasEnd?: boolean) => void;\n testID?: string;\n};\n\nconst AudioAttachmentWithContext = (props: AudioAttachmentPropsWithContext) => {\n const soundRef = React.useRef<SoundReturnType | null>(null);\n const { item, onLoad, onPlayPause, onProgress } = props;\n\n const handleLoad = (payload: VideoPayloadData) => {\n onLoad(item.id, payload.duration);\n };\n\n const handleProgress = (data: VideoProgressData) => {\n if (data.currentTime && data.seekableDuration) {\n onProgress(item.id, data.currentTime);\n }\n };\n\n const handlePlayPause = async (isPausedStatusAvailable?: boolean) => {\n if (soundRef.current) {\n if (isPausedStatusAvailable === undefined) {\n if (item.progress === 1) {\n // For native CLI\n if (soundRef.current.seek) soundRef.current.seek(0);\n // For expo CLI\n if (soundRef.current.setPositionAsync) soundRef.current.setPositionAsync(0);\n }\n if (item.paused) {\n if (soundRef.current.playAsync) await soundRef.current.playAsync();\n onPlayPause(item.id, false);\n } else {\n if (soundRef.current.pauseAsync) await soundRef.current.pauseAsync();\n onPlayPause(item.id, true);\n }\n } else {\n onPlayPause(item.id, isPausedStatusAvailable);\n }\n }\n };\n\n const handleProgressDrag = async (position: number) => {\n onProgress(item.id, position);\n if (soundRef.current?.seek) soundRef.current.seek(position);\n if (soundRef.current?.setPositionAsync) {\n await soundRef.current.setPositionAsync(position * 1000);\n }\n };\n\n const handleEnd = () => {\n onPlayPause(item.id, true);\n onProgress(item.id, item.duration, true);\n };\n\n const onPlaybackStatusUpdate = (playbackStatus: PlaybackStatus) => {\n if (!playbackStatus.isLoaded) {\n // Update your UI for the unloaded state\n if (playbackStatus.error) {\n console.log(`Encountered a fatal error during playback: ${playbackStatus.error}`);\n }\n } else {\n const { durationMillis, positionMillis } = playbackStatus;\n onLoad(item.id, durationMillis / 1000);\n // Update your UI for the loaded state\n if (playbackStatus.isPlaying) {\n // Update your UI for the playing state\n onProgress(item.id, positionMillis / 1000);\n } else {\n // Update your UI for the paused state\n }\n\n if (playbackStatus.isBuffering) {\n // Update your UI for the buffering state\n }\n\n if (playbackStatus.didJustFinish && !playbackStatus.isLooping) {\n // The player has just finished playing and will stop. Maybe you want to play something else?\n // status: opposite of pause,says i am playing\n handleEnd();\n }\n }\n };\n\n useEffect(() => {\n if (Sound.Player === null) {\n const initiateSound = async () => {\n if (item && item.file && item.file.uri) {\n soundRef.current = await Sound.initializeSound(\n { uri: item.file.uri },\n {},\n onPlaybackStatusUpdate,\n );\n }\n };\n initiateSound();\n }\n\n return () => {\n if (soundRef.current?.stopAsync && soundRef.current.unloadAsync) {\n soundRef.current.stopAsync();\n soundRef.current.unloadAsync();\n }\n };\n }, []);\n\n // This is needed for expo applications where the rerender doesn't occur on time thefore you need to update the state of the sound.\n useEffect(() => {\n const initalPlayPause = async () => {\n if (soundRef.current) {\n if (item.paused) {\n if (soundRef.current.pauseAsync) await soundRef.current.pauseAsync();\n } else {\n if (soundRef.current.playAsync) await soundRef.current.playAsync();\n }\n }\n };\n if (!Sound.Player) {\n initalPlayPause();\n }\n }, [item.paused]);\n\n const {\n theme: {\n colors: { accent_blue, black, grey_dark, static_black, static_white },\n messageInput: {\n fileUploadPreview: {\n audioAttachment: { progressControlView, progressDurationText, roundedView },\n fileContentContainer,\n filenameText,\n fileTextContainer,\n },\n },\n },\n } = useTheme();\n\n const progressValueInSeconds = (item.duration as number) * (item.progress as number);\n\n const progressDuration = progressValueInSeconds\n ? progressValueInSeconds / 3600 >= 1\n ? dayjs.duration(progressValueInSeconds, 'second').format('HH:mm:ss')\n : dayjs.duration(progressValueInSeconds, 'second').format('mm:ss')\n : '00:00';\n\n const lastIndexOfDot = item.file.name.lastIndexOf('.');\n\n return (\n <View style={[styles.fileContentContainer, fileContentContainer]}>\n <TouchableOpacity\n accessibilityLabel='Play Pause Button'\n onPress={() => handlePlayPause()}\n style={[\n styles.roundedView,\n roundedView,\n { backgroundColor: static_white, shadowColor: black },\n ]}\n >\n {item.paused ? (\n <Play height={24} pathFill={static_black} width={24} />\n ) : (\n <Pause height={24} pathFill={static_black} width={24} />\n )}\n </TouchableOpacity>\n <View style={[styles.fileTextContainer, fileTextContainer]}>\n <Text\n accessibilityLabel='File Name'\n numberOfLines={1}\n style={[\n styles.filenameText,\n {\n color: black,\n width:\n 16 - // 16 = horizontal padding\n 40 - // 40 = file icon size\n 24 - // 24 = close icon size\n 24, // 24 = internal padding\n },\n I18nManager.isRTL ? { writingDirection: 'rtl' } : { writingDirection: 'ltr' },\n filenameText,\n ]}\n >\n {item.file.name.slice(0, 12) + '...' + item.file.name.slice(lastIndexOfDot)}\n </Text>\n <View\n style={{\n alignItems: 'center',\n display: 'flex',\n flexDirection: 'row',\n }}\n >\n {/* <ExpoSoundPlayer filePaused={!!item.paused} soundRef={soundRef} /> */}\n {Sound.Player && (\n <Sound.Player\n onEnd={handleEnd}\n onLoad={handleLoad}\n onProgress={handleProgress}\n paused={item.paused as boolean}\n soundRef={soundRef}\n testID='sound-player'\n uri={item.file.uri}\n />\n )}\n <Text style={[styles.progressDurationText, { color: grey_dark }, progressDurationText]}>\n {progressDuration}\n </Text>\n <View style={[styles.progressControlView, progressControlView]}>\n <ProgressControl\n duration={item.duration as number}\n filledColor={accent_blue}\n onPlayPause={handlePlayPause}\n onProgressDrag={handleProgressDrag}\n progress={item.progress as number}\n testID='progress-control'\n width={120}\n />\n </View>\n </View>\n </View>\n </View>\n );\n};\n\nexport type AudioAttachmentProps = Partial<AudioAttachmentPropsWithContext> & {\n item: Omit<FileUpload, 'state'>;\n onLoad: (index: string, duration: number) => void;\n onPlayPause: (index: string, pausedStatus?: boolean) => void;\n onProgress: (index: string, currentTime?: number, hasEnd?: boolean) => void;\n testID: string;\n};\n\n/**\n * AudioAttachment\n * UI Component to preview the audio files\n */\nexport const AudioAttachment = (props: AudioAttachmentProps) => (\n <AudioAttachmentWithContext {...props} />\n);\n\nAudioAttachment.displayName = 'AudioAttachment{messageInput{autoAttachment}}';\n"]}
|