stream-chat-react-native-core 5.2.0-beta.1 → 5.3.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/components/Attachment/Card.js +29 -18
- package/lib/commonjs/components/Attachment/Card.js.map +1 -1
- package/lib/commonjs/components/Attachment/Gallery.js +16 -20
- package/lib/commonjs/components/Attachment/Gallery.js.map +1 -1
- package/lib/commonjs/components/Attachment/GalleryImage.js +34 -6
- package/lib/commonjs/components/Attachment/GalleryImage.js.map +1 -1
- package/lib/commonjs/components/Attachment/Giphy.js +37 -29
- package/lib/commonjs/components/Attachment/Giphy.js.map +1 -1
- package/lib/commonjs/components/Avatar/Avatar.js +10 -8
- package/lib/commonjs/components/Avatar/Avatar.js.map +1 -1
- package/lib/commonjs/components/Avatar/GroupAvatar.js +3 -1
- package/lib/commonjs/components/Avatar/GroupAvatar.js.map +1 -1
- package/lib/commonjs/components/ChannelList/ChannelList.js +4 -4
- package/lib/commonjs/components/ChannelList/ChannelList.js.map +1 -1
- package/lib/commonjs/components/ChannelList/ChannelListMessenger.js +4 -4
- package/lib/commonjs/components/ChannelList/ChannelListMessenger.js.map +1 -1
- package/lib/commonjs/components/ChannelList/hooks/useCreateChannelsContext.js +1 -1
- package/lib/commonjs/components/ChannelList/hooks/useCreateChannelsContext.js.map +1 -1
- package/lib/commonjs/components/ChannelList/hooks/usePaginatedChannels.js +6 -7
- package/lib/commonjs/components/ChannelList/hooks/usePaginatedChannels.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelAvatar.js +30 -6
- package/lib/commonjs/components/ChannelPreview/ChannelAvatar.js.map +1 -1
- package/lib/commonjs/components/Chat/Chat.js +8 -5
- package/lib/commonjs/components/Chat/Chat.js.map +1 -1
- package/lib/commonjs/components/Chat/hooks/useCreateChatContext.js +2 -0
- package/lib/commonjs/components/Chat/hooks/useCreateChatContext.js.map +1 -1
- package/lib/commonjs/components/ImageBackground.js +64 -0
- package/lib/commonjs/components/ImageBackground.js.map +1 -0
- package/lib/commonjs/components/Message/Message.js +15 -16
- package/lib/commonjs/components/Message/Message.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageAvatar.js +12 -4
- package/lib/commonjs/components/Message/MessageSimple/MessageAvatar.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageRepliesAvatars.js +26 -5
- package/lib/commonjs/components/Message/MessageSimple/MessageRepliesAvatars.js.map +1 -1
- package/lib/commonjs/components/MessageOverlay/MessageOverlay.js +58 -47
- package/lib/commonjs/components/MessageOverlay/MessageOverlay.js.map +1 -1
- package/lib/commonjs/components/MessageOverlay/OverlayReactions.js +19 -19
- package/lib/commonjs/components/MessageOverlay/OverlayReactions.js.map +1 -1
- package/lib/commonjs/contexts/channelsContext/ChannelsContext.js.map +1 -1
- package/lib/commonjs/contexts/chatContext/ChatContext.js +2 -2
- package/lib/commonjs/contexts/chatContext/ChatContext.js.map +1 -1
- package/lib/commonjs/contexts/messageOverlayContext/MessageOverlayContext.js +2 -2
- package/lib/commonjs/contexts/messageOverlayContext/MessageOverlayContext.js.map +1 -1
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/Attachment/Card.js +29 -18
- package/lib/module/components/Attachment/Card.js.map +1 -1
- package/lib/module/components/Attachment/Gallery.js +16 -20
- package/lib/module/components/Attachment/Gallery.js.map +1 -1
- package/lib/module/components/Attachment/GalleryImage.js +34 -6
- package/lib/module/components/Attachment/GalleryImage.js.map +1 -1
- package/lib/module/components/Attachment/Giphy.js +37 -29
- package/lib/module/components/Attachment/Giphy.js.map +1 -1
- package/lib/module/components/Avatar/Avatar.js +10 -8
- package/lib/module/components/Avatar/Avatar.js.map +1 -1
- package/lib/module/components/Avatar/GroupAvatar.js +3 -1
- package/lib/module/components/Avatar/GroupAvatar.js.map +1 -1
- package/lib/module/components/ChannelList/ChannelList.js +4 -4
- package/lib/module/components/ChannelList/ChannelList.js.map +1 -1
- package/lib/module/components/ChannelList/ChannelListMessenger.js +4 -4
- package/lib/module/components/ChannelList/ChannelListMessenger.js.map +1 -1
- package/lib/module/components/ChannelList/hooks/useCreateChannelsContext.js +1 -1
- package/lib/module/components/ChannelList/hooks/useCreateChannelsContext.js.map +1 -1
- package/lib/module/components/ChannelList/hooks/usePaginatedChannels.js +6 -7
- package/lib/module/components/ChannelList/hooks/usePaginatedChannels.js.map +1 -1
- package/lib/module/components/ChannelPreview/ChannelAvatar.js +30 -6
- package/lib/module/components/ChannelPreview/ChannelAvatar.js.map +1 -1
- package/lib/module/components/Chat/Chat.js +8 -5
- package/lib/module/components/Chat/Chat.js.map +1 -1
- package/lib/module/components/Chat/hooks/useCreateChatContext.js +2 -0
- package/lib/module/components/Chat/hooks/useCreateChatContext.js.map +1 -1
- package/lib/module/components/ImageBackground.js +64 -0
- package/lib/module/components/ImageBackground.js.map +1 -0
- package/lib/module/components/Message/Message.js +15 -16
- package/lib/module/components/Message/Message.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/MessageAvatar.js +12 -4
- package/lib/module/components/Message/MessageSimple/MessageAvatar.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/MessageRepliesAvatars.js +26 -5
- package/lib/module/components/Message/MessageSimple/MessageRepliesAvatars.js.map +1 -1
- package/lib/module/components/MessageOverlay/MessageOverlay.js +58 -47
- package/lib/module/components/MessageOverlay/MessageOverlay.js.map +1 -1
- package/lib/module/components/MessageOverlay/OverlayReactions.js +19 -19
- package/lib/module/components/MessageOverlay/OverlayReactions.js.map +1 -1
- package/lib/module/contexts/channelsContext/ChannelsContext.js.map +1 -1
- package/lib/module/contexts/chatContext/ChatContext.js +2 -2
- package/lib/module/contexts/chatContext/ChatContext.js.map +1 -1
- package/lib/module/contexts/messageOverlayContext/MessageOverlayContext.js +2 -2
- package/lib/module/contexts/messageOverlayContext/MessageOverlayContext.js.map +1 -1
- package/lib/module/version.json +1 -1
- package/lib/typescript/components/Attachment/Card.d.ts +3 -2
- package/lib/typescript/components/Attachment/GalleryImage.d.ts +8 -2
- package/lib/typescript/components/Attachment/Giphy.d.ts +2 -1
- package/lib/typescript/components/Avatar/Avatar.d.ts +2 -1
- package/lib/typescript/components/Avatar/GroupAvatar.d.ts +2 -1
- package/lib/typescript/components/ChannelList/hooks/usePaginatedChannels.d.ts +1 -1
- package/lib/typescript/components/ChannelPreview/ChannelAvatar.d.ts +2 -0
- package/lib/typescript/components/Chat/Chat.d.ts +1 -1
- package/lib/typescript/components/Chat/hooks/useCreateChatContext.d.ts +1 -1
- package/lib/typescript/components/ImageBackground.d.ts +33 -0
- package/lib/typescript/components/Message/Message.d.ts +2 -1
- package/lib/typescript/components/Message/MessageSimple/MessageAvatar.d.ts +2 -1
- package/lib/typescript/components/Message/MessageSimple/MessageRepliesAvatars.d.ts +2 -0
- package/lib/typescript/components/MessageOverlay/OverlayReactions.d.ts +1 -0
- package/lib/typescript/contexts/channelsContext/ChannelsContext.d.ts +1 -1
- package/lib/typescript/contexts/chatContext/ChatContext.d.ts +3 -1
- package/lib/typescript/contexts/messageOverlayContext/MessageOverlayContext.d.ts +4 -0
- package/package.json +1 -1
- package/src/__tests__/offline-feature.test.js +3 -1
- package/src/components/Attachment/Card.tsx +11 -2
- package/src/components/Attachment/Gallery.tsx +1 -7
- package/src/components/Attachment/GalleryImage.tsx +31 -9
- package/src/components/Attachment/Giphy.tsx +8 -2
- package/src/components/Avatar/Avatar.tsx +12 -2
- package/src/components/Avatar/GroupAvatar.tsx +4 -4
- package/src/components/ChannelList/ChannelList.tsx +3 -2
- package/src/components/ChannelList/ChannelListMessenger.tsx +3 -3
- package/src/components/ChannelList/__tests__/ChannelList.test.js +1 -1
- package/src/components/ChannelList/hooks/listeners/__tests__/useChannelUpdated.test.tsx +2 -1
- package/src/components/ChannelList/hooks/useCreateChannelsContext.ts +1 -1
- package/src/components/ChannelList/hooks/usePaginatedChannels.ts +12 -11
- package/src/components/ChannelPreview/ChannelAvatar.tsx +23 -4
- package/src/components/Chat/Chat.tsx +98 -95
- package/src/components/Chat/hooks/useCreateChatContext.ts +2 -0
- package/src/components/ImageBackground.tsx +77 -0
- package/src/components/Message/Message.tsx +8 -8
- package/src/components/Message/MessageSimple/MessageAvatar.tsx +6 -2
- package/src/components/Message/MessageSimple/MessageRepliesAvatars.tsx +15 -3
- package/src/components/MessageOverlay/MessageOverlay.tsx +210 -205
- package/src/components/MessageOverlay/OverlayReactions.tsx +1 -0
- package/src/contexts/channelsContext/ChannelsContext.tsx +1 -1
- package/src/contexts/chatContext/ChatContext.tsx +3 -1
- package/src/contexts/messageOverlayContext/MessageOverlayContext.tsx +8 -1
- package/src/version.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["MessageOverlayContext.tsx"],"names":["MessageOverlayContext","React","createContext","DEFAULT_BASE_CONTEXT_VALUE","MessageOverlayProvider","children","value","messageOverlayContext","useMessageOverlayContext","contextValue","Error","withMessageOverlayContext","Component","WithMessageOverlayContextComponent","props","messageContext","displayName"],"mappings":";;;;;;;;;;;AAAA;;
|
|
1
|
+
{"version":3,"sources":["MessageOverlayContext.tsx"],"names":["MessageOverlayContext","React","createContext","DEFAULT_BASE_CONTEXT_VALUE","MessageOverlayProvider","children","value","messageOverlayContext","useMessageOverlayContext","contextValue","Error","withMessageOverlayContext","Component","WithMessageOverlayContextComponent","props","messageContext","displayName"],"mappings":";;;;;;;;;;;AAAA;;AAMA;;AAiBA;;AAEA;;AACA;;;;;;;;;AAwDO,IAAMA,qBAAqB,GAAGC,kBAAMC,aAAN,CACnCC,mDADmC,CAA9B;;;;AAIA,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;AACE,IAAA,KAAK,EAAEC,qBADT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAGGF,QAHH,CADF;AAOD,CAhBM;;;;AAkBA,IAAMG,wBAAwB,GAAG,SAA3BA,wBAA2B,GAEjC;AACL,MAAMC,YAAY,GAAG,uBACnBT,qBADmB,CAArB;;AAIA,MAAIS,YAAY,KAAKN,mDAAjB,IAA+C,CAAC,2CAApD,EAAyE;AACvE,UAAM,IAAIO,KAAJ,0PAAN;AAGD;;AAED,SAAOD,YAAP;AACD,CAdM;;;;AAqBA,IAAME,yBAAyB,GAAG,SAA5BA,yBAA4B,CAIvCC,SAJuC,EAKqC;AAC5E,MAAMC,kCAAkC,GAAG,SAArCA,kCAAqC,CACzCC,KADyC,EAEtC;AACH,QAAMC,cAAc,GAAGP,wBAAwB,EAA/C;AAEA,WAAO,gCAAC,SAAD,gCAAgBM,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 { ImageProps } from 'react-native';\n\nimport type { Attachment, TranslationLanguages } 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 { ChatContextValue } from '../chatContext/ChatContext';\nimport type { Alignment, MessageContextValue } from '../messageContext/MessageContext';\nimport type { MessagesContextValue } from '../messagesContext/MessagesContext';\nimport type { OwnCapabilitiesContextValue } from '../ownCapabilitiesContext/OwnCapabilitiesContext';\nimport { DEFAULT_BASE_CONTEXT_VALUE } from '../utils/defaultBaseContextValue';\n\nimport { getDisplayName } from '../utils/getDisplayName';\nimport { isTestEnvironment } from '../utils/isTestEnvironment';\n\nexport type MessageOverlayData<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = {\n alignment?: Alignment;\n chatContext?: ChatContextValue<StreamChatGenerics>;\n clientId?: string;\n files?: Attachment<StreamChatGenerics>[];\n groupStyles?: GroupType[];\n handleReaction?: (reactionType: string) => Promise<void>;\n ImageComponent?: React.ComponentType<ImageProps>;\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 userLanguage?: TranslationLanguages;\n videos?: Attachment<StreamChatGenerics>[];\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/main/screenshots/docs/2.png) in overlay.\n *\n * **Default** [MessageActionList](https://github.com/GetStream/stream-chat-react-native/blob/main/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/main/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/main/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/main/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/main/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(\n DEFAULT_BASE_CONTEXT_VALUE as MessageOverlayContextValue,\n);\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\n value={messageOverlayContext as unknown as MessageOverlayContextValue}\n >\n {children}\n </MessageOverlayContext.Provider>\n );\n};\n\nexport const useMessageOverlayContext = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>() => {\n const contextValue = useContext(\n MessageOverlayContext,\n ) as unknown as MessageOverlayContextValue<StreamChatGenerics>;\n\n if (contextValue === DEFAULT_BASE_CONTEXT_VALUE && !isTestEnvironment()) {\n throw new Error(\n `The useMessageOverlayContext hook was called outside the MessageOverlayContext Provider. Make sure you have configured OverlayProvider component correctly - https://getstream.io/chat/docs/sdk/reactnative/basics/hello_stream_chat/#overlay-provider`,\n );\n }\n\n return contextValue;\n};\n\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"]}
|
package/lib/module/version.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ImageStyle, StyleProp, TextStyle, ViewStyle } from 'react-native';
|
|
2
2
|
import type { Attachment } from 'stream-chat';
|
|
3
|
+
import { ChatContextValue } from '../../contexts/chatContext/ChatContext';
|
|
3
4
|
import { MessageContextValue } from '../../contexts/messageContext/MessageContext';
|
|
4
5
|
import { MessagesContextValue } from '../../contexts/messagesContext/MessagesContext';
|
|
5
6
|
import type { DefaultStreamChatGenerics } from '../../types/types';
|
|
6
|
-
export declare type CardPropsWithContext<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = Attachment<StreamChatGenerics> & Pick<MessageContextValue<StreamChatGenerics>, 'onLongPress' | 'onPress' | 'onPressIn' | 'preventPress'> & Pick<MessagesContextValue<StreamChatGenerics>, 'additionalTouchableProps' | 'CardCover' | 'CardFooter' | 'CardHeader'> & {
|
|
7
|
+
export declare type CardPropsWithContext<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = Attachment<StreamChatGenerics> & Pick<ChatContextValue, 'ImageComponent'> & Pick<MessageContextValue<StreamChatGenerics>, 'onLongPress' | 'onPress' | 'onPressIn' | 'preventPress'> & Pick<MessagesContextValue<StreamChatGenerics>, 'additionalTouchableProps' | 'CardCover' | 'CardFooter' | 'CardHeader'> & {
|
|
7
8
|
channelId: string | undefined;
|
|
8
9
|
messageId: string | undefined;
|
|
9
10
|
styles?: Partial<{
|
|
@@ -19,7 +20,7 @@ export declare type CardPropsWithContext<StreamChatGenerics extends DefaultStrea
|
|
|
19
20
|
title: StyleProp<TextStyle>;
|
|
20
21
|
}>;
|
|
21
22
|
};
|
|
22
|
-
export declare type CardProps<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = Attachment<StreamChatGenerics> & Partial<Pick<MessageContextValue<StreamChatGenerics>, 'onLongPress' | 'onPress' | 'onPressIn'> & Pick<MessagesContextValue<StreamChatGenerics>, 'additionalTouchableProps' | 'CardCover' | 'CardFooter' | 'CardHeader'>>;
|
|
23
|
+
export declare type CardProps<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = Attachment<StreamChatGenerics> & Partial<Pick<ChatContextValue<StreamChatGenerics>, 'ImageComponent'> & Pick<MessageContextValue<StreamChatGenerics>, 'onLongPress' | 'onPress' | 'onPressIn'> & Pick<MessagesContextValue<StreamChatGenerics>, 'additionalTouchableProps' | 'CardCover' | 'CardFooter' | 'CardHeader'>>;
|
|
23
24
|
/**
|
|
24
25
|
* UI component for card in attachments.
|
|
25
26
|
*/
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ImageProps } from 'react-native';
|
|
3
|
-
|
|
3
|
+
import { ChatContextValue } from '../../contexts/chatContext/ChatContext';
|
|
4
|
+
import type { DefaultStreamChatGenerics } from '../../types/types';
|
|
5
|
+
export declare type GalleryImageWithContextProps<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = GalleryImageProps & Pick<ChatContextValue<StreamChatGenerics>, 'ImageComponent'>;
|
|
6
|
+
export declare const GalleryImageWithContext: React.FC<GalleryImageWithContextProps>;
|
|
7
|
+
export declare const MemoizedGalleryImage: React.NamedExoticComponent<GalleryImageWithContextProps<DefaultStreamChatGenerics>>;
|
|
8
|
+
export declare type GalleryImageProps = Omit<ImageProps, 'height' | 'source'> & {
|
|
4
9
|
uri: string;
|
|
5
|
-
}
|
|
10
|
+
};
|
|
11
|
+
export declare const GalleryImage: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(props: GalleryImageProps) => JSX.Element;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { Attachment } from 'stream-chat';
|
|
2
|
+
import { ChatContextValue } from '../../contexts/chatContext/ChatContext';
|
|
2
3
|
import { ImageGalleryContextValue } from '../../contexts/imageGalleryContext/ImageGalleryContext';
|
|
3
4
|
import { MessageContextValue } from '../../contexts/messageContext/MessageContext';
|
|
4
5
|
import { MessagesContextValue } from '../../contexts/messagesContext/MessagesContext';
|
|
5
6
|
import { OverlayContextValue } from '../../contexts/overlayContext/OverlayContext';
|
|
6
7
|
import type { DefaultStreamChatGenerics } from '../../types/types';
|
|
7
|
-
export declare type GiphyPropsWithContext<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = Pick<ImageGalleryContextValue<StreamChatGenerics>, 'setSelectedMessage' | 'setMessages'> & Pick<MessageContextValue<StreamChatGenerics>, 'handleAction' | 'isMyMessage' | 'message' | 'onLongPress' | 'onPress' | 'onPressIn' | 'preventPress'> & Pick<MessagesContextValue<StreamChatGenerics>, 'giphyVersion' | 'additionalTouchableProps' | 'ImageLoadingIndicator' | 'ImageLoadingFailedIndicator'> & {
|
|
8
|
+
export declare type GiphyPropsWithContext<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = Pick<ImageGalleryContextValue<StreamChatGenerics>, 'setSelectedMessage' | 'setMessages'> & Pick<MessageContextValue<StreamChatGenerics>, 'handleAction' | 'isMyMessage' | 'message' | 'onLongPress' | 'onPress' | 'onPressIn' | 'preventPress'> & Pick<ChatContextValue<StreamChatGenerics>, 'ImageComponent'> & Pick<MessagesContextValue<StreamChatGenerics>, 'giphyVersion' | 'additionalTouchableProps' | 'ImageLoadingIndicator' | 'ImageLoadingFailedIndicator'> & {
|
|
8
9
|
attachment: Attachment<StreamChatGenerics>;
|
|
9
10
|
} & Pick<OverlayContextValue, 'setOverlay'>;
|
|
10
11
|
export declare type GiphyProps<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = Partial<GiphyPropsWithContext<StreamChatGenerics>> & {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ImageStyle, StyleProp, ViewStyle } from 'react-native';
|
|
2
|
+
import { ImageProps, ImageStyle, StyleProp, ViewStyle } from 'react-native';
|
|
3
3
|
import { CircleProps } from 'react-native-svg';
|
|
4
4
|
export declare type AvatarProps = {
|
|
5
5
|
/** size in pixels */
|
|
@@ -7,6 +7,7 @@ export declare type AvatarProps = {
|
|
|
7
7
|
containerStyle?: StyleProp<ViewStyle>;
|
|
8
8
|
/** image url */
|
|
9
9
|
image?: string;
|
|
10
|
+
ImageComponent?: React.ComponentType<ImageProps>;
|
|
10
11
|
/** name of the picture, used for fallback */
|
|
11
12
|
imageStyle?: StyleProp<ImageStyle>;
|
|
12
13
|
name?: string;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { StyleProp, ViewStyle } from 'react-native';
|
|
2
|
+
import { ImageProps, StyleProp, ViewStyle } from 'react-native';
|
|
3
3
|
export declare type GroupAvatarProps = {
|
|
4
4
|
/** total size in pixels */
|
|
5
5
|
size: number;
|
|
6
6
|
containerStyle?: StyleProp<ViewStyle>;
|
|
7
|
+
ImageComponent?: React.ComponentType<ImageProps>;
|
|
7
8
|
/** image urls */
|
|
8
9
|
images?: string[];
|
|
9
10
|
/** name of the users, used for fallback */
|
|
@@ -10,7 +10,7 @@ declare type Parameters<StreamChatGenerics extends DefaultStreamChatGenerics = D
|
|
|
10
10
|
declare type QueryType = 'queryLocalDB' | 'reload' | 'refresh' | 'loadChannels';
|
|
11
11
|
export declare type QueryChannels = (queryType?: QueryType, retryCount?: number) => Promise<void>;
|
|
12
12
|
export declare const usePaginatedChannels: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>({ enableOfflineSupport, filters, options, sort, }: Parameters<StreamChatGenerics>) => {
|
|
13
|
-
channels: Channel<StreamChatGenerics>[];
|
|
13
|
+
channels: Channel<StreamChatGenerics>[] | null;
|
|
14
14
|
error: Error | undefined;
|
|
15
15
|
hasNextPage: boolean;
|
|
16
16
|
loadingChannels: boolean;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { ChannelPreviewProps } from './ChannelPreview';
|
|
2
|
+
import { ChatContextValue } from '../../contexts/chatContext/ChatContext';
|
|
2
3
|
import type { DefaultStreamChatGenerics } from '../../types/types';
|
|
3
4
|
export declare type ChannelAvatarProps<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = Pick<ChannelPreviewProps<StreamChatGenerics>, 'channel'>;
|
|
4
5
|
/**
|
|
5
6
|
* This UI component displays an avatar for a particular channel.
|
|
6
7
|
*/
|
|
8
|
+
export declare const ChannelAvatarWithContext: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(props: ChannelAvatarProps<StreamChatGenerics> & Pick<ChatContextValue<DefaultStreamChatGenerics>, "ImageComponent">) => JSX.Element;
|
|
7
9
|
export declare const ChannelAvatar: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(props: ChannelAvatarProps<StreamChatGenerics>) => JSX.Element;
|
|
@@ -4,7 +4,7 @@ import { DeepPartial } from '../../contexts/themeContext/ThemeContext';
|
|
|
4
4
|
import type { Theme } from '../../contexts/themeContext/utils/theme';
|
|
5
5
|
import type { DefaultStreamChatGenerics } from '../../types/types';
|
|
6
6
|
import type { Streami18n } from '../../utils/Streami18n';
|
|
7
|
-
export declare type ChatProps<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = Pick<ChatContextValue<StreamChatGenerics>, 'client'> & {
|
|
7
|
+
export declare type ChatProps<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = Pick<ChatContextValue<StreamChatGenerics>, 'client'> & Partial<Pick<ChatContextValue<StreamChatGenerics>, 'ImageComponent'>> & {
|
|
8
8
|
/**
|
|
9
9
|
* When false, ws connection won't be disconnection upon backgrounding the app.
|
|
10
10
|
* To receive push notifications, its necessary that user doesn't have active
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ChatContextValue } from '../../../contexts/chatContext/ChatContext';
|
|
2
2
|
import type { DefaultStreamChatGenerics } from '../../../types/types';
|
|
3
|
-
export declare const useCreateChatContext: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>({ appSettings, channel, client, connectionRecovering, enableOfflineSupport, isOnline, mutedUsers, setActiveChannel, subscribeConnectionRecoveredCallback, }: ChatContextValue<StreamChatGenerics>) => ChatContextValue<StreamChatGenerics>;
|
|
3
|
+
export declare const useCreateChatContext: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>({ appSettings, channel, client, connectionRecovering, enableOfflineSupport, ImageComponent, isOnline, mutedUsers, setActiveChannel, subscribeConnectionRecoveredCallback, }: ChatContextValue<StreamChatGenerics>) => ChatContextValue<StreamChatGenerics>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ImageBackgroundProps, ImageProps } from 'react-native';
|
|
3
|
+
/**
|
|
4
|
+
* DISCLAIMER: This component has been pretty-much copied from react-native's source code
|
|
5
|
+
* https://github.com/facebook/react-native/blob/main/Libraries/Image/ImageBackground.js
|
|
6
|
+
* Few modifications have been done such as converting to functional component, removing ref related logic (since its not required).
|
|
7
|
+
* Also support for prop `ImageComponent` has been introduced to allow rendering custom
|
|
8
|
+
* component instead of `Image`.
|
|
9
|
+
*
|
|
10
|
+
*
|
|
11
|
+
* Very simple drop-in replacement for <Image> which supports nesting views.
|
|
12
|
+
*
|
|
13
|
+
* ```ReactNativeWebPlayer
|
|
14
|
+
* import React, { Component } from 'react';
|
|
15
|
+
* import { AppRegistry, View, ImageBackground, Text } from 'react-native';
|
|
16
|
+
*
|
|
17
|
+
* class DisplayAnImageBackground extends Component {
|
|
18
|
+
* render() {
|
|
19
|
+
* return (
|
|
20
|
+
* <ImageBackground
|
|
21
|
+
* style={{width: 50, height: 50}}
|
|
22
|
+
* source={{uri: 'https://reactnative.dev/img/opengraph.png'}}
|
|
23
|
+
* >
|
|
24
|
+
* <Text>React</Text>
|
|
25
|
+
* </ImageBackground>
|
|
26
|
+
* );
|
|
27
|
+
* }
|
|
28
|
+
* }
|
|
29
|
+
*
|
|
30
|
+
*/
|
|
31
|
+
export declare const ImageBackground: React.ComponentType<ImageBackgroundProps & {
|
|
32
|
+
ImageComponent?: React.ComponentType<ImageProps>;
|
|
33
|
+
}>;
|
|
@@ -52,7 +52,8 @@ export declare type MessageActionHandlers = {
|
|
|
52
52
|
toggleMuteUser: () => Promise<void>;
|
|
53
53
|
toggleReaction: (reactionType: string) => Promise<void>;
|
|
54
54
|
};
|
|
55
|
-
export declare type MessagePropsWithContext<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = Pick<ChannelContextValue<StreamChatGenerics>, 'channel' | 'disabled' | 'enforceUniqueReaction' | 'members'> & Pick<
|
|
55
|
+
export declare type MessagePropsWithContext<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = Pick<ChannelContextValue<StreamChatGenerics>, 'channel' | 'disabled' | 'enforceUniqueReaction' | 'members'> & Pick<KeyboardContextValue, 'dismissKeyboard'> & Partial<Omit<MessageContextValue<StreamChatGenerics>, 'groupStyles' | 'message'>> & Pick<MessageContextValue<StreamChatGenerics>, 'groupStyles' | 'message'> & Pick<MessagesContextValue<StreamChatGenerics>, 'dismissKeyboardOnMessageTouch' | 'forceAlignMessages' | 'handleBlock' | 'handleCopy' | 'handleDelete' | 'handleEdit' | 'handleFlag' | 'handleMute' | 'handlePinMessage' | 'handleQuotedReply' | 'handleReaction' | 'handleRetry' | 'handleThreadReply' | 'isAttachmentEqual' | 'messageActions' | 'messageContentOrder' | 'MessageSimple' | 'onLongPressMessage' | 'onPressInMessage' | 'onPressMessage' | 'OverlayReactionList' | 'removeMessage' | 'retrySendMessage' | 'selectReaction' | 'setEditingState' | 'setQuotedMessageState' | 'supportedReactions' | 'updateMessage'> & Pick<MessageOverlayContextValue<StreamChatGenerics>, 'setData'> & Pick<OverlayContextValue, 'setOverlay'> & Pick<ThreadContextValue<StreamChatGenerics>, 'openThread'> & Pick<TranslationContextValue, 't'> & {
|
|
56
|
+
chatContext: ChatContextValue<StreamChatGenerics>;
|
|
56
57
|
messagesContext: MessagesContextValue<StreamChatGenerics>;
|
|
57
58
|
/**
|
|
58
59
|
* Whether or not users are able to long press messages.
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { ChatContextValue } from '../../../contexts/chatContext/ChatContext';
|
|
1
2
|
import { MessageContextValue } from '../../../contexts/messageContext/MessageContext';
|
|
2
3
|
import type { DefaultStreamChatGenerics } from '../../../types/types';
|
|
3
4
|
import { AvatarProps } from '../../Avatar/Avatar';
|
|
4
|
-
export declare type MessageAvatarPropsWithContext<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = Pick<MessageContextValue<StreamChatGenerics>, 'alignment' | 'lastGroupMessage' | 'message' | 'showAvatar'> & Partial<Pick<AvatarProps, 'size'>>;
|
|
5
|
+
export declare type MessageAvatarPropsWithContext<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = Pick<MessageContextValue<StreamChatGenerics>, 'alignment' | 'lastGroupMessage' | 'message' | 'showAvatar'> & Pick<ChatContextValue<StreamChatGenerics>, 'ImageComponent'> & Partial<Pick<AvatarProps, 'size'>>;
|
|
5
6
|
export declare type MessageAvatarProps<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = Partial<MessageAvatarPropsWithContext<StreamChatGenerics>>;
|
|
6
7
|
export declare const MessageAvatar: {
|
|
7
8
|
<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(props: Partial<MessageAvatarPropsWithContext<StreamChatGenerics>>): JSX.Element;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { ChatContextValue } from '../../../contexts/chatContext/ChatContext';
|
|
1
2
|
import type { MessageContextValue } from '../../../contexts/messageContext/MessageContext';
|
|
2
3
|
import type { DefaultStreamChatGenerics } from '../../../types/types';
|
|
3
4
|
export declare type MessageRepliesAvatarsProps<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = Pick<MessageContextValue<StreamChatGenerics>, 'alignment' | 'message'>;
|
|
5
|
+
export declare const MessageRepliesAvatarsWithContext: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(props: MessageRepliesAvatarsProps<StreamChatGenerics> & Pick<ChatContextValue<DefaultStreamChatGenerics>, "ImageComponent">) => JSX.Element;
|
|
4
6
|
export declare const MessageRepliesAvatars: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(props: MessageRepliesAvatarsProps<StreamChatGenerics>) => JSX.Element;
|
|
@@ -37,7 +37,7 @@ export declare type ChannelsContextValue<StreamChatGenerics extends DefaultStrea
|
|
|
37
37
|
/**
|
|
38
38
|
* Channels can be either an array of channels or a promise which resolves to an array of channels
|
|
39
39
|
*/
|
|
40
|
-
channels: Channel<StreamChatGenerics>[];
|
|
40
|
+
channels: Channel<StreamChatGenerics>[] | null;
|
|
41
41
|
/**
|
|
42
42
|
* Custom indicator to use when channel list is empty
|
|
43
43
|
*
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { PropsWithChildren } from 'react';
|
|
2
|
+
import type { ImageProps } from 'react-native';
|
|
2
3
|
import type { AppSettingsAPIResponse, Channel, EventHandler, Mute, StreamChat } from 'stream-chat';
|
|
3
4
|
import type { DefaultStreamChatGenerics, UnknownType } from '../../types/types';
|
|
4
5
|
export declare type ChatContextValue<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = {
|
|
@@ -25,6 +26,7 @@ export declare type ChatContextValue<StreamChatGenerics extends DefaultStreamCha
|
|
|
25
26
|
client: StreamChat<StreamChatGenerics>;
|
|
26
27
|
connectionRecovering: boolean;
|
|
27
28
|
enableOfflineSupport: boolean;
|
|
29
|
+
ImageComponent: React.ComponentType<ImageProps>;
|
|
28
30
|
isOnline: boolean;
|
|
29
31
|
mutedUsers: Mute<StreamChatGenerics>[];
|
|
30
32
|
/**
|
|
@@ -55,7 +57,7 @@ export declare type ChatContextValue<StreamChatGenerics extends DefaultStreamCha
|
|
|
55
57
|
};
|
|
56
58
|
export declare const ChatContext: React.Context<ChatContextValue<DefaultStreamChatGenerics>>;
|
|
57
59
|
export declare const ChatProvider: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>({ children, value, }: React.PropsWithChildren<{
|
|
58
|
-
value
|
|
60
|
+
value?: ChatContextValue<StreamChatGenerics> | undefined;
|
|
59
61
|
}>) => JSX.Element;
|
|
60
62
|
export declare const useChatContext: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>() => ChatContextValue<StreamChatGenerics>;
|
|
61
63
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { PropsWithChildren } from 'react';
|
|
2
|
+
import type { ImageProps } from 'react-native';
|
|
2
3
|
import type { Attachment, TranslationLanguages } from 'stream-chat';
|
|
3
4
|
import type { GroupType, MessageType } from '../../components/MessageList/hooks/useMessageList';
|
|
4
5
|
import type { MessageActionListProps } from '../../components/MessageOverlay/MessageActionList';
|
|
@@ -8,15 +9,18 @@ import type { OverlayReactionsProps } from '../../components/MessageOverlay/Over
|
|
|
8
9
|
import type { OverlayReactionsAvatarProps } from '../../components/MessageOverlay/OverlayReactionsAvatar';
|
|
9
10
|
import type { DefaultStreamChatGenerics, UnknownType } from '../../types/types';
|
|
10
11
|
import type { ReactionData } from '../../utils/utils';
|
|
12
|
+
import type { ChatContextValue } from '../chatContext/ChatContext';
|
|
11
13
|
import type { Alignment, MessageContextValue } from '../messageContext/MessageContext';
|
|
12
14
|
import type { MessagesContextValue } from '../messagesContext/MessagesContext';
|
|
13
15
|
import type { OwnCapabilitiesContextValue } from '../ownCapabilitiesContext/OwnCapabilitiesContext';
|
|
14
16
|
export declare type MessageOverlayData<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = {
|
|
15
17
|
alignment?: Alignment;
|
|
18
|
+
chatContext?: ChatContextValue<StreamChatGenerics>;
|
|
16
19
|
clientId?: string;
|
|
17
20
|
files?: Attachment<StreamChatGenerics>[];
|
|
18
21
|
groupStyles?: GroupType[];
|
|
19
22
|
handleReaction?: (reactionType: string) => Promise<void>;
|
|
23
|
+
ImageComponent?: React.ComponentType<ImageProps>;
|
|
20
24
|
images?: Attachment<StreamChatGenerics>[];
|
|
21
25
|
message?: MessageType<StreamChatGenerics>;
|
|
22
26
|
messageActions?: MessageActionType[];
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stream-chat-react-native-core",
|
|
3
3
|
"description": "The official React Native and Expo components for Stream Chat, a service for building chat applications",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.3.0-beta.2",
|
|
5
5
|
"author": {
|
|
6
6
|
"company": "Stream.io Inc",
|
|
7
7
|
"name": "Stream.io Inc"
|
|
@@ -51,9 +51,11 @@ const ChannelPreviewComponent = ({ channel, setActiveChannel }) => (
|
|
|
51
51
|
|
|
52
52
|
const ChannelListComponent = (props) => {
|
|
53
53
|
const { channels, onSelect } = useChannelsContext();
|
|
54
|
+
if (!channels) return null;
|
|
55
|
+
|
|
54
56
|
return (
|
|
55
57
|
<View testID='channel-list'>
|
|
56
|
-
{channels
|
|
58
|
+
{channels?.map((channel) => (
|
|
57
59
|
<ChannelPreviewComponent
|
|
58
60
|
{...props}
|
|
59
61
|
channel={channel}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
Image,
|
|
4
4
|
ImageStyle,
|
|
5
5
|
StyleProp,
|
|
6
6
|
StyleSheet,
|
|
@@ -15,6 +15,8 @@ import type { Attachment } from 'stream-chat';
|
|
|
15
15
|
|
|
16
16
|
import { openUrlSafely } from './utils/openUrlSafely';
|
|
17
17
|
|
|
18
|
+
import { ChatContextValue, useChatContext } from '../../contexts/chatContext/ChatContext';
|
|
19
|
+
|
|
18
20
|
import {
|
|
19
21
|
MessageContextValue,
|
|
20
22
|
useMessageContext,
|
|
@@ -27,6 +29,7 @@ import { useTheme } from '../../contexts/themeContext/ThemeContext';
|
|
|
27
29
|
import { Play } from '../../icons/Play';
|
|
28
30
|
import type { DefaultStreamChatGenerics } from '../../types/types';
|
|
29
31
|
import { makeImageCompatibleUrl } from '../../utils/utils';
|
|
32
|
+
import { ImageBackground } from '../ImageBackground';
|
|
30
33
|
|
|
31
34
|
const styles = StyleSheet.create({
|
|
32
35
|
authorName: { fontSize: 14.5, fontWeight: '600' },
|
|
@@ -82,6 +85,7 @@ const styles = StyleSheet.create({
|
|
|
82
85
|
export type CardPropsWithContext<
|
|
83
86
|
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
84
87
|
> = Attachment<StreamChatGenerics> &
|
|
88
|
+
Pick<ChatContextValue, 'ImageComponent'> &
|
|
85
89
|
Pick<
|
|
86
90
|
MessageContextValue<StreamChatGenerics>,
|
|
87
91
|
'onLongPress' | 'onPress' | 'onPressIn' | 'preventPress'
|
|
@@ -117,6 +121,7 @@ const CardWithContext = <
|
|
|
117
121
|
CardCover,
|
|
118
122
|
CardFooter,
|
|
119
123
|
CardHeader,
|
|
124
|
+
ImageComponent = Image,
|
|
120
125
|
image_url,
|
|
121
126
|
og_scrape_url,
|
|
122
127
|
onLongPress,
|
|
@@ -198,6 +203,7 @@ const CardWithContext = <
|
|
|
198
203
|
{uri && !CardCover && (
|
|
199
204
|
<View>
|
|
200
205
|
<ImageBackground
|
|
206
|
+
ImageComponent={ImageComponent}
|
|
201
207
|
imageStyle={styles.cardCover}
|
|
202
208
|
resizeMode='cover'
|
|
203
209
|
source={{ uri: makeImageCompatibleUrl(uri) }}
|
|
@@ -287,7 +293,8 @@ export type CardProps<
|
|
|
287
293
|
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
288
294
|
> = Attachment<StreamChatGenerics> &
|
|
289
295
|
Partial<
|
|
290
|
-
Pick<
|
|
296
|
+
Pick<ChatContextValue<StreamChatGenerics>, 'ImageComponent'> &
|
|
297
|
+
Pick<MessageContextValue<StreamChatGenerics>, 'onLongPress' | 'onPress' | 'onPressIn'> &
|
|
291
298
|
Pick<
|
|
292
299
|
MessagesContextValue<StreamChatGenerics>,
|
|
293
300
|
'additionalTouchableProps' | 'CardCover' | 'CardFooter' | 'CardHeader'
|
|
@@ -302,6 +309,7 @@ export const Card = <
|
|
|
302
309
|
>(
|
|
303
310
|
props: CardProps<StreamChatGenerics>,
|
|
304
311
|
) => {
|
|
312
|
+
const { ImageComponent } = useChatContext<StreamChatGenerics>();
|
|
305
313
|
const { message, onLongPress, onPress, onPressIn, preventPress } =
|
|
306
314
|
useMessageContext<StreamChatGenerics>();
|
|
307
315
|
const { additionalTouchableProps, CardCover, CardFooter, CardHeader } =
|
|
@@ -316,6 +324,7 @@ export const Card = <
|
|
|
316
324
|
CardFooter,
|
|
317
325
|
CardHeader,
|
|
318
326
|
channelId: message.cid,
|
|
327
|
+
ImageComponent,
|
|
319
328
|
messageId: message.id,
|
|
320
329
|
onLongPress,
|
|
321
330
|
onPress,
|
|
@@ -34,12 +34,6 @@ import { isVideoPackageAvailable } from '../../native';
|
|
|
34
34
|
import type { DefaultStreamChatGenerics } from '../../types/types';
|
|
35
35
|
import { getUrlWithoutParams } from '../../utils/utils';
|
|
36
36
|
|
|
37
|
-
const MemoizedGalleryImage = React.memo(
|
|
38
|
-
GalleryImage,
|
|
39
|
-
(prevProps, nextProps) =>
|
|
40
|
-
getUrlWithoutParams(prevProps.uri) === getUrlWithoutParams(nextProps.uri),
|
|
41
|
-
) as typeof GalleryImage;
|
|
42
|
-
|
|
43
37
|
const styles = StyleSheet.create({
|
|
44
38
|
errorTextSize: { fontSize: 10 },
|
|
45
39
|
galleryContainer: {
|
|
@@ -476,7 +470,7 @@ const GalleryImageThumbnail = <
|
|
|
476
470
|
<ImageLoadingFailedIndicator style={[styles.imageLoadingErrorIndicatorStyle]} />
|
|
477
471
|
) : (
|
|
478
472
|
<>
|
|
479
|
-
<
|
|
473
|
+
<GalleryImage
|
|
480
474
|
onError={(error) => {
|
|
481
475
|
console.warn(error);
|
|
482
476
|
setLoadingImage(false);
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { Image, ImageProps } from 'react-native';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { ChatContextValue, useChatContext } from '../../contexts/chatContext/ChatContext';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
import type { DefaultStreamChatGenerics } from '../../types/types';
|
|
7
|
+
import { getUrlWithoutParams, makeImageCompatibleUrl } from '../../utils/utils';
|
|
8
|
+
|
|
9
|
+
export type GalleryImageWithContextProps<
|
|
10
|
+
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
11
|
+
> = GalleryImageProps & Pick<ChatContextValue<StreamChatGenerics>, 'ImageComponent'>;
|
|
12
|
+
|
|
13
|
+
export const GalleryImageWithContext: React.FC<GalleryImageWithContextProps> = (props) => {
|
|
14
|
+
const { ImageComponent = Image, uri, ...rest } = props;
|
|
12
15
|
|
|
13
16
|
return (
|
|
14
|
-
<
|
|
17
|
+
<ImageComponent
|
|
15
18
|
{...rest}
|
|
16
19
|
accessibilityLabel='Gallery Image'
|
|
17
20
|
source={{
|
|
@@ -20,3 +23,22 @@ export const GalleryImage: React.FC<
|
|
|
20
23
|
/>
|
|
21
24
|
);
|
|
22
25
|
};
|
|
26
|
+
|
|
27
|
+
export const MemoizedGalleryImage = React.memo(
|
|
28
|
+
GalleryImageWithContext,
|
|
29
|
+
(prevProps, nextProps) =>
|
|
30
|
+
getUrlWithoutParams(prevProps.uri) === getUrlWithoutParams(nextProps.uri),
|
|
31
|
+
);
|
|
32
|
+
export type GalleryImageProps = Omit<ImageProps, 'height' | 'source'> & {
|
|
33
|
+
uri: string;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const GalleryImage = <
|
|
37
|
+
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
38
|
+
>(
|
|
39
|
+
props: GalleryImageProps,
|
|
40
|
+
) => {
|
|
41
|
+
const { ImageComponent } = useChatContext<StreamChatGenerics>();
|
|
42
|
+
|
|
43
|
+
return <MemoizedGalleryImage ImageComponent={ImageComponent} {...props} />;
|
|
44
|
+
};
|
|
@@ -3,6 +3,8 @@ import { Image, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
|
|
|
3
3
|
|
|
4
4
|
import type { Attachment } from 'stream-chat';
|
|
5
5
|
|
|
6
|
+
import { ChatContextValue, useChatContext } from '../../contexts/chatContext/ChatContext';
|
|
7
|
+
|
|
6
8
|
import {
|
|
7
9
|
ImageGalleryContextValue,
|
|
8
10
|
useImageGalleryContext,
|
|
@@ -145,6 +147,7 @@ export type GiphyPropsWithContext<
|
|
|
145
147
|
| 'onPressIn'
|
|
146
148
|
| 'preventPress'
|
|
147
149
|
> &
|
|
150
|
+
Pick<ChatContextValue<StreamChatGenerics>, 'ImageComponent'> &
|
|
148
151
|
Pick<
|
|
149
152
|
MessagesContextValue<StreamChatGenerics>,
|
|
150
153
|
| 'giphyVersion'
|
|
@@ -165,6 +168,7 @@ const GiphyWithContext = <
|
|
|
165
168
|
attachment,
|
|
166
169
|
giphyVersion,
|
|
167
170
|
handleAction,
|
|
171
|
+
ImageComponent = Image,
|
|
168
172
|
ImageLoadingFailedIndicator,
|
|
169
173
|
ImageLoadingIndicator,
|
|
170
174
|
isMyMessage,
|
|
@@ -241,7 +245,7 @@ const GiphyWithContext = <
|
|
|
241
245
|
>{`/giphy ${title}`}</Text>
|
|
242
246
|
</View>
|
|
243
247
|
<View style={styles.selectionImageContainer}>
|
|
244
|
-
<
|
|
248
|
+
<ImageComponent
|
|
245
249
|
onError={(error) => {
|
|
246
250
|
console.warn(error);
|
|
247
251
|
setLoadingImage(false);
|
|
@@ -339,7 +343,7 @@ const GiphyWithContext = <
|
|
|
339
343
|
container,
|
|
340
344
|
]}
|
|
341
345
|
>
|
|
342
|
-
<
|
|
346
|
+
<ImageComponent
|
|
343
347
|
accessibilityLabel='Giphy Attachment Image'
|
|
344
348
|
onError={(error) => {
|
|
345
349
|
console.warn(error);
|
|
@@ -446,6 +450,7 @@ export const Giphy = <
|
|
|
446
450
|
) => {
|
|
447
451
|
const { handleAction, isMyMessage, message, onLongPress, onPress, onPressIn, preventPress } =
|
|
448
452
|
useMessageContext<StreamChatGenerics>();
|
|
453
|
+
const { ImageComponent } = useChatContext<StreamChatGenerics>();
|
|
449
454
|
const { additionalTouchableProps, giphyVersion } = useMessagesContext<StreamChatGenerics>();
|
|
450
455
|
const { setMessages, setSelectedMessage } = useImageGalleryContext<StreamChatGenerics>();
|
|
451
456
|
const { setOverlay } = useOverlayContext();
|
|
@@ -464,6 +469,7 @@ export const Giphy = <
|
|
|
464
469
|
additionalTouchableProps,
|
|
465
470
|
giphyVersion,
|
|
466
471
|
handleAction,
|
|
472
|
+
ImageComponent,
|
|
467
473
|
ImageLoadingFailedIndicator,
|
|
468
474
|
ImageLoadingIndicator,
|
|
469
475
|
isMyMessage,
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Image,
|
|
4
|
+
ImageProps,
|
|
5
|
+
ImageStyle,
|
|
6
|
+
StyleProp,
|
|
7
|
+
StyleSheet,
|
|
8
|
+
View,
|
|
9
|
+
ViewStyle,
|
|
10
|
+
} from 'react-native';
|
|
3
11
|
import Svg, { Circle, CircleProps } from 'react-native-svg';
|
|
4
12
|
|
|
5
13
|
import { useTheme } from '../../contexts/themeContext/ThemeContext';
|
|
@@ -38,6 +46,7 @@ export type AvatarProps = {
|
|
|
38
46
|
containerStyle?: StyleProp<ViewStyle>;
|
|
39
47
|
/** image url */
|
|
40
48
|
image?: string;
|
|
49
|
+
ImageComponent?: React.ComponentType<ImageProps>;
|
|
41
50
|
/** name of the picture, used for fallback */
|
|
42
51
|
imageStyle?: StyleProp<ImageStyle>;
|
|
43
52
|
name?: string;
|
|
@@ -53,6 +62,7 @@ export type AvatarProps = {
|
|
|
53
62
|
export const Avatar: React.FC<AvatarProps> = (props) => {
|
|
54
63
|
const {
|
|
55
64
|
containerStyle,
|
|
65
|
+
ImageComponent = Image,
|
|
56
66
|
image: imageProp,
|
|
57
67
|
imageStyle,
|
|
58
68
|
name,
|
|
@@ -95,7 +105,7 @@ export const Avatar: React.FC<AvatarProps> = (props) => {
|
|
|
95
105
|
}}
|
|
96
106
|
/>
|
|
97
107
|
) : (
|
|
98
|
-
<
|
|
108
|
+
<ImageComponent
|
|
99
109
|
accessibilityLabel={testID || 'Avatar Image'}
|
|
100
110
|
onError={() => setLoadingImageError(true)}
|
|
101
111
|
source={{
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Image, StyleProp, StyleSheet, View, ViewStyle } from 'react-native';
|
|
2
|
+
import { Image, ImageProps, StyleProp, StyleSheet, View, ViewStyle } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import { useTheme } from '../../contexts/themeContext/ThemeContext';
|
|
5
5
|
import { useLoadingImage } from '../../hooks/useLoadingImage';
|
|
6
6
|
import { getResizedImageUrl } from '../../utils/getResizedImageUrl';
|
|
7
|
-
|
|
8
7
|
const randomImageBaseUrl = 'https://getstream.io/random_png/';
|
|
9
8
|
const randomSvgBaseUrl = 'https://getstream.io/random_svg/';
|
|
10
9
|
const streamCDN = 'stream-io-cdn.com';
|
|
@@ -27,6 +26,7 @@ export type GroupAvatarProps = {
|
|
|
27
26
|
/** total size in pixels */
|
|
28
27
|
size: number;
|
|
29
28
|
containerStyle?: StyleProp<ViewStyle>;
|
|
29
|
+
ImageComponent?: React.ComponentType<ImageProps>;
|
|
30
30
|
/** image urls */
|
|
31
31
|
images?: string[];
|
|
32
32
|
/** name of the users, used for fallback */
|
|
@@ -38,7 +38,7 @@ export type GroupAvatarProps = {
|
|
|
38
38
|
* GroupAvatar - A round group of avatar images with fallbacks to users' initials
|
|
39
39
|
*/
|
|
40
40
|
export const GroupAvatar: React.FC<GroupAvatarProps> = (props) => {
|
|
41
|
-
const { containerStyle, images, names, size, testID } = props;
|
|
41
|
+
const { containerStyle, ImageComponent = Image, images, names, size, testID } = props;
|
|
42
42
|
const {
|
|
43
43
|
theme: {
|
|
44
44
|
groupAvatar: { container, image },
|
|
@@ -136,7 +136,7 @@ export const GroupAvatar: React.FC<GroupAvatarProps> = (props) => {
|
|
|
136
136
|
]}
|
|
137
137
|
>
|
|
138
138
|
{column.map(({ height, name, url, width }, rowIndex) => (
|
|
139
|
-
<
|
|
139
|
+
<ImageComponent
|
|
140
140
|
accessibilityLabel={testID || 'Avatar Image'}
|
|
141
141
|
key={`avatar-${url}-${rowIndex}`}
|
|
142
142
|
onError={() => setLoadingImageError(true)}
|