stream-chat-react-native-core 4.3.0 → 4.3.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/Giphy.js +26 -22
- package/lib/commonjs/components/Attachment/Giphy.js.map +1 -1
- package/lib/commonjs/components/AttachmentPicker/AttachmentPicker.js.map +1 -1
- package/lib/commonjs/components/Channel/Channel.js.map +1 -1
- package/lib/commonjs/components/Chat/Chat.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/ImageGallery.js +21 -20
- package/lib/commonjs/components/ImageGallery/ImageGallery.js.map +1 -1
- package/lib/commonjs/components/Message/Message.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageContent.js +4 -4
- package/lib/commonjs/components/Message/MessageSimple/MessageContent.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageSimple.js +4 -4
- package/lib/commonjs/components/Message/MessageSimple/MessageSimple.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/utils/renderText.md +1 -1
- package/lib/commonjs/contexts/attachmentPickerContext/AttachmentPickerContext.js.map +1 -1
- package/lib/commonjs/contexts/channelContext/ChannelContext.js.map +1 -1
- package/lib/commonjs/contexts/channelContext/ChannelContext.md +2 -2
- package/lib/commonjs/contexts/channelsContext/ChannelsContext.js.map +1 -1
- package/lib/commonjs/contexts/channelsContext/ChannelsContext.md +2 -2
- package/lib/commonjs/contexts/chatContext/ChatContext.md +2 -2
- package/lib/commonjs/contexts/imageGalleryContext/ImageGalleryContext.md +2 -2
- package/lib/commonjs/contexts/keyboardContext/KeyboardContext.md +1 -1
- package/lib/commonjs/contexts/messageContext/MessageContext.js.map +1 -1
- package/lib/commonjs/contexts/messageContext/MessageContext.md +1 -1
- package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/MessageInputContext.md +1 -1
- package/lib/commonjs/contexts/messageOverlayContext/MessageOverlayContext.js.map +1 -1
- package/lib/commonjs/contexts/messagesContext/MessagesContext.js.map +1 -1
- package/lib/commonjs/contexts/messagesContext/MessagesContext.md +1 -1
- package/lib/commonjs/contexts/overlayContext/OverlayContext.js.map +1 -1
- package/lib/commonjs/contexts/overlayContext/OverlayContext.md +2 -2
- package/lib/commonjs/contexts/overlayContext/OverlayProvider.js +1 -2
- package/lib/commonjs/contexts/overlayContext/OverlayProvider.js.map +1 -1
- package/lib/commonjs/contexts/paginatedMessageListContext/PaginatedMessageListContext.md +2 -2
- package/lib/commonjs/contexts/suggestionsContext/SuggestionsContext.md +1 -1
- package/lib/commonjs/contexts/typingContext/TypingContext.md +2 -2
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/Attachment/Giphy.js +26 -22
- package/lib/module/components/Attachment/Giphy.js.map +1 -1
- package/lib/module/components/AttachmentPicker/AttachmentPicker.js.map +1 -1
- package/lib/module/components/Channel/Channel.js.map +1 -1
- package/lib/module/components/Chat/Chat.js.map +1 -1
- package/lib/module/components/ImageGallery/ImageGallery.js +21 -20
- package/lib/module/components/ImageGallery/ImageGallery.js.map +1 -1
- package/lib/module/components/Message/Message.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/MessageContent.js +4 -4
- package/lib/module/components/Message/MessageSimple/MessageContent.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/MessageSimple.js +4 -4
- package/lib/module/components/Message/MessageSimple/MessageSimple.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/utils/renderText.md +1 -1
- package/lib/module/contexts/attachmentPickerContext/AttachmentPickerContext.js.map +1 -1
- package/lib/module/contexts/channelContext/ChannelContext.js.map +1 -1
- package/lib/module/contexts/channelContext/ChannelContext.md +2 -2
- package/lib/module/contexts/channelsContext/ChannelsContext.js.map +1 -1
- package/lib/module/contexts/channelsContext/ChannelsContext.md +2 -2
- package/lib/module/contexts/chatContext/ChatContext.md +2 -2
- package/lib/module/contexts/imageGalleryContext/ImageGalleryContext.md +2 -2
- package/lib/module/contexts/keyboardContext/KeyboardContext.md +1 -1
- package/lib/module/contexts/messageContext/MessageContext.js.map +1 -1
- package/lib/module/contexts/messageContext/MessageContext.md +1 -1
- package/lib/module/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/module/contexts/messageInputContext/MessageInputContext.md +1 -1
- package/lib/module/contexts/messageOverlayContext/MessageOverlayContext.js.map +1 -1
- package/lib/module/contexts/messagesContext/MessagesContext.js.map +1 -1
- package/lib/module/contexts/messagesContext/MessagesContext.md +1 -1
- package/lib/module/contexts/overlayContext/OverlayContext.js.map +1 -1
- package/lib/module/contexts/overlayContext/OverlayContext.md +2 -2
- package/lib/module/contexts/overlayContext/OverlayProvider.js +1 -2
- package/lib/module/contexts/overlayContext/OverlayProvider.js.map +1 -1
- package/lib/module/contexts/paginatedMessageListContext/PaginatedMessageListContext.md +2 -2
- package/lib/module/contexts/suggestionsContext/SuggestionsContext.md +1 -1
- package/lib/module/contexts/typingContext/TypingContext.md +2 -2
- package/lib/module/version.json +1 -1
- package/lib/typescript/components/AttachmentPicker/AttachmentPicker.d.ts +4 -4
- package/lib/typescript/components/Channel/Channel.d.ts +2 -2
- package/lib/typescript/components/Chat/Chat.d.ts +1 -1
- package/lib/typescript/components/ImageGallery/ImageGallery.d.ts +1 -7
- package/lib/typescript/components/Message/Message.d.ts +2 -2
- package/lib/typescript/contexts/attachmentPickerContext/AttachmentPickerContext.d.ts +3 -3
- package/lib/typescript/contexts/channelContext/ChannelContext.d.ts +2 -2
- package/lib/typescript/contexts/channelsContext/ChannelsContext.d.ts +6 -6
- package/lib/typescript/contexts/messageContext/MessageContext.d.ts +2 -2
- package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts +6 -6
- package/lib/typescript/contexts/messageOverlayContext/MessageOverlayContext.d.ts +3 -3
- package/lib/typescript/contexts/messagesContext/MessagesContext.d.ts +20 -20
- package/lib/typescript/contexts/overlayContext/OverlayContext.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/Attachment/Giphy.tsx +4 -0
- package/src/components/Attachment/__tests__/Attachment.test.js +0 -61
- package/src/components/Attachment/__tests__/Giphy.test.js +290 -0
- package/src/components/AttachmentPicker/AttachmentPicker.tsx +4 -4
- package/src/components/Channel/Channel.tsx +2 -2
- package/src/components/Channel/__tests__/isAttachmentEqualHandler.test.js +1 -1
- package/src/components/Chat/Chat.tsx +1 -1
- package/src/components/ImageGallery/ImageGallery.tsx +9 -8
- package/src/components/Message/Message.tsx +2 -2
- package/src/components/Message/MessageSimple/MessageContent.tsx +16 -17
- package/src/components/Message/MessageSimple/MessageSimple.tsx +11 -12
- package/src/components/Message/MessageSimple/utils/renderText.md +1 -1
- package/src/contexts/attachmentPickerContext/AttachmentPickerContext.tsx +3 -3
- package/src/contexts/channelContext/ChannelContext.md +2 -2
- package/src/contexts/channelContext/ChannelContext.tsx +2 -2
- package/src/contexts/channelsContext/ChannelsContext.md +2 -2
- package/src/contexts/channelsContext/ChannelsContext.tsx +6 -6
- package/src/contexts/chatContext/ChatContext.md +2 -2
- package/src/contexts/imageGalleryContext/ImageGalleryContext.md +2 -2
- package/src/contexts/keyboardContext/KeyboardContext.md +1 -1
- package/src/contexts/messageContext/MessageContext.md +1 -1
- package/src/contexts/messageContext/MessageContext.tsx +2 -2
- package/src/contexts/messageInputContext/MessageInputContext.md +1 -1
- package/src/contexts/messageInputContext/MessageInputContext.tsx +6 -6
- package/src/contexts/messageOverlayContext/MessageOverlayContext.tsx +3 -3
- package/src/contexts/messagesContext/MessagesContext.md +1 -1
- package/src/contexts/messagesContext/MessagesContext.tsx +20 -20
- package/src/contexts/overlayContext/OverlayContext.md +2 -2
- package/src/contexts/overlayContext/OverlayContext.tsx +1 -1
- package/src/contexts/overlayContext/OverlayProvider.tsx +1 -1
- package/src/contexts/paginatedMessageListContext/PaginatedMessageListContext.md +2 -2
- package/src/contexts/suggestionsContext/SuggestionsContext.md +1 -1
- package/src/contexts/typingContext/TypingContext.md +2 -2
- package/src/version.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["MessageOverlayContext.tsx"],"names":["MessageOverlayContext","React","createContext","MessageOverlayProvider","children","value","messageOverlayContext","useMessageOverlayContext","withMessageOverlayContext","Component","WithMessageOverlayContextComponent","props","messageContext","displayName"],"mappings":";;;;;;;;;;;AAAA;;AAIA;;AAgBA;;;;;;;;;AAoDO,IAAMA,qBAAqB,GAAGC,kBAAMC,aAAN,CAAoB,EAApB,CAA9B;;;;AAEA,IAAMC,sBAAsB,GAAG,SAAzBA,sBAAyB,OAO/B;AAAA,MAJLC,QAIK,QAJLA,QAIK;AAAA,MAHLC,KAGK,QAHLA,KAGK;AACL,MAAMC,qBAAqB,GAAG,4CAAmBD,KAAnB,CAA9B;AACA,SACE,gCAAC,qBAAD,CAAuB,QAAvB;AAAgC,IAAA,KAAK,EAAEC,qBAAvC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACGF,QADH,CADF;AAKD,CAdM;;;;AAgBA,IAAMG,wBAAwB,GAAG,SAA3BA,wBAA2B;AAAA,SAGtC,uBAAWP,qBAAX,CAHsC;AAAA,CAAjC;;;;AAUA,IAAMQ,yBAAyB,GAAG,SAA5BA,yBAA4B,CAIvCC,SAJuC,EAKqC;AAC5E,MAAMC,kCAAkC,GAAG,SAArCA,kCAAqC,CACzCC,KADyC,EAEtC;AACH,QAAMC,cAAc,GAAGL,wBAAwB,EAA/C;AAEA,WAAO,gCAAC,SAAD,gCAAgBI,KAAhB,EAAiCC,cAAjC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,OAAP;AACD,GAND;;AAOAF,EAAAA,kCAAkC,CAACG,WAAnC,iCAA6E,oCAC3EJ,SAD2E,CAA7E;AAGA,SAAOC,kCAAP;AACD,CAjBM","sourcesContent":["import React, { PropsWithChildren, useContext } from 'react';\n\nimport type { Attachment } from 'stream-chat';\n\nimport { useResettableState } from './hooks/useResettableState';\n\nimport type { GroupType, MessageType } from '../../components/MessageList/hooks/useMessageList';\nimport type { MessageActionListProps } from '../../components/MessageOverlay/MessageActionList';\nimport type {\n MessageActionListItemProps,\n MessageActionType,\n} from '../../components/MessageOverlay/MessageActionListItem';\nimport type { OverlayReactionListProps } from '../../components/MessageOverlay/OverlayReactionList';\nimport type { OverlayReactionsProps } from '../../components/MessageOverlay/OverlayReactions';\nimport type { OverlayReactionsAvatarProps } from '../../components/MessageOverlay/OverlayReactionsAvatar';\nimport type { DefaultStreamChatGenerics, UnknownType } from '../../types/types';\nimport type { ReactionData } from '../../utils/utils';\nimport type { Alignment, MessageContextValue } from '../messageContext/MessageContext';\nimport type { MessagesContextValue } from '../messagesContext/MessagesContext';\nimport type { OwnCapabilitiesContextValue } from '../ownCapabilitiesContext/OwnCapabilitiesContext';\nimport { getDisplayName } from '../utils/getDisplayName';\n\nexport type MessageOverlayData<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = {\n alignment?: Alignment;\n clientId?: string;\n files?: Attachment<StreamChatGenerics>[];\n groupStyles?: GroupType[];\n handleReaction?: (reactionType: string) => Promise<void>;\n images?: Attachment<StreamChatGenerics>[];\n message?: MessageType<StreamChatGenerics>;\n messageActions?: MessageActionType[];\n messageContext?: MessageContextValue<StreamChatGenerics>;\n messageReactionTitle?: string;\n messagesContext?: MessagesContextValue<StreamChatGenerics>;\n onlyEmojis?: boolean;\n otherAttachments?: Attachment<StreamChatGenerics>[];\n OverlayReactionList?: React.ComponentType<OverlayReactionListProps<StreamChatGenerics>>;\n ownCapabilities?: OwnCapabilitiesContextValue;\n supportedReactions?: ReactionData[];\n threadList?: boolean;\n};\n\nexport type MessageOverlayContextValue<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = {\n /**\n * Custom UI component for rendering [message actions](https://github.com/GetStream/stream-chat-react-native/blob/master/screenshots/docs/2.png) in overlay.\n *\n * **Default** [MessageActionList](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/MessageOverlay/MessageActions.tsx)\n */\n MessageActionList: React.ComponentType<MessageActionListProps<StreamChatGenerics>>;\n MessageActionListItem: React.ComponentType<MessageActionListItemProps<StreamChatGenerics>>;\n /**\n * Custom UI component for rendering [reaction selector](https://github.com/GetStream/stream-chat-react-native/blob/master/screenshots/docs/2.png) in overlay (which shows up on long press on message).\n *\n * **Default** [OverlayReactionList](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/MessageOverlay/OverlayReactionList.tsx)\n */\n OverlayReactionList: React.ComponentType<OverlayReactionListProps<StreamChatGenerics>>;\n /**\n * Custom UI component for rendering [reactions list](https://github.com/GetStream/stream-chat-react-native/blob/master/screenshots/docs/2.png), in overlay (which shows up on long press on message).\n *\n * **Default** [OverlayReactions](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/MessageOverlay/OverlayReactions.tsx)\n */\n OverlayReactions: React.ComponentType<OverlayReactionsProps<StreamChatGenerics>>;\n OverlayReactionsAvatar: React.ComponentType<OverlayReactionsAvatarProps>;\n reset: () => void;\n setData: React.Dispatch<React.SetStateAction<MessageOverlayData<StreamChatGenerics>>>;\n data?: MessageOverlayData<StreamChatGenerics>;\n};\n\nexport const MessageOverlayContext = React.createContext({} as MessageOverlayContextValue);\n\nexport const MessageOverlayProvider = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>({\n children,\n value,\n}: PropsWithChildren<{\n value?: MessageOverlayContextValue<StreamChatGenerics>;\n}>) => {\n const messageOverlayContext = useResettableState(value);\n return (\n <MessageOverlayContext.Provider value={messageOverlayContext as MessageOverlayContextValue}>\n {children}\n </MessageOverlayContext.Provider>\n );\n};\n\nexport const useMessageOverlayContext = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>() =>\n useContext(MessageOverlayContext) as unknown as MessageOverlayContextValue<StreamChatGenerics>;\n\n/**\n * Typescript currently does not support partial inference so if MessageOverlayContext\n * typing is desired while using the HOC withMessageOverlayContextContext the Props for the\n * wrapped component must be provided as the first generic.\n */\nexport const withMessageOverlayContext = <\n P extends UnknownType,\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n Component: React.ComponentType<P>,\n): React.FC<Omit<P, keyof MessageOverlayContextValue<StreamChatGenerics>>> => {\n const WithMessageOverlayContextComponent = (\n props: Omit<P, keyof MessageOverlayContextValue<StreamChatGenerics>>,\n ) => {\n const messageContext = useMessageOverlayContext<StreamChatGenerics>();\n\n return <Component {...(props as P)} {...messageContext} />;\n };\n WithMessageOverlayContextComponent.displayName = `WithMessageOverlayContext${getDisplayName(\n Component,\n )}`;\n return WithMessageOverlayContextComponent;\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["MessageOverlayContext.tsx"],"names":["MessageOverlayContext","React","createContext","MessageOverlayProvider","children","value","messageOverlayContext","useMessageOverlayContext","withMessageOverlayContext","Component","WithMessageOverlayContextComponent","props","messageContext","displayName"],"mappings":";;;;;;;;;;;AAAA;;AAIA;;AAgBA;;;;;;;;;AAoDO,IAAMA,qBAAqB,GAAGC,kBAAMC,aAAN,CAAoB,EAApB,CAA9B;;;;AAEA,IAAMC,sBAAsB,GAAG,SAAzBA,sBAAyB,OAO/B;AAAA,MAJLC,QAIK,QAJLA,QAIK;AAAA,MAHLC,KAGK,QAHLA,KAGK;AACL,MAAMC,qBAAqB,GAAG,4CAAmBD,KAAnB,CAA9B;AACA,SACE,gCAAC,qBAAD,CAAuB,QAAvB;AAAgC,IAAA,KAAK,EAAEC,qBAAvC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACGF,QADH,CADF;AAKD,CAdM;;;;AAgBA,IAAMG,wBAAwB,GAAG,SAA3BA,wBAA2B;AAAA,SAGtC,uBAAWP,qBAAX,CAHsC;AAAA,CAAjC;;;;AAUA,IAAMQ,yBAAyB,GAAG,SAA5BA,yBAA4B,CAIvCC,SAJuC,EAKqC;AAC5E,MAAMC,kCAAkC,GAAG,SAArCA,kCAAqC,CACzCC,KADyC,EAEtC;AACH,QAAMC,cAAc,GAAGL,wBAAwB,EAA/C;AAEA,WAAO,gCAAC,SAAD,gCAAgBI,KAAhB,EAAiCC,cAAjC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,OAAP;AACD,GAND;;AAOAF,EAAAA,kCAAkC,CAACG,WAAnC,iCAA6E,oCAC3EJ,SAD2E,CAA7E;AAGA,SAAOC,kCAAP;AACD,CAjBM","sourcesContent":["import React, { PropsWithChildren, useContext } from 'react';\n\nimport type { Attachment } from 'stream-chat';\n\nimport { useResettableState } from './hooks/useResettableState';\n\nimport type { GroupType, MessageType } from '../../components/MessageList/hooks/useMessageList';\nimport type { MessageActionListProps } from '../../components/MessageOverlay/MessageActionList';\nimport type {\n MessageActionListItemProps,\n MessageActionType,\n} from '../../components/MessageOverlay/MessageActionListItem';\nimport type { OverlayReactionListProps } from '../../components/MessageOverlay/OverlayReactionList';\nimport type { OverlayReactionsProps } from '../../components/MessageOverlay/OverlayReactions';\nimport type { OverlayReactionsAvatarProps } from '../../components/MessageOverlay/OverlayReactionsAvatar';\nimport type { DefaultStreamChatGenerics, UnknownType } from '../../types/types';\nimport type { ReactionData } from '../../utils/utils';\nimport type { Alignment, MessageContextValue } from '../messageContext/MessageContext';\nimport type { MessagesContextValue } from '../messagesContext/MessagesContext';\nimport type { OwnCapabilitiesContextValue } from '../ownCapabilitiesContext/OwnCapabilitiesContext';\nimport { getDisplayName } from '../utils/getDisplayName';\n\nexport type MessageOverlayData<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = {\n alignment?: Alignment;\n clientId?: string;\n files?: Attachment<StreamChatGenerics>[];\n groupStyles?: GroupType[];\n handleReaction?: (reactionType: string) => Promise<void>;\n images?: Attachment<StreamChatGenerics>[];\n message?: MessageType<StreamChatGenerics>;\n messageActions?: MessageActionType[];\n messageContext?: MessageContextValue<StreamChatGenerics>;\n messageReactionTitle?: string;\n messagesContext?: MessagesContextValue<StreamChatGenerics>;\n onlyEmojis?: boolean;\n otherAttachments?: Attachment<StreamChatGenerics>[];\n OverlayReactionList?: React.ComponentType<OverlayReactionListProps<StreamChatGenerics>>;\n ownCapabilities?: OwnCapabilitiesContextValue;\n supportedReactions?: ReactionData[];\n threadList?: boolean;\n};\n\nexport type MessageOverlayContextValue<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = {\n /**\n * Custom UI component for rendering [message actions](https://github.com/GetStream/stream-chat-react-native/blob/master/screenshots/docs/2.png) in overlay.\n *\n * **Default** [MessageActionList](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/MessageOverlay/MessageActions.tsx)\n */\n MessageActionList: React.ComponentType<MessageActionListProps<StreamChatGenerics>>;\n MessageActionListItem: React.ComponentType<MessageActionListItemProps<StreamChatGenerics>>;\n /**\n * Custom UI component for rendering [reaction selector](https://github.com/GetStream/stream-chat-react-native/blob/master/screenshots/docs/2.png) in overlay (which shows up on long press on message).\n *\n * **Default** [OverlayReactionList](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/MessageOverlay/OverlayReactionList.tsx)\n */\n OverlayReactionList: React.ComponentType<OverlayReactionListProps<StreamChatGenerics>>;\n /**\n * Custom UI component for rendering [reactions list](https://github.com/GetStream/stream-chat-react-native/blob/master/screenshots/docs/2.png), in overlay (which shows up on long press on message).\n *\n * **Default** [OverlayReactions](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/MessageOverlay/OverlayReactions.tsx)\n */\n OverlayReactions: React.ComponentType<OverlayReactionsProps<StreamChatGenerics>>;\n OverlayReactionsAvatar: React.ComponentType<OverlayReactionsAvatarProps>;\n reset: () => void;\n setData: React.Dispatch<React.SetStateAction<MessageOverlayData<StreamChatGenerics>>>;\n data?: MessageOverlayData<StreamChatGenerics>;\n};\n\nexport const MessageOverlayContext = React.createContext({} as MessageOverlayContextValue);\n\nexport const MessageOverlayProvider = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>({\n children,\n value,\n}: PropsWithChildren<{\n value?: MessageOverlayContextValue<StreamChatGenerics>;\n}>) => {\n const messageOverlayContext = useResettableState(value);\n return (\n <MessageOverlayContext.Provider value={messageOverlayContext as MessageOverlayContextValue}>\n {children}\n </MessageOverlayContext.Provider>\n );\n};\n\nexport const useMessageOverlayContext = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>() =>\n useContext(MessageOverlayContext) as unknown as MessageOverlayContextValue<StreamChatGenerics>;\n\n/**\n * Typescript currently does not support partial inference so if MessageOverlayContext\n * typing is desired while using the HOC withMessageOverlayContextContext the Props for the\n * wrapped component must be provided as the first generic.\n */\nexport const withMessageOverlayContext = <\n P extends UnknownType,\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n Component: React.ComponentType<P>,\n): React.FC<Omit<P, keyof MessageOverlayContextValue<StreamChatGenerics>>> => {\n const WithMessageOverlayContextComponent = (\n props: Omit<P, keyof MessageOverlayContextValue<StreamChatGenerics>>,\n ) => {\n const messageContext = useMessageOverlayContext<StreamChatGenerics>();\n\n return <Component {...(props as P)} {...messageContext} />;\n };\n WithMessageOverlayContextComponent.displayName = `WithMessageOverlayContext${getDisplayName(\n Component,\n )}`;\n return WithMessageOverlayContextComponent;\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["MessagesContext.tsx"],"names":["MessagesContext","React","createContext","MessagesProvider","children","value","useMessagesContext","withMessagesContext","Component","WithMessagesContextComponent","props","messagesContext","displayName"],"mappings":";;;;;;;;;;;AAAA;;AAkDA;;;;;;;;;AA4ZO,IAAMA,eAAe,GAAGC,kBAAMC,aAAN,CAAoB,EAApB,CAAxB;;;;AAEA,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;AAAA,SAE3B,uBAAWN,eAAX,CAF2B;AAAA,CAA3B;;;;AASA,IAAMO,mBAAmB,GAAG,SAAtBA,mBAAsB,CAIjCC,SAJiC,EAKqC;AACtE,MAAMC,4BAA4B,GAAG,SAA/BA,4BAA+B,CACnCC,KADmC,EAEhC;AACH,QAAMC,eAAe,GAAGL,kBAAkB,EAA1C;AAEA,WAAO,gCAAC,SAAD,gCAAgBI,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 { 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 {\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 { getDisplayName } from '../utils/getDisplayName';\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/master/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/master/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/master/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/master/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/master/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/master/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/master/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/master/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/master/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 * 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/master/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/master/src/components/Message/MessageSimple/InlineUnreadIndicator.tsx)\n **/\n InlineUnreadIndicator: React.ComponentType;\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/master/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/master/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/master/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/master/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/master/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/master/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/master/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.github.io/stream-chat-react-native/v3/#messagesystem)\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/master/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.github.io/stream-chat-react-native/v3/#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.github.io/stream-chat-react-native/v3/#ScrollToBottomButton)\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.github.io/stream-chat-react-native/v3/#typingindicator)\n */\n TypingIndicator: React.ComponentType;\n /**\n * UI component for TypingIndicatorContainer\n * Defaults to: [TypingIndicatorContainer](https://getstream.github.io/stream-chat-react-native/v3/#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/master/src/components/Attachment/Card.tsx\n */\n UrlPreview: React.ComponentType<CardProps<StreamChatGenerics>>;\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({} as MessagesContextValue);\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>() => useContext(MessagesContext) as unknown as MessagesContextValue<StreamChatGenerics>;\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","MessagesProvider","children","value","useMessagesContext","withMessagesContext","Component","WithMessagesContextComponent","props","messagesContext","displayName"],"mappings":";;;;;;;;;;;AAAA;;AAkDA;;;;;;;;;AA4ZO,IAAMA,eAAe,GAAGC,kBAAMC,aAAN,CAAoB,EAApB,CAAxB;;;;AAEA,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;AAAA,SAE3B,uBAAWN,eAAX,CAF2B;AAAA,CAA3B;;;;AASA,IAAMO,mBAAmB,GAAG,SAAtBA,mBAAsB,CAIjCC,SAJiC,EAKqC;AACtE,MAAMC,4BAA4B,GAAG,SAA/BA,4BAA+B,CACnCC,KADmC,EAEhC;AACH,QAAMC,eAAe,GAAGL,kBAAkB,EAA1C;AAEA,WAAO,gCAAC,SAAD,gCAAgBI,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 { 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 {\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 { getDisplayName } from '../utils/getDisplayName';\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/master/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/master/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/master/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/master/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/master/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/master/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/master/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/master/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/master/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 * 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/master/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/master/package/src/components/Message/MessageSimple/InlineUnreadIndicator.tsx)\n **/\n InlineUnreadIndicator: React.ComponentType;\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/master/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/master/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/master/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/master/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/master/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/master/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/master/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.github.io/stream-chat-react-native/v3/#messagesystem)\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/master/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.github.io/stream-chat-react-native/v3/#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.github.io/stream-chat-react-native/v3/#ScrollToBottomButton)\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.github.io/stream-chat-react-native/v3/#typingindicator)\n */\n TypingIndicator: React.ComponentType;\n /**\n * UI component for TypingIndicatorContainer\n * Defaults to: [TypingIndicatorContainer](https://getstream.github.io/stream-chat-react-native/v3/#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/master/package/src/components/Attachment/Card.tsx\n */\n UrlPreview: React.ComponentType<CardProps<StreamChatGenerics>>;\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({} as MessagesContextValue);\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>() => useContext(MessagesContext) as unknown as MessagesContextValue<StreamChatGenerics>;\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,4 +1,4 @@
|
|
|
1
|
-
Please check the `MessagesContextValue` in [MessagesContext](https://github.com/GetStream/stream-chat-react-native/blob/master/src/contexts/messageContext/MessageContext.tsx), for consumable values.
|
|
1
|
+
Please check the `MessagesContextValue` in [MessagesContext](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/contexts/messageContext/MessageContext.tsx), for consumable values.
|
|
2
2
|
Provider for this context exists in `Channel` component. And so, any child component of Channel
|
|
3
3
|
can get access to context as following:
|
|
4
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["OverlayContext.tsx"],"names":["OverlayContext","React","createContext","useOverlayContext","withOverlayContext","Component","WithOverlayContextComponent","props","overlayContext","displayName"],"mappings":";;;;;;;;;;;AAAA;;AAeA;;;;;;;;;AAWO,IAAMA,cAAc,GAAGC,kBAAMC,aAAN,CAAyC,EAAzC,CAAvB;;;;AAiDA,IAAMC,iBAAiB,GAAG,SAApBA,iBAAoB;AAAA,SAAM,uBAAWH,cAAX,CAAN;AAAA,CAA1B;;;;AAEA,IAAMI,kBAAkB,GAAG,SAArBA,kBAAqB,CAGhCC,SAHgC,EAIkC;AAClE,MAAMC,2BAA2B,GAAG,SAA9BA,2BAA8B,CAClCC,KADkC,EAE/B;AACH,QAAMC,cAAc,GAAGL,iBAAiB,EAAxC;AAEA,WAAO,gCAAC,SAAD,gCAAgBI,KAAhB,EAAkDC,cAAlD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,OAAP;AACD,GAND;;AAOAF,EAAAA,2BAA2B,CAACG,WAA5B,0BAA+D,oCAC7DJ,SAD6D,CAA/D;AAGA,SAAOC,2BAAP;AACD,CAhBM","sourcesContent":["import React, { useContext } from 'react';\n\nimport type { BottomSheetMethods } from '@gorhom/bottom-sheet/lib/typescript/types';\nimport type { Attachment } from 'stream-chat';\n\nimport type { AttachmentPickerProps } from '../../components/AttachmentPicker/AttachmentPicker';\nimport type { ImageGalleryCustomComponents } from '../../components/ImageGallery/ImageGallery';\n\nimport type { MessageType } from '../../components/MessageList/hooks/useMessageList';\nimport type { DefaultStreamChatGenerics } from '../../types/types';\nimport type { Streami18n } from '../../utils/Streami18n';\nimport type { AttachmentPickerContextValue } from '../attachmentPickerContext/AttachmentPickerContext';\nimport type { MessageOverlayContextValue } from '../messageOverlayContext/MessageOverlayContext';\nimport type { DeepPartial } from '../themeContext/ThemeContext';\nimport type { Theme } from '../themeContext/utils/theme';\nimport { getDisplayName } from '../utils/getDisplayName';\n\nexport type Overlay = 'alert' | 'gallery' | 'message' | 'none';\n\nexport type OverlayContextValue = {\n overlay: Overlay;\n setOverlay: React.Dispatch<React.SetStateAction<Overlay>>;\n style?: DeepPartial<Theme>;\n translucentStatusBar?: boolean;\n};\n\nexport const OverlayContext = React.createContext<OverlayContextValue>({} as OverlayContextValue);\n\nexport type OverlayProviderProps<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = Partial<AttachmentPickerProps> &\n Partial<\n Pick<\n AttachmentPickerContextValue,\n | 'attachmentPickerBottomSheetHeight'\n | 'attachmentSelectionBarHeight'\n | 'bottomInset'\n | 'CameraSelectorIcon'\n | 'FileSelectorIcon'\n | 'ImageSelectorIcon'\n | 'topInset'\n >\n > &\n ImageGalleryCustomComponents<StreamChatGenerics> &\n Partial<\n Pick<\n MessageOverlayContextValue<StreamChatGenerics>,\n | 'MessageActionList'\n | 'MessageActionListItem'\n | 'OverlayReactionList'\n | 'OverlayReactions'\n | 'OverlayReactionsAvatar'\n >\n > &\n Pick<OverlayContextValue, 'translucentStatusBar'> & {\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
|
|
1
|
+
{"version":3,"sources":["OverlayContext.tsx"],"names":["OverlayContext","React","createContext","useOverlayContext","withOverlayContext","Component","WithOverlayContextComponent","props","overlayContext","displayName"],"mappings":";;;;;;;;;;;AAAA;;AAeA;;;;;;;;;AAWO,IAAMA,cAAc,GAAGC,kBAAMC,aAAN,CAAyC,EAAzC,CAAvB;;;;AAiDA,IAAMC,iBAAiB,GAAG,SAApBA,iBAAoB;AAAA,SAAM,uBAAWH,cAAX,CAAN;AAAA,CAA1B;;;;AAEA,IAAMI,kBAAkB,GAAG,SAArBA,kBAAqB,CAGhCC,SAHgC,EAIkC;AAClE,MAAMC,2BAA2B,GAAG,SAA9BA,2BAA8B,CAClCC,KADkC,EAE/B;AACH,QAAMC,cAAc,GAAGL,iBAAiB,EAAxC;AAEA,WAAO,gCAAC,SAAD,gCAAgBI,KAAhB,EAAkDC,cAAlD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,OAAP;AACD,GAND;;AAOAF,EAAAA,2BAA2B,CAACG,WAA5B,0BAA+D,oCAC7DJ,SAD6D,CAA/D;AAGA,SAAOC,2BAAP;AACD,CAhBM","sourcesContent":["import React, { useContext } from 'react';\n\nimport type { BottomSheetMethods } from '@gorhom/bottom-sheet/lib/typescript/types';\nimport type { Attachment } from 'stream-chat';\n\nimport type { AttachmentPickerProps } from '../../components/AttachmentPicker/AttachmentPicker';\nimport type { ImageGalleryCustomComponents } from '../../components/ImageGallery/ImageGallery';\n\nimport type { MessageType } from '../../components/MessageList/hooks/useMessageList';\nimport type { DefaultStreamChatGenerics } from '../../types/types';\nimport type { Streami18n } from '../../utils/Streami18n';\nimport type { AttachmentPickerContextValue } from '../attachmentPickerContext/AttachmentPickerContext';\nimport type { MessageOverlayContextValue } from '../messageOverlayContext/MessageOverlayContext';\nimport type { DeepPartial } from '../themeContext/ThemeContext';\nimport type { Theme } from '../themeContext/utils/theme';\nimport { getDisplayName } from '../utils/getDisplayName';\n\nexport type Overlay = 'alert' | 'gallery' | 'message' | 'none';\n\nexport type OverlayContextValue = {\n overlay: Overlay;\n setOverlay: React.Dispatch<React.SetStateAction<Overlay>>;\n style?: DeepPartial<Theme>;\n translucentStatusBar?: boolean;\n};\n\nexport const OverlayContext = React.createContext<OverlayContextValue>({} as OverlayContextValue);\n\nexport type OverlayProviderProps<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = Partial<AttachmentPickerProps> &\n Partial<\n Pick<\n AttachmentPickerContextValue,\n | 'attachmentPickerBottomSheetHeight'\n | 'attachmentSelectionBarHeight'\n | 'bottomInset'\n | 'CameraSelectorIcon'\n | 'FileSelectorIcon'\n | 'ImageSelectorIcon'\n | 'topInset'\n >\n > &\n ImageGalleryCustomComponents<StreamChatGenerics> &\n Partial<\n Pick<\n MessageOverlayContextValue<StreamChatGenerics>,\n | 'MessageActionList'\n | 'MessageActionListItem'\n | 'OverlayReactionList'\n | 'OverlayReactions'\n | 'OverlayReactionsAvatar'\n >\n > &\n Pick<OverlayContextValue, 'translucentStatusBar'> & {\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 closePicker?: (ref: React.RefObject<BottomSheetMethods>) => void;\n error?: boolean | Error;\n giphyVersion?: keyof NonNullable<Attachment['giphy']>;\n /** https://github.com/GetStream/stream-chat-react-native/wiki/Internationalization-(i18n) */\n i18nInstance?: Streami18n;\n imageGalleryGridHandleHeight?: number;\n imageGalleryGridSnapPoints?: [string | number, string | number];\n isMyMessage?: boolean;\n isThreadMessage?: boolean;\n message?: MessageType<StreamChatGenerics>;\n messageReactions?: boolean;\n messageTextNumberOfLines?: number;\n numberOfImageGalleryGridColumns?: number;\n openPicker?: (ref: React.RefObject<BottomSheetMethods>) => void;\n value?: Partial<OverlayContextValue>;\n };\n\nexport const useOverlayContext = () => useContext(OverlayContext);\n\nexport const withOverlayContext = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n Component: React.ComponentType<StreamChatGenerics>,\n): React.FC<Omit<StreamChatGenerics, keyof OverlayContextValue>> => {\n const WithOverlayContextComponent = (\n props: Omit<StreamChatGenerics, keyof OverlayContextValue>,\n ) => {\n const overlayContext = useOverlayContext();\n\n return <Component {...(props as StreamChatGenerics)} {...overlayContext} />;\n };\n WithOverlayContextComponent.displayName = `WithOverlayContext${getDisplayName(\n Component as React.ComponentType,\n )}`;\n return WithOverlayContextComponent;\n};\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Please check the `OverlayContextValue` in [OverlayContext](https://github.com/GetStream/stream-chat-react-native/blob/master/src/contexts/overlayContext/OverlayContext.tsx), for consumable values.
|
|
1
|
+
Please check the `OverlayContextValue` in [OverlayContext](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/contexts/overlayContext/OverlayContext.tsx), for consumable values.
|
|
2
2
|
Provider for this context exists in `OverlayProvider` component. And so, any child component of OverlayProvider
|
|
3
3
|
can get access to context as following:
|
|
4
4
|
|
|
@@ -31,4 +31,4 @@ class SomeChildComponent extends React.Component {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
// UI Logic
|
|
34
|
-
}
|
|
34
|
+
}
|
|
@@ -88,8 +88,7 @@ var OverlayProvider = function OverlayProvider(props) {
|
|
|
88
88
|
} : _props$closePicker,
|
|
89
89
|
_props$FileSelectorIc = props.FileSelectorIcon,
|
|
90
90
|
FileSelectorIcon = _props$FileSelectorIc === void 0 ? _FileSelectorIcon.FileSelectorIcon : _props$FileSelectorIc,
|
|
91
|
-
|
|
92
|
-
giphyVersion = _props$giphyVersion === void 0 ? 'fixed_height' : _props$giphyVersion,
|
|
91
|
+
giphyVersion = props.giphyVersion,
|
|
93
92
|
i18nInstance = props.i18nInstance,
|
|
94
93
|
imageGalleryCustomComponents = props.imageGalleryCustomComponents,
|
|
95
94
|
imageGalleryGridHandleHeight = props.imageGalleryGridHandleHeight,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["OverlayProvider.tsx"],"names":["OverlayProvider","props","AttachmentPickerBottomSheetHandle","DefaultAttachmentPickerBottomSheetHandle","attachmentPickerBottomSheetHandleHeight","attachmentPickerBottomSheetHeight","AttachmentPickerError","DefaultAttachmentPickerError","attachmentPickerErrorButtonText","AttachmentPickerErrorImage","DefaultAttachmentPickerErrorImage","attachmentPickerErrorText","attachmentSelectionBarHeight","bottomInset","CameraSelectorIcon","DefaultCameraSelectorIcon","children","closePicker","ref","current","close","FileSelectorIcon","DefaultFileSelectorIcon","giphyVersion","i18nInstance","imageGalleryCustomComponents","imageGalleryGridHandleHeight","imageGalleryGridSnapPoints","ImageOverlaySelectedComponent","DefaultImageOverlaySelectedComponent","ImageSelectorIcon","DefaultImageSelectorIcon","MessageActionList","MessageActionListItem","messageTextNumberOfLines","numberOfAttachmentImagesToLoadPerCall","numberOfAttachmentPickerImageColumns","numberOfImageGalleryGridColumns","openPicker","snapToIndex","console","warn","topInset","translucentStatusBar","OverlayReactionList","OverlayReactions","OverlayReactionsAvatar","value","attachmentPickerProps","bottomSheetRef","t","key","tDateTimeParser","input","translators","setTranslators","overlay","setOverlay","overlayOpacity","Dimensions","get","height","width","loadingTranslators","backAction","backHandler","BackHandler","addEventListener","remove","attachmentPickerContext","overlayStyle","opacity","overlayContext","style","StyleSheet","absoluteFill"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AAEA;;AAQA;;AAEA;;AAEA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAGA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;AAyBO,IAAMA,eAAe,GAAG,SAAlBA,eAAkB,CAG7BC,KAH6B,EAI1B;AACH,8BA4CIA,KA5CJ,CACEC,iCADF;AAAA,MACEA,iCADF,sCACsCC,oEADtC;AAAA,MAEEC,uCAFF,GA4CIH,KA5CJ,CAEEG,uCAFF;AAAA,MAGEC,iCAHF,GA4CIJ,KA5CJ,CAGEI,iCAHF;AAAA,+BA4CIJ,KA5CJ,CAIEK,qBAJF;AAAA,MAIEA,qBAJF,uCAI0BC,4CAJ1B;AAAA,MAKEC,+BALF,GA4CIP,KA5CJ,CAKEO,+BALF;AAAA,+BA4CIP,KA5CJ,CAMEQ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BADrB;AAEE,IAAA,qBAAqB,EAAEC,qBAFzB;AAGE,IAAA,wBAAwB,EAAEC,wBAH5B;AAIE,IAAA,cAAc,EAAEwB,cAJlB;AAKE,IAAA,mBAAmB,EAAEd,mBALvB;AAME,IAAA,gBAAgB,EAAEC,gBANpB;AAOE,IAAA,sBAAsB,EAAEC,sBAP1B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IARJ,EAkBGU,OAAO,KAAK,SAAZ,IACC,gCAAC,0BAAD;AACE,IAAA,YAAY,EAAEjC,YADhB;AAEE,IAAA,4BAA4B,EAAEE,4BAFhC;AAGE,IAAA,4BAA4B,EAAEC,4BAHhC;AAIE,IAAA,0BAA0B,EAAEC,0BAJ9B;AAKE,IAAA,+BAA+B,EAAEU,+BALnC;AAME,IAAA,cAAc,EAAEqB,cANlB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAnBJ,EA4BE,gCAAC,kCAAD;AAAkB,IAAA,GAAG,EAAET;AAAvB,KAA2CD,qBAA3C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KA5BF,CAFF,CADF,CADF,CADF,CADF,CADF;AA2CD,CArLM","sourcesContent":["import React, { PropsWithChildren, useEffect, useRef, useState } from 'react';\nimport { BackHandler, Dimensions, StyleSheet, ViewStyle } from 'react-native';\n\nimport Animated, {\n cancelAnimation,\n useAnimatedStyle,\n useSharedValue,\n withTiming,\n} from 'react-native-reanimated';\n\nimport type BottomSheet from '@gorhom/bottom-sheet';\nimport Dayjs from 'dayjs';\n\nimport { OverlayContext, OverlayProviderProps } from './OverlayContext';\n\nimport { AttachmentPicker } from '../../components/AttachmentPicker/AttachmentPicker';\n\nimport { AttachmentPickerBottomSheetHandle as DefaultAttachmentPickerBottomSheetHandle } from '../../components/AttachmentPicker/components/AttachmentPickerBottomSheetHandle';\nimport { AttachmentPickerError as DefaultAttachmentPickerError } from '../../components/AttachmentPicker/components/AttachmentPickerError';\nimport { AttachmentPickerErrorImage as DefaultAttachmentPickerErrorImage } from '../../components/AttachmentPicker/components/AttachmentPickerErrorImage';\nimport { CameraSelectorIcon as DefaultCameraSelectorIcon } from '../../components/AttachmentPicker/components/CameraSelectorIcon';\nimport { FileSelectorIcon as DefaultFileSelectorIcon } from '../../components/AttachmentPicker/components/FileSelectorIcon';\nimport { ImageOverlaySelectedComponent as DefaultImageOverlaySelectedComponent } from '../../components/AttachmentPicker/components/ImageOverlaySelectedComponent';\nimport { ImageSelectorIcon as DefaultImageSelectorIcon } from '../../components/AttachmentPicker/components/ImageSelectorIcon';\nimport { ImageGallery } from '../../components/ImageGallery/ImageGallery';\nimport { MessageOverlay } from '../../components/MessageOverlay/MessageOverlay';\nimport { OverlayBackdrop } from '../../components/MessageOverlay/OverlayBackdrop';\nimport { ChannelsStateProvider } from '../../contexts/channelsStateContext/ChannelsStateContext';\nimport { useStreami18n } from '../../hooks/useStreami18n';\n\nimport type { DefaultStreamChatGenerics } from '../../types/types';\nimport { AttachmentPickerProvider } from '../attachmentPickerContext/AttachmentPickerContext';\nimport { ImageGalleryProvider } from '../imageGalleryContext/ImageGalleryContext';\nimport { MessageOverlayProvider } from '../messageOverlayContext/MessageOverlayContext';\nimport { ThemeProvider } from '../themeContext/ThemeContext';\nimport {\n TranslationContextValue,\n TranslationProvider,\n} from '../translationContext/TranslationContext';\n\n/**\n * - The highest level of these components is the `OverlayProvider`. The `OverlayProvider` allows users to interact with messages on long press above the underlying views, use the full screen image viewer, and use the `AttachmentPicker` as a keyboard-esk view.\n * Because these views must exist above all others `OverlayProvider` should wrap your navigation stack as well. Assuming [`React Navigation`](https://reactnavigation.org/) is being used, your highest level navigation stack should be wrapped in the provider:\n *\n * ```js\n * <NavigationContainer>\n * <OverlayProvider>\n * <Stack.Navigator>\n * <Stack.Screen />\n * </Stack.Navigator>\n * </OverlayProvider>\n * </NavigationContainer>\n * ```\n *\n * - Don't forget to check our cookbook section of [OverlayProvider](https://github.com/GetStream/stream-chat-react-native/wiki/Cookbook-v3.0#overlayprovider)\n *\n * - Also check the [visual component guide](https://github.com/GetStream/stream-chat-react-native/wiki/Cookbook-v3.0#custom-components), to learn about component customizations.\n *\n * @example ./OverlayProvider.md\n */\nexport const OverlayProvider = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n props: PropsWithChildren<OverlayProviderProps<StreamChatGenerics>>,\n) => {\n const {\n AttachmentPickerBottomSheetHandle = DefaultAttachmentPickerBottomSheetHandle,\n attachmentPickerBottomSheetHandleHeight,\n attachmentPickerBottomSheetHeight,\n AttachmentPickerError = DefaultAttachmentPickerError,\n attachmentPickerErrorButtonText,\n AttachmentPickerErrorImage = DefaultAttachmentPickerErrorImage,\n attachmentPickerErrorText,\n attachmentSelectionBarHeight,\n bottomInset,\n CameraSelectorIcon = DefaultCameraSelectorIcon,\n children,\n closePicker = (ref) => {\n if (ref.current) {\n ref.current.close();\n }\n },\n FileSelectorIcon = DefaultFileSelectorIcon,\n giphyVersion = 'fixed_height',\n i18nInstance,\n imageGalleryCustomComponents,\n imageGalleryGridHandleHeight,\n imageGalleryGridSnapPoints,\n ImageOverlaySelectedComponent = DefaultImageOverlaySelectedComponent,\n ImageSelectorIcon = DefaultImageSelectorIcon,\n MessageActionList,\n MessageActionListItem,\n messageTextNumberOfLines,\n numberOfAttachmentImagesToLoadPerCall,\n numberOfAttachmentPickerImageColumns,\n numberOfImageGalleryGridColumns,\n openPicker = (ref) => {\n if (ref.current?.snapToIndex) {\n ref.current.snapToIndex(0);\n } else {\n console.warn('bottom and top insets must be set for the image picker to work correctly');\n }\n },\n topInset,\n translucentStatusBar,\n OverlayReactionList,\n OverlayReactions,\n OverlayReactionsAvatar,\n value,\n } = props;\n\n const attachmentPickerProps = {\n AttachmentPickerBottomSheetHandle,\n attachmentPickerBottomSheetHandleHeight,\n attachmentPickerBottomSheetHeight,\n AttachmentPickerError,\n attachmentPickerErrorButtonText,\n AttachmentPickerErrorImage,\n attachmentPickerErrorText,\n attachmentSelectionBarHeight,\n ImageOverlaySelectedComponent,\n numberOfAttachmentImagesToLoadPerCall,\n numberOfAttachmentPickerImageColumns,\n translucentStatusBar,\n };\n\n const bottomSheetRef = useRef<BottomSheet>(null);\n\n const [translators, setTranslators] = useState<TranslationContextValue>({\n t: (key: string) => key,\n tDateTimeParser: (input?: string | number | Date) => Dayjs(input),\n });\n const [overlay, setOverlay] = useState(value?.overlay || 'none');\n\n const overlayOpacity = useSharedValue(0);\n const { height, width } = Dimensions.get('screen');\n\n // Setup translators\n const loadingTranslators = useStreami18n({ i18nInstance, setTranslators });\n\n useEffect(() => {\n const backAction = () => {\n if (overlay !== 'none') {\n setOverlay('none');\n return true;\n }\n\n return false;\n };\n\n const backHandler = BackHandler.addEventListener('hardwareBackPress', backAction);\n\n return () => backHandler.remove();\n }, [overlay]);\n\n useEffect(() => {\n if (bottomSheetRef.current) {\n bottomSheetRef.current.close?.();\n }\n cancelAnimation(overlayOpacity);\n if (overlay !== 'none') {\n overlayOpacity.value = withTiming(1);\n } else {\n overlayOpacity.value = withTiming(0);\n }\n }, [overlay]);\n\n // Setup translators\n useStreami18n({ i18nInstance, setTranslators });\n\n const attachmentPickerContext = {\n attachmentPickerBottomSheetHeight,\n attachmentSelectionBarHeight,\n bottomInset,\n CameraSelectorIcon,\n closePicker: () => closePicker(bottomSheetRef),\n FileSelectorIcon,\n ImageSelectorIcon,\n openPicker: () => openPicker(bottomSheetRef),\n topInset,\n };\n\n const overlayStyle = useAnimatedStyle<ViewStyle>(\n () => ({\n opacity: overlayOpacity.value,\n }),\n [],\n );\n\n const overlayContext = {\n overlay,\n setOverlay,\n style: value?.style,\n translucentStatusBar,\n };\n\n if (loadingTranslators) return null;\n\n return (\n <TranslationProvider value={translators}>\n <OverlayContext.Provider value={overlayContext}>\n <MessageOverlayProvider<StreamChatGenerics>>\n <AttachmentPickerProvider value={attachmentPickerContext}>\n <ImageGalleryProvider>\n <ChannelsStateProvider<StreamChatGenerics>>{children}</ChannelsStateProvider>\n <ThemeProvider style={overlayContext.style}>\n <Animated.View\n pointerEvents={overlay === 'none' ? 'none' : 'auto'}\n style={[StyleSheet.absoluteFill, overlayStyle]}\n >\n <OverlayBackdrop style={[StyleSheet.absoluteFill, { height, width }]} />\n </Animated.View>\n {overlay === 'message' && (\n <MessageOverlay<StreamChatGenerics>\n MessageActionList={MessageActionList}\n MessageActionListItem={MessageActionListItem}\n messageTextNumberOfLines={messageTextNumberOfLines}\n overlayOpacity={overlayOpacity}\n OverlayReactionList={OverlayReactionList}\n OverlayReactions={OverlayReactions}\n OverlayReactionsAvatar={OverlayReactionsAvatar}\n />\n )}\n {overlay === 'gallery' && (\n <ImageGallery<StreamChatGenerics>\n giphyVersion={giphyVersion}\n imageGalleryCustomComponents={imageGalleryCustomComponents}\n imageGalleryGridHandleHeight={imageGalleryGridHandleHeight}\n imageGalleryGridSnapPoints={imageGalleryGridSnapPoints}\n numberOfImageGalleryGridColumns={numberOfImageGalleryGridColumns}\n overlayOpacity={overlayOpacity}\n />\n )}\n <AttachmentPicker ref={bottomSheetRef} {...attachmentPickerProps} />\n </ThemeProvider>\n </ImageGalleryProvider>\n </AttachmentPickerProvider>\n </MessageOverlayProvider>\n </OverlayContext.Provider>\n </TranslationProvider>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["OverlayProvider.tsx"],"names":["OverlayProvider","props","AttachmentPickerBottomSheetHandle","DefaultAttachmentPickerBottomSheetHandle","attachmentPickerBottomSheetHandleHeight","attachmentPickerBottomSheetHeight","AttachmentPickerError","DefaultAttachmentPickerError","attachmentPickerErrorButtonText","AttachmentPickerErrorImage","DefaultAttachmentPickerErrorImage","attachmentPickerErrorText","attachmentSelectionBarHeight","bottomInset","CameraSelectorIcon","DefaultCameraSelectorIcon","children","closePicker","ref","current","close","FileSelectorIcon","DefaultFileSelectorIcon","giphyVersion","i18nInstance","imageGalleryCustomComponents","imageGalleryGridHandleHeight","imageGalleryGridSnapPoints","ImageOverlaySelectedComponent","DefaultImageOverlaySelectedComponent","ImageSelectorIcon","DefaultImageSelectorIcon","MessageActionList","MessageActionListItem","messageTextNumberOfLines","numberOfAttachmentImagesToLoadPerCall","numberOfAttachmentPickerImageColumns","numberOfImageGalleryGridColumns","openPicker","snapToIndex","console","warn","topInset","translucentStatusBar","OverlayReactionList","OverlayReactions","OverlayReactionsAvatar","value","attachmentPickerProps","bottomSheetRef","t","key","tDateTimeParser","input","translators","setTranslators","overlay","setOverlay","overlayOpacity","Dimensions","get","height","width","loadingTranslators","backAction","backHandler","BackHandler","addEventListener","remove","attachmentPickerContext","overlayStyle","opacity","overlayContext","style","StyleSheet","absoluteFill"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AAEA;;AAQA;;AAEA;;AAEA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAGA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;AAyBO,IAAMA,eAAe,GAAG,SAAlBA,eAAkB,CAG7BC,KAH6B,EAI1B;AACH,8BA4CIA,KA5CJ,CACEC,iCADF;AAAA,MACEA,iCADF,sCACsCC,oEADtC;AAAA,MAEEC,uCAFF,GA4CIH,KA5CJ,CAEEG,uCAFF;AAAA,MAGEC,iCAHF,GA4CIJ,KA5CJ,CAGEI,iCAHF;AAAA,+BA4CIJ,KA5CJ,CAIEK,qBAJF;AAAA,MAIEA,qBAJF,uCAI0BC,4CAJ1B;AAAA,MAKEC,+BALF,GA4CIP,KA5CJ,CAKEO,+BALF;AAAA,+BA4CIP,KA5CJ,CAMEQ,0BANF;AAAA,MAMEA,0BANF,uCAM+BC,sDAN/B;AAAA,MAOEC,yBAPF,GA4CIV,KA5CJ,CAOEU,yBAPF;AAAA,MAQEC,4BARF,GA4CIX,KA5CJ,CAQEW,4BARF;AAAA,MASEC,WATF,GA4CIZ,KA5CJ,CASEY,WATF;AAAA,8BA4CIZ,KA5CJ,CAUEa,kBAVF;AAAA,MAUEA,kBAVF,sCAUuBC,sCA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,IACC,gCAAC,0BAAD;AACE,IAAA,YAAY,EAAEjC,YADhB;AAEE,IAAA,4BAA4B,EAAEE,4BAFhC;AAGE,IAAA,4BAA4B,EAAEC,4BAHhC;AAIE,IAAA,0BAA0B,EAAEC,0BAJ9B;AAKE,IAAA,+BAA+B,EAAEU,+BALnC;AAME,IAAA,cAAc,EAAEqB,cANlB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAnBJ,EA4BE,gCAAC,kCAAD;AAAkB,IAAA,GAAG,EAAET;AAAvB,KAA2CD,qBAA3C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KA5BF,CAFF,CADF,CADF,CADF,CADF,CADF;AA2CD,CArLM","sourcesContent":["import React, { PropsWithChildren, useEffect, useRef, useState } from 'react';\nimport { BackHandler, Dimensions, StyleSheet, ViewStyle } from 'react-native';\n\nimport Animated, {\n cancelAnimation,\n useAnimatedStyle,\n useSharedValue,\n withTiming,\n} from 'react-native-reanimated';\n\nimport type BottomSheet from '@gorhom/bottom-sheet';\nimport Dayjs from 'dayjs';\n\nimport { OverlayContext, OverlayProviderProps } from './OverlayContext';\n\nimport { AttachmentPicker } from '../../components/AttachmentPicker/AttachmentPicker';\n\nimport { AttachmentPickerBottomSheetHandle as DefaultAttachmentPickerBottomSheetHandle } from '../../components/AttachmentPicker/components/AttachmentPickerBottomSheetHandle';\nimport { AttachmentPickerError as DefaultAttachmentPickerError } from '../../components/AttachmentPicker/components/AttachmentPickerError';\nimport { AttachmentPickerErrorImage as DefaultAttachmentPickerErrorImage } from '../../components/AttachmentPicker/components/AttachmentPickerErrorImage';\nimport { CameraSelectorIcon as DefaultCameraSelectorIcon } from '../../components/AttachmentPicker/components/CameraSelectorIcon';\nimport { FileSelectorIcon as DefaultFileSelectorIcon } from '../../components/AttachmentPicker/components/FileSelectorIcon';\nimport { ImageOverlaySelectedComponent as DefaultImageOverlaySelectedComponent } from '../../components/AttachmentPicker/components/ImageOverlaySelectedComponent';\nimport { ImageSelectorIcon as DefaultImageSelectorIcon } from '../../components/AttachmentPicker/components/ImageSelectorIcon';\nimport { ImageGallery } from '../../components/ImageGallery/ImageGallery';\nimport { MessageOverlay } from '../../components/MessageOverlay/MessageOverlay';\nimport { OverlayBackdrop } from '../../components/MessageOverlay/OverlayBackdrop';\nimport { ChannelsStateProvider } from '../../contexts/channelsStateContext/ChannelsStateContext';\nimport { useStreami18n } from '../../hooks/useStreami18n';\n\nimport type { DefaultStreamChatGenerics } from '../../types/types';\nimport { AttachmentPickerProvider } from '../attachmentPickerContext/AttachmentPickerContext';\nimport { ImageGalleryProvider } from '../imageGalleryContext/ImageGalleryContext';\nimport { MessageOverlayProvider } from '../messageOverlayContext/MessageOverlayContext';\nimport { ThemeProvider } from '../themeContext/ThemeContext';\nimport {\n TranslationContextValue,\n TranslationProvider,\n} from '../translationContext/TranslationContext';\n\n/**\n * - The highest level of these components is the `OverlayProvider`. The `OverlayProvider` allows users to interact with messages on long press above the underlying views, use the full screen image viewer, and use the `AttachmentPicker` as a keyboard-esk view.\n * Because these views must exist above all others `OverlayProvider` should wrap your navigation stack as well. Assuming [`React Navigation`](https://reactnavigation.org/) is being used, your highest level navigation stack should be wrapped in the provider:\n *\n * ```js\n * <NavigationContainer>\n * <OverlayProvider>\n * <Stack.Navigator>\n * <Stack.Screen />\n * </Stack.Navigator>\n * </OverlayProvider>\n * </NavigationContainer>\n * ```\n *\n * - Don't forget to check our cookbook section of [OverlayProvider](https://github.com/GetStream/stream-chat-react-native/wiki/Cookbook-v3.0#overlayprovider)\n *\n * - Also check the [visual component guide](https://github.com/GetStream/stream-chat-react-native/wiki/Cookbook-v3.0#custom-components), to learn about component customizations.\n *\n * @example ./OverlayProvider.md\n */\nexport const OverlayProvider = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n props: PropsWithChildren<OverlayProviderProps<StreamChatGenerics>>,\n) => {\n const {\n AttachmentPickerBottomSheetHandle = DefaultAttachmentPickerBottomSheetHandle,\n attachmentPickerBottomSheetHandleHeight,\n attachmentPickerBottomSheetHeight,\n AttachmentPickerError = DefaultAttachmentPickerError,\n attachmentPickerErrorButtonText,\n AttachmentPickerErrorImage = DefaultAttachmentPickerErrorImage,\n attachmentPickerErrorText,\n attachmentSelectionBarHeight,\n bottomInset,\n CameraSelectorIcon = DefaultCameraSelectorIcon,\n children,\n closePicker = (ref) => {\n if (ref.current) {\n ref.current.close();\n }\n },\n FileSelectorIcon = DefaultFileSelectorIcon,\n giphyVersion,\n i18nInstance,\n imageGalleryCustomComponents,\n imageGalleryGridHandleHeight,\n imageGalleryGridSnapPoints,\n ImageOverlaySelectedComponent = DefaultImageOverlaySelectedComponent,\n ImageSelectorIcon = DefaultImageSelectorIcon,\n MessageActionList,\n MessageActionListItem,\n messageTextNumberOfLines,\n numberOfAttachmentImagesToLoadPerCall,\n numberOfAttachmentPickerImageColumns,\n numberOfImageGalleryGridColumns,\n openPicker = (ref) => {\n if (ref.current?.snapToIndex) {\n ref.current.snapToIndex(0);\n } else {\n console.warn('bottom and top insets must be set for the image picker to work correctly');\n }\n },\n topInset,\n translucentStatusBar,\n OverlayReactionList,\n OverlayReactions,\n OverlayReactionsAvatar,\n value,\n } = props;\n\n const attachmentPickerProps = {\n AttachmentPickerBottomSheetHandle,\n attachmentPickerBottomSheetHandleHeight,\n attachmentPickerBottomSheetHeight,\n AttachmentPickerError,\n attachmentPickerErrorButtonText,\n AttachmentPickerErrorImage,\n attachmentPickerErrorText,\n attachmentSelectionBarHeight,\n ImageOverlaySelectedComponent,\n numberOfAttachmentImagesToLoadPerCall,\n numberOfAttachmentPickerImageColumns,\n translucentStatusBar,\n };\n\n const bottomSheetRef = useRef<BottomSheet>(null);\n\n const [translators, setTranslators] = useState<TranslationContextValue>({\n t: (key: string) => key,\n tDateTimeParser: (input?: string | number | Date) => Dayjs(input),\n });\n const [overlay, setOverlay] = useState(value?.overlay || 'none');\n\n const overlayOpacity = useSharedValue(0);\n const { height, width } = Dimensions.get('screen');\n\n // Setup translators\n const loadingTranslators = useStreami18n({ i18nInstance, setTranslators });\n\n useEffect(() => {\n const backAction = () => {\n if (overlay !== 'none') {\n setOverlay('none');\n return true;\n }\n\n return false;\n };\n\n const backHandler = BackHandler.addEventListener('hardwareBackPress', backAction);\n\n return () => backHandler.remove();\n }, [overlay]);\n\n useEffect(() => {\n if (bottomSheetRef.current) {\n bottomSheetRef.current.close?.();\n }\n cancelAnimation(overlayOpacity);\n if (overlay !== 'none') {\n overlayOpacity.value = withTiming(1);\n } else {\n overlayOpacity.value = withTiming(0);\n }\n }, [overlay]);\n\n // Setup translators\n useStreami18n({ i18nInstance, setTranslators });\n\n const attachmentPickerContext = {\n attachmentPickerBottomSheetHeight,\n attachmentSelectionBarHeight,\n bottomInset,\n CameraSelectorIcon,\n closePicker: () => closePicker(bottomSheetRef),\n FileSelectorIcon,\n ImageSelectorIcon,\n openPicker: () => openPicker(bottomSheetRef),\n topInset,\n };\n\n const overlayStyle = useAnimatedStyle<ViewStyle>(\n () => ({\n opacity: overlayOpacity.value,\n }),\n [],\n );\n\n const overlayContext = {\n overlay,\n setOverlay,\n style: value?.style,\n translucentStatusBar,\n };\n\n if (loadingTranslators) return null;\n\n return (\n <TranslationProvider value={translators}>\n <OverlayContext.Provider value={overlayContext}>\n <MessageOverlayProvider<StreamChatGenerics>>\n <AttachmentPickerProvider value={attachmentPickerContext}>\n <ImageGalleryProvider>\n <ChannelsStateProvider<StreamChatGenerics>>{children}</ChannelsStateProvider>\n <ThemeProvider style={overlayContext.style}>\n <Animated.View\n pointerEvents={overlay === 'none' ? 'none' : 'auto'}\n style={[StyleSheet.absoluteFill, overlayStyle]}\n >\n <OverlayBackdrop style={[StyleSheet.absoluteFill, { height, width }]} />\n </Animated.View>\n {overlay === 'message' && (\n <MessageOverlay<StreamChatGenerics>\n MessageActionList={MessageActionList}\n MessageActionListItem={MessageActionListItem}\n messageTextNumberOfLines={messageTextNumberOfLines}\n overlayOpacity={overlayOpacity}\n OverlayReactionList={OverlayReactionList}\n OverlayReactions={OverlayReactions}\n OverlayReactionsAvatar={OverlayReactionsAvatar}\n />\n )}\n {overlay === 'gallery' && (\n <ImageGallery<StreamChatGenerics>\n giphyVersion={giphyVersion}\n imageGalleryCustomComponents={imageGalleryCustomComponents}\n imageGalleryGridHandleHeight={imageGalleryGridHandleHeight}\n imageGalleryGridSnapPoints={imageGalleryGridSnapPoints}\n numberOfImageGalleryGridColumns={numberOfImageGalleryGridColumns}\n overlayOpacity={overlayOpacity}\n />\n )}\n <AttachmentPicker ref={bottomSheetRef} {...attachmentPickerProps} />\n </ThemeProvider>\n </ImageGalleryProvider>\n </AttachmentPickerProvider>\n </MessageOverlayProvider>\n </OverlayContext.Provider>\n </TranslationProvider>\n );\n};\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Please check the `PaginatedMessageListContextValue` in [PaginatedMessageListContext](https://github.com/GetStream/stream-chat-react-native/blob/master/src/contexts/paginatedMessageListContext/PaginatedMessageListContext.tsx), for consumable values.
|
|
1
|
+
Please check the `PaginatedMessageListContextValue` in [PaginatedMessageListContext](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/contexts/paginatedMessageListContext/PaginatedMessageListContext.tsx), for consumable values.
|
|
2
2
|
Provider for this context exists in `Channel` component. And so, any child component of Channel
|
|
3
3
|
can get access to context as following:
|
|
4
4
|
|
|
@@ -31,4 +31,4 @@ class SomeChildComponent extends React.Component {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
// UI Logic
|
|
34
|
-
}
|
|
34
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
The MessageInput component supports a suggestions feature. Suggestions are displayed using a popup which contains a list of the suggestion items. All functionality is saved in the SuggestionsContext and can be accessed through the [SuggestionsProvider](https://github.com/GetStream/stream-chat-react-native/blob/master/src/contexts/suggestionsContext/SuggestionsContext.tsx) higher order component. This HOC provides the following functions to its underlying child components:
|
|
1
|
+
The MessageInput component supports a suggestions feature. Suggestions are displayed using a popup which contains a list of the suggestion items. All functionality is saved in the SuggestionsContext and can be accessed through the [SuggestionsProvider](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/contexts/suggestionsContext/SuggestionsContext.tsx) higher order component. This HOC provides the following functions to its underlying child components:
|
|
2
2
|
|
|
3
3
|
- **closeSuggestions** {function} Closes the suggestions popup above the input box
|
|
4
4
|
- **openSuggestions** {function} Opens the suggestions popup above the input box
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Please check the `TypingContextValue` in [TypingContext](https://github.com/GetStream/stream-chat-react-native/blob/master/src/contexts/TypingContext/TypingContext.tsx), for consumable values.
|
|
1
|
+
Please check the `TypingContextValue` in [TypingContext](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/contexts/TypingContext/TypingContext.tsx), for consumable values.
|
|
2
2
|
Provider for this context exists in `Channel` component. And so, any child component of Channel
|
|
3
3
|
can get access to context as following:
|
|
4
4
|
|
|
@@ -30,4 +30,4 @@ class SomeChildComponent extends React.Component {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
// UI Logic
|
|
33
|
-
}
|
|
33
|
+
}
|
package/lib/module/version.json
CHANGED
|
@@ -5,25 +5,25 @@ export declare type AttachmentPickerProps = {
|
|
|
5
5
|
/**
|
|
6
6
|
* Custom UI component to render [draggable handle](https://github.com/GetStream/stream-chat-react-native/blob/master/screenshots/docs/1.png) of attachment picker.
|
|
7
7
|
*
|
|
8
|
-
* **Default** [AttachmentPickerBottomSheetHandle](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/AttachmentPicker/components/AttachmentPickerBottomSheetHandle.tsx)
|
|
8
|
+
* **Default** [AttachmentPickerBottomSheetHandle](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/AttachmentPicker/components/AttachmentPickerBottomSheetHandle.tsx)
|
|
9
9
|
*/
|
|
10
10
|
AttachmentPickerBottomSheetHandle: React.FC<BottomSheetHandleProps>;
|
|
11
11
|
/**
|
|
12
12
|
* Custom UI component to render error component while opening attachment picker.
|
|
13
13
|
*
|
|
14
|
-
* **Default** [AttachmentPickerError](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/AttachmentPicker/components/AttachmentPickerError.tsx)
|
|
14
|
+
* **Default** [AttachmentPickerError](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/AttachmentPicker/components/AttachmentPickerError.tsx)
|
|
15
15
|
*/
|
|
16
16
|
AttachmentPickerError: React.ComponentType<AttachmentPickerErrorProps>;
|
|
17
17
|
/**
|
|
18
18
|
* Custom UI component to render error image for attachment picker
|
|
19
19
|
*
|
|
20
|
-
* **Default** [AttachmentPickerErrorImage](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/AttachmentPicker/components/AttachmentPickerErrorImage.tsx)
|
|
20
|
+
* **Default** [AttachmentPickerErrorImage](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/AttachmentPicker/components/AttachmentPickerErrorImage.tsx)
|
|
21
21
|
*/
|
|
22
22
|
AttachmentPickerErrorImage: React.ComponentType;
|
|
23
23
|
/**
|
|
24
24
|
* Custom UI component to render overlay component, that shows up on top of [selected image](https://github.com/GetStream/stream-chat-react-native/blob/master/screenshots/docs/1.png) (with tick mark)
|
|
25
25
|
*
|
|
26
|
-
* **Default** [ImageOverlaySelectedComponent](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/AttachmentPicker/components/ImageOverlaySelectedComponent.tsx)
|
|
26
|
+
* **Default** [ImageOverlaySelectedComponent](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/AttachmentPicker/components/ImageOverlaySelectedComponent.tsx)
|
|
27
27
|
*/
|
|
28
28
|
ImageOverlaySelectedComponent: React.ComponentType;
|
|
29
29
|
attachmentPickerBottomSheetHandleHeight?: number;
|
|
@@ -28,7 +28,7 @@ export declare type ChannelPropsWithContext<StreamChatGenerics extends DefaultSt
|
|
|
28
28
|
/**
|
|
29
29
|
* When true, disables the KeyboardCompatibleView wrapper
|
|
30
30
|
*
|
|
31
|
-
* Channel internally uses the [KeyboardCompatibleView](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/KeyboardCompatibleView/KeyboardCompatibleView.tsx)
|
|
31
|
+
* Channel internally uses the [KeyboardCompatibleView](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/KeyboardCompatibleView/KeyboardCompatibleView.tsx)
|
|
32
32
|
* component to adjust the height of Channel when the keyboard is opened or dismissed. This prop provides the ability to disable this functionality in case you
|
|
33
33
|
* want to use [KeyboardAvoidingView](https://facebook.github.io/react-native/docs/keyboardavoidingview) or handle dismissal yourself.
|
|
34
34
|
* KeyboardAvoidingView works well when your component occupies 100% of screen height, otherwise it may raise some issues.
|
|
@@ -63,7 +63,7 @@ export declare type ChannelPropsWithContext<StreamChatGenerics extends DefaultSt
|
|
|
63
63
|
keyboardBehavior?: KeyboardAvoidingViewProps['behavior'];
|
|
64
64
|
/**
|
|
65
65
|
* Custom wrapper component that handles height adjustment of Channel component when keyboard is opened or dismissed
|
|
66
|
-
* Default component (accepts the same props): [KeyboardCompatibleView](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/KeyboardCompatibleView/KeyboardCompatibleView.tsx)
|
|
66
|
+
* Default component (accepts the same props): [KeyboardCompatibleView](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/KeyboardCompatibleView/KeyboardCompatibleView.tsx)
|
|
67
67
|
*
|
|
68
68
|
* **Example:**
|
|
69
69
|
*
|
|
@@ -65,7 +65,7 @@ export declare type ChatProps<StreamChatGenerics extends DefaultStreamChatGeneri
|
|
|
65
65
|
*/
|
|
66
66
|
i18nInstance?: Streami18n;
|
|
67
67
|
/**
|
|
68
|
-
* You can pass the theme object to customize the styles of Chat components. You can check the default theme in [theme.ts](https://github.com/GetStream/stream-chat-react-native/blob/master/src/contexts/themeContext/utils/theme.ts)
|
|
68
|
+
* You can pass the theme object to customize the styles of Chat components. You can check the default theme in [theme.ts](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/contexts/themeContext/utils/theme.ts)
|
|
69
69
|
*
|
|
70
70
|
* Please check section about [themes in cookbook](https://github.com/GetStream/stream-chat-react-native/wiki/Cookbook-v3.0#theme) for details.
|
|
71
71
|
*
|
|
@@ -56,13 +56,7 @@ export declare type ImageGalleryCustomComponents<StreamChatGenerics extends Defa
|
|
|
56
56
|
};
|
|
57
57
|
declare type Props<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = ImageGalleryCustomComponents<StreamChatGenerics> & {
|
|
58
58
|
overlayOpacity: Animated.SharedValue<number>;
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* This should be
|
|
62
|
-
*/
|
|
63
|
-
imageGalleryGridSnapPoints?: [string | number, string | number];
|
|
64
|
-
numberOfImageGalleryGridColumns?: number;
|
|
65
|
-
} & Pick<OverlayProviderProps<StreamChatGenerics>, 'giphyVersion'>;
|
|
59
|
+
} & Pick<OverlayProviderProps<StreamChatGenerics>, 'giphyVersion' | 'imageGalleryGridSnapPoints' | 'imageGalleryGridHandleHeight' | 'numberOfImageGalleryGridColumns'>;
|
|
66
60
|
export declare const ImageGallery: {
|
|
67
61
|
<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(props: Props<StreamChatGenerics>): JSX.Element;
|
|
68
62
|
displayName: string;
|
|
@@ -46,7 +46,7 @@ export declare type MessagePropsWithContext<StreamChatGenerics extends DefaultSt
|
|
|
46
46
|
* You can call methods available on the Message
|
|
47
47
|
* component such as handleEdit, handleDelete, handleAction etc.
|
|
48
48
|
*
|
|
49
|
-
* Source - [Message](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Message/Message.tsx)
|
|
49
|
+
* Source - [Message](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/Message/Message.tsx)
|
|
50
50
|
*
|
|
51
51
|
* By default, we show the overlay with all the message actions on long press.
|
|
52
52
|
*
|
|
@@ -58,7 +58,7 @@ export declare type MessagePropsWithContext<StreamChatGenerics extends DefaultSt
|
|
|
58
58
|
* You can call methods available on the Message
|
|
59
59
|
* component such as handleEdit, handleDelete, handleAction etc.
|
|
60
60
|
*
|
|
61
|
-
* Source - [Message](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Message/Message.tsx)
|
|
61
|
+
* Source - [Message](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/Message/Message.tsx)
|
|
62
62
|
*
|
|
63
63
|
* By default, we will dismiss the keyboard on press.
|
|
64
64
|
*
|
|
@@ -17,20 +17,20 @@ export declare type AttachmentPickerContextValue = {
|
|
|
17
17
|
/**
|
|
18
18
|
* Custom UI component for [camera selector icon](https://github.com/GetStream/stream-chat-react-native/blob/master/screenshots/docs/1.png)
|
|
19
19
|
*
|
|
20
|
-
* **Default: ** [CameraSelectorIcon](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/AttachmentPicker/components/CameraSelectorIcon.tsx)
|
|
20
|
+
* **Default: ** [CameraSelectorIcon](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/AttachmentPicker/components/CameraSelectorIcon.tsx)
|
|
21
21
|
*/
|
|
22
22
|
CameraSelectorIcon: React.ComponentType<AttachmentPickerIconProps>;
|
|
23
23
|
closePicker: () => void;
|
|
24
24
|
/**
|
|
25
25
|
* Custom UI component for [file selector icon](https://github.com/GetStream/stream-chat-react-native/blob/master/screenshots/docs/1.png)
|
|
26
26
|
*
|
|
27
|
-
* **Default: ** [FileSelectorIcon](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/AttachmentPicker/components/FileSelectorIcon.tsx)
|
|
27
|
+
* **Default: ** [FileSelectorIcon](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/AttachmentPicker/components/FileSelectorIcon.tsx)
|
|
28
28
|
*/
|
|
29
29
|
FileSelectorIcon: React.ComponentType<AttachmentPickerIconProps>;
|
|
30
30
|
/**
|
|
31
31
|
* Custom UI component for [image selector icon](https://github.com/GetStream/stream-chat-react-native/blob/master/screenshots/docs/1.png)
|
|
32
32
|
*
|
|
33
|
-
* **Default: ** [ImageSelectorIcon](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/AttachmentPicker/components/ImageSelectorIcon.tsx)
|
|
33
|
+
* **Default: ** [ImageSelectorIcon](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/AttachmentPicker/components/ImageSelectorIcon.tsx)
|
|
34
34
|
*/
|
|
35
35
|
ImageSelectorIcon: React.ComponentType<AttachmentPickerIconProps>;
|
|
36
36
|
/**
|
|
@@ -30,7 +30,7 @@ export declare type ChannelContextValue<StreamChatGenerics extends DefaultStream
|
|
|
30
30
|
/**
|
|
31
31
|
* Custom UI component to display empty state when channel has no messages.
|
|
32
32
|
*
|
|
33
|
-
* **Default** [EmptyStateIndicator](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Indicators/EmptyStateIndicator.tsx)
|
|
33
|
+
* **Default** [EmptyStateIndicator](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/Indicators/EmptyStateIndicator.tsx)
|
|
34
34
|
*/
|
|
35
35
|
EmptyStateIndicator: React.ComponentType<EmptyStateProps>;
|
|
36
36
|
/**
|
|
@@ -145,7 +145,7 @@ export declare type ChannelContextValue<StreamChatGenerics extends DefaultStream
|
|
|
145
145
|
/**
|
|
146
146
|
* Custom UI component for sticky header of channel.
|
|
147
147
|
*
|
|
148
|
-
* **Default** [DateHeader](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/MessageList/DateHeader.tsx)
|
|
148
|
+
* **Default** [DateHeader](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/MessageList/DateHeader.tsx)
|
|
149
149
|
*/
|
|
150
150
|
StickyHeader?: React.ComponentType<{
|
|
151
151
|
dateString: string;
|
|
@@ -158,37 +158,37 @@ export declare type ChannelsContextValue<StreamChatGenerics extends DefaultStrea
|
|
|
158
158
|
/**
|
|
159
159
|
* Custom UI component to render preview avatar.
|
|
160
160
|
*
|
|
161
|
-
* **Default** [ChannelAvatar](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/ChannelPreview/ChannelAvatar.tsx)
|
|
161
|
+
* **Default** [ChannelAvatar](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/ChannelPreview/ChannelAvatar.tsx)
|
|
162
162
|
*/
|
|
163
163
|
PreviewAvatar?: React.ComponentType<ChannelAvatarProps<StreamChatGenerics>>;
|
|
164
164
|
/**
|
|
165
165
|
* Custom UI component to render preview of latest message on channel.
|
|
166
166
|
*
|
|
167
|
-
* **Default** [ChannelPreviewMessage](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/ChannelPreview/ChannelPreviewMessage.tsx)
|
|
167
|
+
* **Default** [ChannelPreviewMessage](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/ChannelPreview/ChannelPreviewMessage.tsx)
|
|
168
168
|
*/
|
|
169
169
|
PreviewMessage?: React.ComponentType<ChannelPreviewMessageProps<StreamChatGenerics>>;
|
|
170
170
|
/**
|
|
171
171
|
* Custom UI component to render muted status.
|
|
172
172
|
*
|
|
173
|
-
* **Default** [ChannelMutedStatus](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/ChannelPreview/ChannelPreviewMutedStatus.tsx)
|
|
173
|
+
* **Default** [ChannelMutedStatus](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/ChannelPreview/ChannelPreviewMutedStatus.tsx)
|
|
174
174
|
*/
|
|
175
175
|
PreviewMutedStatus?: React.ComponentType<ChannelPreviewMutedStatusProps<StreamChatGenerics>>;
|
|
176
176
|
/**
|
|
177
177
|
* Custom UI component to render preview avatar.
|
|
178
178
|
*
|
|
179
|
-
* **Default** [ChannelPreviewStatus](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/ChannelPreview/ChannelPreviewStatus.tsx)
|
|
179
|
+
* **Default** [ChannelPreviewStatus](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/ChannelPreview/ChannelPreviewStatus.tsx)
|
|
180
180
|
*/
|
|
181
181
|
PreviewStatus?: React.ComponentType<ChannelPreviewStatusProps<StreamChatGenerics>>;
|
|
182
182
|
/**
|
|
183
183
|
* Custom UI component to render preview avatar.
|
|
184
184
|
*
|
|
185
|
-
* **Default** [ChannelPreviewTitle](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/ChannelPreview/ChannelPreviewTitle.tsx)
|
|
185
|
+
* **Default** [ChannelPreviewTitle](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/ChannelPreview/ChannelPreviewTitle.tsx)
|
|
186
186
|
*/
|
|
187
187
|
PreviewTitle?: React.ComponentType<ChannelPreviewTitleProps<StreamChatGenerics>>;
|
|
188
188
|
/**
|
|
189
189
|
* Custom UI component to render preview avatar.
|
|
190
190
|
*
|
|
191
|
-
* **Default** [ChannelPreviewUnreadCount](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/ChannelPreview/ChannelPreviewUnreadCount.tsx)
|
|
191
|
+
* **Default** [ChannelPreviewUnreadCount](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/ChannelPreview/ChannelPreviewUnreadCount.tsx)
|
|
192
192
|
*/
|
|
193
193
|
PreviewUnreadCount?: React.ComponentType<ChannelPreviewUnreadCountProps<StreamChatGenerics>>;
|
|
194
194
|
};
|
|
@@ -50,7 +50,7 @@ export declare type MessageContextValue<StreamChatGenerics extends DefaultStream
|
|
|
50
50
|
* You can call methods available on the Message
|
|
51
51
|
* component such as handleEdit, handleDelete, handleAction etc.
|
|
52
52
|
*
|
|
53
|
-
* Source - [Message](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Message/Message.tsx)
|
|
53
|
+
* Source - [Message](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/Message/Message.tsx)
|
|
54
54
|
*
|
|
55
55
|
* By default, we show the overlay with all the message actions on long press.
|
|
56
56
|
*
|
|
@@ -65,7 +65,7 @@ export declare type MessageContextValue<StreamChatGenerics extends DefaultStream
|
|
|
65
65
|
* You can call methods available on the Message
|
|
66
66
|
* component such as handleEdit, handleDelete, handleAction etc.
|
|
67
67
|
*
|
|
68
|
-
* Source - [Message](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Message/Message.tsx)
|
|
68
|
+
* Source - [Message](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/Message/Message.tsx)
|
|
69
69
|
*
|
|
70
70
|
* By default, we will dismiss the keyboard on press.
|
|
71
71
|
*
|