stream-chat-react-native-core 5.2.0 → 5.3.0-beta.3

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.
Files changed (130) hide show
  1. package/lib/commonjs/components/Attachment/Card.js +29 -18
  2. package/lib/commonjs/components/Attachment/Card.js.map +1 -1
  3. package/lib/commonjs/components/Attachment/Gallery.js +16 -20
  4. package/lib/commonjs/components/Attachment/Gallery.js.map +1 -1
  5. package/lib/commonjs/components/Attachment/GalleryImage.js +34 -6
  6. package/lib/commonjs/components/Attachment/GalleryImage.js.map +1 -1
  7. package/lib/commonjs/components/Attachment/Giphy.js +37 -29
  8. package/lib/commonjs/components/Attachment/Giphy.js.map +1 -1
  9. package/lib/commonjs/components/Avatar/Avatar.js +10 -8
  10. package/lib/commonjs/components/Avatar/Avatar.js.map +1 -1
  11. package/lib/commonjs/components/Avatar/GroupAvatar.js +3 -1
  12. package/lib/commonjs/components/Avatar/GroupAvatar.js.map +1 -1
  13. package/lib/commonjs/components/ChannelList/ChannelList.js +4 -4
  14. package/lib/commonjs/components/ChannelList/ChannelList.js.map +1 -1
  15. package/lib/commonjs/components/ChannelList/ChannelListMessenger.js +4 -4
  16. package/lib/commonjs/components/ChannelList/ChannelListMessenger.js.map +1 -1
  17. package/lib/commonjs/components/ChannelList/hooks/useCreateChannelsContext.js +1 -1
  18. package/lib/commonjs/components/ChannelList/hooks/useCreateChannelsContext.js.map +1 -1
  19. package/lib/commonjs/components/ChannelList/hooks/usePaginatedChannels.js +6 -7
  20. package/lib/commonjs/components/ChannelList/hooks/usePaginatedChannels.js.map +1 -1
  21. package/lib/commonjs/components/ChannelPreview/ChannelAvatar.js +30 -6
  22. package/lib/commonjs/components/ChannelPreview/ChannelAvatar.js.map +1 -1
  23. package/lib/commonjs/components/Chat/Chat.js +8 -5
  24. package/lib/commonjs/components/Chat/Chat.js.map +1 -1
  25. package/lib/commonjs/components/Chat/hooks/useCreateChatContext.js +2 -0
  26. package/lib/commonjs/components/Chat/hooks/useCreateChatContext.js.map +1 -1
  27. package/lib/commonjs/components/ImageBackground.js +64 -0
  28. package/lib/commonjs/components/ImageBackground.js.map +1 -0
  29. package/lib/commonjs/components/Message/Message.js +15 -16
  30. package/lib/commonjs/components/Message/Message.js.map +1 -1
  31. package/lib/commonjs/components/Message/MessageSimple/MessageAvatar.js +12 -4
  32. package/lib/commonjs/components/Message/MessageSimple/MessageAvatar.js.map +1 -1
  33. package/lib/commonjs/components/Message/MessageSimple/MessageRepliesAvatars.js +26 -5
  34. package/lib/commonjs/components/Message/MessageSimple/MessageRepliesAvatars.js.map +1 -1
  35. package/lib/commonjs/components/MessageOverlay/MessageOverlay.js +58 -47
  36. package/lib/commonjs/components/MessageOverlay/MessageOverlay.js.map +1 -1
  37. package/lib/commonjs/contexts/channelsContext/ChannelsContext.js.map +1 -1
  38. package/lib/commonjs/contexts/chatContext/ChatContext.js +2 -2
  39. package/lib/commonjs/contexts/chatContext/ChatContext.js.map +1 -1
  40. package/lib/commonjs/contexts/messageOverlayContext/MessageOverlayContext.js +2 -2
  41. package/lib/commonjs/contexts/messageOverlayContext/MessageOverlayContext.js.map +1 -1
  42. package/lib/commonjs/native.js.map +1 -1
  43. package/lib/commonjs/version.json +1 -1
  44. package/lib/module/components/Attachment/Card.js +29 -18
  45. package/lib/module/components/Attachment/Card.js.map +1 -1
  46. package/lib/module/components/Attachment/Gallery.js +16 -20
  47. package/lib/module/components/Attachment/Gallery.js.map +1 -1
  48. package/lib/module/components/Attachment/GalleryImage.js +34 -6
  49. package/lib/module/components/Attachment/GalleryImage.js.map +1 -1
  50. package/lib/module/components/Attachment/Giphy.js +37 -29
  51. package/lib/module/components/Attachment/Giphy.js.map +1 -1
  52. package/lib/module/components/Avatar/Avatar.js +10 -8
  53. package/lib/module/components/Avatar/Avatar.js.map +1 -1
  54. package/lib/module/components/Avatar/GroupAvatar.js +3 -1
  55. package/lib/module/components/Avatar/GroupAvatar.js.map +1 -1
  56. package/lib/module/components/ChannelList/ChannelList.js +4 -4
  57. package/lib/module/components/ChannelList/ChannelList.js.map +1 -1
  58. package/lib/module/components/ChannelList/ChannelListMessenger.js +4 -4
  59. package/lib/module/components/ChannelList/ChannelListMessenger.js.map +1 -1
  60. package/lib/module/components/ChannelList/hooks/useCreateChannelsContext.js +1 -1
  61. package/lib/module/components/ChannelList/hooks/useCreateChannelsContext.js.map +1 -1
  62. package/lib/module/components/ChannelList/hooks/usePaginatedChannels.js +6 -7
  63. package/lib/module/components/ChannelList/hooks/usePaginatedChannels.js.map +1 -1
  64. package/lib/module/components/ChannelPreview/ChannelAvatar.js +30 -6
  65. package/lib/module/components/ChannelPreview/ChannelAvatar.js.map +1 -1
  66. package/lib/module/components/Chat/Chat.js +8 -5
  67. package/lib/module/components/Chat/Chat.js.map +1 -1
  68. package/lib/module/components/Chat/hooks/useCreateChatContext.js +2 -0
  69. package/lib/module/components/Chat/hooks/useCreateChatContext.js.map +1 -1
  70. package/lib/module/components/ImageBackground.js +64 -0
  71. package/lib/module/components/ImageBackground.js.map +1 -0
  72. package/lib/module/components/Message/Message.js +15 -16
  73. package/lib/module/components/Message/Message.js.map +1 -1
  74. package/lib/module/components/Message/MessageSimple/MessageAvatar.js +12 -4
  75. package/lib/module/components/Message/MessageSimple/MessageAvatar.js.map +1 -1
  76. package/lib/module/components/Message/MessageSimple/MessageRepliesAvatars.js +26 -5
  77. package/lib/module/components/Message/MessageSimple/MessageRepliesAvatars.js.map +1 -1
  78. package/lib/module/components/MessageOverlay/MessageOverlay.js +58 -47
  79. package/lib/module/components/MessageOverlay/MessageOverlay.js.map +1 -1
  80. package/lib/module/contexts/channelsContext/ChannelsContext.js.map +1 -1
  81. package/lib/module/contexts/chatContext/ChatContext.js +2 -2
  82. package/lib/module/contexts/chatContext/ChatContext.js.map +1 -1
  83. package/lib/module/contexts/messageOverlayContext/MessageOverlayContext.js +2 -2
  84. package/lib/module/contexts/messageOverlayContext/MessageOverlayContext.js.map +1 -1
  85. package/lib/module/native.js.map +1 -1
  86. package/lib/module/version.json +1 -1
  87. package/lib/typescript/components/Attachment/Card.d.ts +3 -2
  88. package/lib/typescript/components/Attachment/GalleryImage.d.ts +8 -2
  89. package/lib/typescript/components/Attachment/Giphy.d.ts +2 -1
  90. package/lib/typescript/components/Avatar/Avatar.d.ts +2 -1
  91. package/lib/typescript/components/Avatar/GroupAvatar.d.ts +2 -1
  92. package/lib/typescript/components/ChannelList/hooks/usePaginatedChannels.d.ts +1 -1
  93. package/lib/typescript/components/ChannelPreview/ChannelAvatar.d.ts +2 -0
  94. package/lib/typescript/components/Chat/Chat.d.ts +1 -1
  95. package/lib/typescript/components/Chat/hooks/useCreateChatContext.d.ts +1 -1
  96. package/lib/typescript/components/ImageBackground.d.ts +33 -0
  97. package/lib/typescript/components/Message/Message.d.ts +2 -1
  98. package/lib/typescript/components/Message/MessageSimple/MessageAvatar.d.ts +2 -1
  99. package/lib/typescript/components/Message/MessageSimple/MessageRepliesAvatars.d.ts +2 -0
  100. package/lib/typescript/contexts/channelsContext/ChannelsContext.d.ts +1 -1
  101. package/lib/typescript/contexts/chatContext/ChatContext.d.ts +3 -1
  102. package/lib/typescript/contexts/messageOverlayContext/MessageOverlayContext.d.ts +4 -0
  103. package/lib/typescript/native.d.ts +2 -2
  104. package/package.json +1 -1
  105. package/src/__tests__/offline-feature.test.js +3 -1
  106. package/src/components/Attachment/Card.tsx +11 -2
  107. package/src/components/Attachment/Gallery.tsx +1 -7
  108. package/src/components/Attachment/GalleryImage.tsx +31 -9
  109. package/src/components/Attachment/Giphy.tsx +8 -2
  110. package/src/components/Avatar/Avatar.tsx +12 -2
  111. package/src/components/Avatar/GroupAvatar.tsx +4 -4
  112. package/src/components/ChannelList/ChannelList.tsx +3 -2
  113. package/src/components/ChannelList/ChannelListMessenger.tsx +3 -3
  114. package/src/components/ChannelList/__tests__/ChannelList.test.js +1 -1
  115. package/src/components/ChannelList/hooks/listeners/__tests__/useChannelUpdated.test.tsx +2 -1
  116. package/src/components/ChannelList/hooks/useCreateChannelsContext.ts +1 -1
  117. package/src/components/ChannelList/hooks/usePaginatedChannels.ts +12 -11
  118. package/src/components/ChannelPreview/ChannelAvatar.tsx +23 -4
  119. package/src/components/Chat/Chat.tsx +98 -95
  120. package/src/components/Chat/hooks/useCreateChatContext.ts +2 -0
  121. package/src/components/ImageBackground.tsx +77 -0
  122. package/src/components/Message/Message.tsx +8 -8
  123. package/src/components/Message/MessageSimple/MessageAvatar.tsx +6 -2
  124. package/src/components/Message/MessageSimple/MessageRepliesAvatars.tsx +15 -3
  125. package/src/components/MessageOverlay/MessageOverlay.tsx +210 -205
  126. package/src/contexts/channelsContext/ChannelsContext.tsx +1 -1
  127. package/src/contexts/chatContext/ChatContext.tsx +3 -1
  128. package/src/contexts/messageOverlayContext/MessageOverlayContext.tsx +8 -1
  129. package/src/native.ts +2 -2
  130. package/src/version.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["ChatContext.tsx"],"names":["ChatContext","React","createContext","DEFAULT_BASE_CONTEXT_VALUE","ChatProvider","children","value","useChatContext","contextValue","Error","withChatContext","Component","WithChatContextComponent","props","chatContext","displayName"],"mappings":";;;;;;;;;;;AAAA;;AAKA;;AAEA;;AACA;;;;;;;;;AAyDO,IAAMA,WAAW,GAAGC,kBAAMC,aAAN,CAAoBC,mDAApB,CAApB;;;;AAEA,IAAMC,YAAY,GAAG,SAAfA,YAAe;AAAA,MAG1BC,QAH0B,QAG1BA,QAH0B;AAAA,MAI1BC,KAJ0B,QAI1BA,KAJ0B;AAAA,SAQ1B,gCAAC,WAAD,CAAa,QAAb;AAAsB,IAAA,KAAK,EAAEA,KAA7B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACGD,QADH,CAR0B;AAAA,CAArB;;;;AAaA,IAAME,cAAc,GAAG,SAAjBA,cAAiB,GAEvB;AACL,MAAMC,YAAY,GAAG,uBAAWR,WAAX,CAArB;;AAEA,MAAIQ,YAAY,KAAKL,mDAAjB,IAA+C,CAAC,2CAApD,EAAyE;AACvE,UAAM,IAAIM,KAAJ,+MAAN;AAGD;;AAED,SAAOD,YAAP;AACD,CAZM;;;;AAmBA,IAAME,eAAe,GAAG,SAAlBA,eAAkB,CAI7BC,SAJ6B,EAKqC;AAClE,MAAMC,wBAAwB,GAAG,SAA3BA,wBAA2B,CAACC,KAAD,EAAgE;AAC/F,QAAMC,WAAW,GAAGP,cAAc,EAAlC;AAEA,WAAO,gCAAC,SAAD,gCAAgBM,KAAhB,EAAiCC,WAAjC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,OAAP;AACD,GAJD;;AAKAF,EAAAA,wBAAwB,CAACG,WAAzB,uBAAyD,oCAAeJ,SAAf,CAAzD;AACA,SAAOC,wBAAP;AACD,CAbM","sourcesContent":["import React, { PropsWithChildren, useContext } from 'react';\n\nimport type { AppSettingsAPIResponse, Channel, EventHandler, Mute, StreamChat } from 'stream-chat';\n\nimport type { DefaultStreamChatGenerics, UnknownType } from '../../types/types';\nimport { DEFAULT_BASE_CONTEXT_VALUE } from '../utils/defaultBaseContextValue';\n\nimport { getDisplayName } from '../utils/getDisplayName';\nimport { isTestEnvironment } from '../utils/isTestEnvironment';\n\nexport type ChatContextValue<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = {\n /**\n * Object of application settings returned from Stream.\n * */\n appSettings: AppSettingsAPIResponse<StreamChatGenerics> | null;\n /**\n * The StreamChat client object\n *\n * ```\n * import { StreamChat } from 'stream-chat';\n * import { Chat } from 'stream-chat-react-native';\n *\n * const client = StreamChat.getInstance('api_key);\n * await client.connectUser('user_id', 'userToken');\n *\n * <Chat client={client}>\n * </Chat>\n * ```\n *\n * @overrideType StreamChat\n * */\n client: StreamChat<StreamChatGenerics>;\n connectionRecovering: boolean;\n enableOfflineSupport: boolean;\n isOnline: boolean;\n mutedUsers: Mute<StreamChatGenerics>[];\n /**\n * @param newChannel Channel to set as active.\n *\n * @overrideType Function\n */\n setActiveChannel: (newChannel?: Channel<StreamChatGenerics>) => void;\n subscribeConnectionRecoveredCallback: (callback: EventHandler<StreamChatGenerics>) => () => void;\n /**\n * Instance of channel object from stream-chat package.\n *\n * Please check the docs around how to create or query channel - https://getstream.io/chat/docs/javascript/creating_channels/?language=javascript\n *\n * ```\n * import { StreamChat, Channel } from 'stream-chat';\n * import { Chat, Channel} from 'stream-chat-react-native';\n *\n * const client = StreamChat.getInstance('api_key');\n * await client.connectUser('user_id', 'user_token');\n * const channel = client.channel('messaging', 'channel_id');\n * await channel.watch();\n * ```\n *\n * @overrideType Channel\n */\n channel?: Channel<StreamChatGenerics>;\n};\n\nexport const ChatContext = React.createContext(DEFAULT_BASE_CONTEXT_VALUE as ChatContextValue);\n\nexport const ChatProvider = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>({\n children,\n value,\n}: PropsWithChildren<{\n value: ChatContextValue<StreamChatGenerics>;\n}>) => (\n <ChatContext.Provider value={value as unknown as ChatContextValue}>\n {children}\n </ChatContext.Provider>\n);\n\nexport const useChatContext = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>() => {\n const contextValue = useContext(ChatContext) as unknown as ChatContextValue<StreamChatGenerics>;\n\n if (contextValue === DEFAULT_BASE_CONTEXT_VALUE && !isTestEnvironment()) {\n throw new Error(\n `The useChatContext hook was called outside the ChatContext Provider. Make sure you have configured Chat component correctly - https://getstream.io/chat/docs/sdk/reactnative/basics/hello_stream_chat/#chat`,\n );\n }\n\n return contextValue;\n};\n\n/**\n * Typescript currently does not support partial inference so if ChatContext\n * typing is desired while using the HOC withChatContext the Props for the\n * wrapped component must be provided as the first generic.\n */\nexport const withChatContext = <\n P extends UnknownType,\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n Component: React.ComponentType<P>,\n): React.FC<Omit<P, keyof ChatContextValue<StreamChatGenerics>>> => {\n const WithChatContextComponent = (props: Omit<P, keyof ChatContextValue<StreamChatGenerics>>) => {\n const chatContext = useChatContext<StreamChatGenerics>();\n\n return <Component {...(props as P)} {...chatContext} />;\n };\n WithChatContextComponent.displayName = `WithChatContext${getDisplayName(Component)}`;\n return WithChatContextComponent;\n};\n"]}
1
+ {"version":3,"sources":["ChatContext.tsx"],"names":["ChatContext","React","createContext","DEFAULT_BASE_CONTEXT_VALUE","ChatProvider","children","value","useChatContext","contextValue","Error","withChatContext","Component","WithChatContextComponent","props","chatContext","displayName"],"mappings":";;;;;;;;;;;AAAA;;AAMA;;AAEA;;AACA;;;;;;;;;AA0DO,IAAMA,WAAW,GAAGC,kBAAMC,aAAN,CAAoBC,mDAApB,CAApB;;;;AAEA,IAAMC,YAAY,GAAG,SAAfA,YAAe;AAAA,MAG1BC,QAH0B,QAG1BA,QAH0B;AAAA,MAI1BC,KAJ0B,QAI1BA,KAJ0B;AAAA,SAQ1B,gCAAC,WAAD,CAAa,QAAb;AAAsB,IAAA,KAAK,EAAEA,KAA7B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACGD,QADH,CAR0B;AAAA,CAArB;;;;AAaA,IAAME,cAAc,GAAG,SAAjBA,cAAiB,GAEvB;AACL,MAAMC,YAAY,GAAG,uBAAWR,WAAX,CAArB;;AAEA,MAAIQ,YAAY,KAAKL,mDAAjB,IAA+C,CAAC,2CAApD,EAAyE;AACvE,UAAM,IAAIM,KAAJ,+MAAN;AAGD;;AAED,SAAOD,YAAP;AACD,CAZM;;;;AAmBA,IAAME,eAAe,GAAG,SAAlBA,eAAkB,CAI7BC,SAJ6B,EAKqC;AAClE,MAAMC,wBAAwB,GAAG,SAA3BA,wBAA2B,CAACC,KAAD,EAAgE;AAC/F,QAAMC,WAAW,GAAGP,cAAc,EAAlC;AAEA,WAAO,gCAAC,SAAD,gCAAgBM,KAAhB,EAAiCC,WAAjC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,OAAP;AACD,GAJD;;AAKAF,EAAAA,wBAAwB,CAACG,WAAzB,uBAAyD,oCAAeJ,SAAf,CAAzD;AACA,SAAOC,wBAAP;AACD,CAbM","sourcesContent":["import React, { PropsWithChildren, useContext } from 'react';\nimport type { ImageProps } from 'react-native';\n\nimport type { AppSettingsAPIResponse, Channel, EventHandler, Mute, StreamChat } from 'stream-chat';\n\nimport type { DefaultStreamChatGenerics, UnknownType } from '../../types/types';\nimport { DEFAULT_BASE_CONTEXT_VALUE } from '../utils/defaultBaseContextValue';\n\nimport { getDisplayName } from '../utils/getDisplayName';\nimport { isTestEnvironment } from '../utils/isTestEnvironment';\n\nexport type ChatContextValue<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = {\n /**\n * Object of application settings returned from Stream.\n * */\n appSettings: AppSettingsAPIResponse<StreamChatGenerics> | null;\n /**\n * The StreamChat client object\n *\n * ```\n * import { StreamChat } from 'stream-chat';\n * import { Chat } from 'stream-chat-react-native';\n *\n * const client = StreamChat.getInstance('api_key);\n * await client.connectUser('user_id', 'userToken');\n *\n * <Chat client={client}>\n * </Chat>\n * ```\n *\n * @overrideType StreamChat\n * */\n client: StreamChat<StreamChatGenerics>;\n connectionRecovering: boolean;\n enableOfflineSupport: boolean;\n ImageComponent: React.ComponentType<ImageProps>;\n isOnline: boolean;\n mutedUsers: Mute<StreamChatGenerics>[];\n /**\n * @param newChannel Channel to set as active.\n *\n * @overrideType Function\n */\n setActiveChannel: (newChannel?: Channel<StreamChatGenerics>) => void;\n subscribeConnectionRecoveredCallback: (callback: EventHandler<StreamChatGenerics>) => () => void;\n /**\n * Instance of channel object from stream-chat package.\n *\n * Please check the docs around how to create or query channel - https://getstream.io/chat/docs/javascript/creating_channels/?language=javascript\n *\n * ```\n * import { StreamChat, Channel } from 'stream-chat';\n * import { Chat, Channel} from 'stream-chat-react-native';\n *\n * const client = StreamChat.getInstance('api_key');\n * await client.connectUser('user_id', 'user_token');\n * const channel = client.channel('messaging', 'channel_id');\n * await channel.watch();\n * ```\n *\n * @overrideType Channel\n */\n channel?: Channel<StreamChatGenerics>;\n};\n\nexport const ChatContext = React.createContext(DEFAULT_BASE_CONTEXT_VALUE as ChatContextValue);\n\nexport const ChatProvider = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>({\n children,\n value,\n}: PropsWithChildren<{\n value?: ChatContextValue<StreamChatGenerics>;\n}>) => (\n <ChatContext.Provider value={value as unknown as ChatContextValue}>\n {children}\n </ChatContext.Provider>\n);\n\nexport const useChatContext = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>() => {\n const contextValue = useContext(ChatContext) as unknown as ChatContextValue<StreamChatGenerics>;\n\n if (contextValue === DEFAULT_BASE_CONTEXT_VALUE && !isTestEnvironment()) {\n throw new Error(\n `The useChatContext hook was called outside the ChatContext Provider. Make sure you have configured Chat component correctly - https://getstream.io/chat/docs/sdk/reactnative/basics/hello_stream_chat/#chat`,\n );\n }\n\n return contextValue;\n};\n\n/**\n * Typescript currently does not support partial inference so if ChatContext\n * typing is desired while using the HOC withChatContext the Props for the\n * wrapped component must be provided as the first generic.\n */\nexport const withChatContext = <\n P extends UnknownType,\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n Component: React.ComponentType<P>,\n): React.FC<Omit<P, keyof ChatContextValue<StreamChatGenerics>>> => {\n const WithChatContextComponent = (props: Omit<P, keyof ChatContextValue<StreamChatGenerics>>) => {\n const chatContext = useChatContext<StreamChatGenerics>();\n\n return <Component {...(props as P)} {...chatContext} />;\n };\n WithChatContextComponent.displayName = `WithChatContext${getDisplayName(Component)}`;\n return WithChatContextComponent;\n};\n"]}
@@ -39,7 +39,7 @@ var MessageOverlayProvider = function MessageOverlayProvider(_ref) {
39
39
  __self: _this,
40
40
  __source: {
41
41
  fileName: _jsxFileName,
42
- lineNumber: 92,
42
+ lineNumber: 97,
43
43
  columnNumber: 5
44
44
  }
45
45
  }, children);
@@ -66,7 +66,7 @@ var withMessageOverlayContext = function withMessageOverlayContext(Component) {
66
66
  __self: _this,
67
67
  __source: {
68
68
  fileName: _jsxFileName,
69
- lineNumber: 130,
69
+ lineNumber: 137,
70
70
  columnNumber: 12
71
71
  }
72
72
  }));
@@ -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;;AAIA;;AAgBA;;AAEA;;AACA;;;;;;;;;AAsDO,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;AAAgC,IAAA,KAAK,EAAEC,qBAAvC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACGF,QADH,CADF;AAKD,CAdM;;;;AAgBA,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 { 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 { 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 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 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 value={messageOverlayContext as MessageOverlayContextValue}>\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"]}
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"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["native.ts"],"names":["fail","Error","compressImage","deleteFile","getLocalAssetUri","getPhotos","FlatList","DefaultFlatList","NetInfo","addEventListener","fetch","pickDocument","saveFile","shareImage","takePhoto","triggerHaptic","SDK","Sound","Video","registerNativeHandlers","handlers","isVideoPackageAvailable","isAudioPackageAvailable","Player","initializeSound"],"mappings":";;;;;AACA;;AAMA,IAAMA,IAAI,GAAG,SAAPA,IAAO,GAAM;AACjB,QAAMC,KAAK,CACT,mGADS,CAAX;AAGD,CAJD;;AAiBO,IAAIC,aAA4B,GAAGF,IAAnC;;AAGA,IAAIG,UAAsB,GAAGH,IAA7B;;AAGA,IAAII,gBAAkC,GAAGJ,IAAzC;;AASA,IAAIK,SAAoB,GAAGL,IAA3B;;AAOA,IAAIM,QAAQ,GAAGC,qBAAf;;AAEA,IAAIC,OAAgB,GAAG;AAC5BC,EAAAA,gBAAgB,EAAET,IADU;AAE5BU,EAAAA,KAAK,EAAEV;AAFqB,CAAvB;;AAWA,IAAIW,YAA0B,GAAGX,IAAjC;;AAOA,IAAIY,QAAkB,GAAGZ,IAAzB;;AAOA,IAAIa,UAAsB,GAAGb,IAA7B;;AASA,IAAIc,SAAoB,GAAGd,IAA3B;;AAWA,IAAIe,aAA4B,GAAGf,IAAnC;;AAwBA,IAAIgB,GAAJ;;AA8CA,IAAIC,KAAJ;;AA2CA,IAAIC,KAAJ;;;AAmBA,IAAMC,sBAAsB,GAAG,SAAzBA,sBAAyB,CAACC,QAAD,EAAwB;AAC5D,MAAIA,QAAQ,CAAClB,aAAb,EAA4B;AAC1B,4BAAAA,aAAa,GAAGkB,QAAQ,CAAClB,aAAzB;AACD;;AAED,MAAIkB,QAAQ,CAACjB,UAAb,EAAyB;AACvB,yBAAAA,UAAU,GAAGiB,QAAQ,CAACjB,UAAtB;AACD;;AAED,MAAIiB,QAAQ,CAACd,QAAb,EAAuB;AACrB,uBAAAA,QAAQ,GAAGc,QAAQ,CAACd,QAApB;AACD;;AACD,MAAIc,QAAQ,CAACZ,OAAb,EAAsB;AACpB,sBAAAA,OAAO,GAAGY,QAAQ,CAACZ,OAAnB;AACD;;AAED,MAAIY,QAAQ,CAAChB,gBAAb,EAA+B;AAC7B,+BAAAA,gBAAgB,GAAGgB,QAAQ,CAAChB,gBAA5B;AACD;;AAED,MAAIgB,QAAQ,CAACf,SAAb,EAAwB;AACtB,wBAAAA,SAAS,GAAGe,QAAQ,CAACf,SAArB;AACD;;AAED,MAAIe,QAAQ,CAACT,YAAb,EAA2B;AACzB,2BAAAA,YAAY,GAAGS,QAAQ,CAACT,YAAxB;AACD;;AAED,MAAIS,QAAQ,CAACR,QAAb,EAAuB;AACrB,uBAAAA,QAAQ,GAAGQ,QAAQ,CAACR,QAApB;AACD;;AAED,MAAIQ,QAAQ,CAACJ,GAAb,EAAkB;AAChB,kBAAAA,GAAG,GAAGI,QAAQ,CAACJ,GAAf;AACD;;AAED,MAAII,QAAQ,CAACP,UAAb,EAAyB;AACvB,yBAAAA,UAAU,GAAGO,QAAQ,CAACP,UAAtB;AACD;;AAED,MAAIO,QAAQ,CAACH,KAAb,EAAoB;AAClB,oBAAAA,KAAK,GAAGG,QAAQ,CAACH,KAAjB;AACD;;AAED,MAAIG,QAAQ,CAACN,SAAb,EAAwB;AACtB,wBAAAA,SAAS,GAAGM,QAAQ,CAACN,SAArB;AACD;;AAED,MAAIM,QAAQ,CAACL,aAAb,EAA4B;AAC1B,4BAAAA,aAAa,GAAGK,QAAQ,CAACL,aAAzB;AACD;;AAED,MAAIK,QAAQ,CAACF,KAAb,EAAoB;AAClB,oBAAAA,KAAK,GAAGE,QAAQ,CAACF,KAAjB;AACD;AACF,CAvDM;;;;AAyDA,IAAMG,uBAAuB,GAAG,SAA1BA,uBAA0B;AAAA,SAAM,CAAC,CAACH,KAAR;AAAA,CAAhC;;;;AACA,IAAMI,uBAAuB,GAAG,SAA1BA,uBAA0B;AAAA,SAAM,CAAC,CAACL,KAAK,CAACM,MAAR,IAAkB,CAAC,CAACN,KAAK,CAACO,eAAhC;AAAA,CAAhC","sourcesContent":["import type React from 'react';\nimport { FlatList as DefaultFlatList, StyleProp, ViewStyle } from 'react-native';\n\nimport type { NetInfoSubscription } from '@react-native-community/netinfo';\n\nimport type { Asset, File } from './types/types';\n\nconst fail = () => {\n throw Error(\n 'Native handler was not registered, you should import stream-chat-expo or stream-chat-react-native',\n );\n};\n\ntype CompressImage = ({\n compressImageQuality,\n height,\n uri,\n width,\n}: {\n compressImageQuality: number;\n height: number;\n uri: string;\n width: number;\n}) => Promise<string> | never;\nexport let compressImage: CompressImage = fail;\n\ntype DeleteFile = ({ uri }: { uri: string }) => Promise<boolean> | never;\nexport let deleteFile: DeleteFile = fail;\n\ntype GetLocalAssetUri = (uriOrAssetId: string) => never;\nexport let getLocalAssetUri: GetLocalAssetUri = fail;\n\ntype GetPhotos = ({ after, first }: { first: number; after?: string }) =>\n | Promise<{\n assets: Array<Omit<Asset, 'source'> & { source: 'picker' }>;\n endCursor: string;\n hasNextPage: boolean;\n }>\n | never;\nexport let getPhotos: GetPhotos = fail;\n\ntype NetInfo = {\n addEventListener: (listener: (isConnected: boolean) => void) => NetInfoSubscription | never;\n fetch: (requestedInterface?: string | undefined) => Promise<boolean> | never;\n};\n\nexport let FlatList = DefaultFlatList;\n\nexport let NetInfo: NetInfo = {\n addEventListener: fail,\n fetch: fail,\n};\n\ntype PickDocument = ({ maxNumberOfFiles }: { maxNumberOfFiles?: number }) =>\n | Promise<{\n cancelled: boolean;\n docs?: File[];\n }>\n | never;\nexport let pickDocument: PickDocument = fail;\n\ntype SaveFileOptions = {\n fileName: string;\n fromUrl: string;\n};\ntype SaveFile = (options: SaveFileOptions) => Promise<string> | never;\nexport let saveFile: SaveFile = fail;\n\ntype ShareOptions = {\n type?: string;\n url?: string;\n};\ntype ShareImage = (options: ShareOptions) => Promise<boolean> | never;\nexport let shareImage: ShareImage = fail;\n\ntype Photo =\n | (Omit<Asset, 'source'> & {\n cancelled: false;\n source: 'camera';\n })\n | { cancelled: true };\ntype TakePhoto = (options: { compressImageQuality?: number }) => Promise<Photo> | never;\nexport let takePhoto: TakePhoto = fail;\n\ntype HapticFeedbackMethod =\n | 'impactHeavy'\n | 'impactLight'\n | 'impactMedium'\n | 'notificationError'\n | 'notificationSuccess'\n | 'notificationWarning'\n | 'selection';\ntype TriggerHaptic = (method: HapticFeedbackMethod) => void | never;\nexport let triggerHaptic: TriggerHaptic = fail;\n\nexport type PlaybackStatus = {\n didJustFinish: boolean;\n durationMillis: number;\n error: string;\n isBuffering: boolean;\n isLoaded: boolean;\n isLooping: boolean;\n isPlaying: boolean;\n positionMillis: number;\n};\n\nexport type AVPlaybackStatusToSet = {\n isLooping: boolean;\n isMuted: boolean;\n positionMillis: number;\n progressUpdateIntervalMillis: number;\n rate: number;\n shouldCorrectPitch: boolean;\n shouldPlay: boolean;\n volume: number;\n};\n\nexport let SDK: string;\n\nexport type SoundOptions = {\n basePathOrCallback?: string;\n callback?: () => void;\n filenameOrFile?: string;\n initialStatus?: Partial<AVPlaybackStatusToSet>;\n onPlaybackStatusUpdate?: (playbackStatus: PlaybackStatus) => void;\n source?: { uri: string };\n};\n\nexport type SoundReturnType = {\n paused: boolean;\n testID: string;\n getDuration?: () => number;\n isPlaying?: () => boolean;\n onBuffer?: (props: { isBuffering: boolean }) => void;\n onEnd?: () => void;\n onLoad?: (payload: VideoPayloadData) => void;\n onLoadStart?: () => void;\n onPlaybackStatusUpdate?: (playbackStatus: PlaybackStatus) => void;\n onProgress?: (data: VideoProgressData) => void;\n onReadyForDisplay?: () => void;\n pauseAsync?: () => void;\n play?: () => void;\n playAsync?: () => void;\n replayAsync?: () => void;\n resizeMode?: string;\n seek?: (progress: number) => void;\n setPositionAsync?: (millis: number) => void;\n soundRef?: React.RefObject<SoundReturnType>;\n stopAsync?: () => void;\n style?: StyleProp<ViewStyle>;\n unloadAsync?: () => void;\n uri?: string;\n};\n\nexport type SoundType = {\n initializeSound: (\n source?: { uri: string },\n initialStatus?: Partial<AVPlaybackStatusToSet>,\n onPlaybackStatusUpdate?: (playbackStatus: PlaybackStatus) => void,\n ) => SoundReturnType | null;\n Player: React.ComponentType<SoundReturnType> | null;\n};\n\nexport let Sound: SoundType;\n\nexport type VideoProgressData = {\n currentTime: number;\n seekableDuration: number;\n playableDuration?: number;\n};\n\nexport type VideoPayloadData = {\n duration: number;\n audioTracks?: { index: number; language: string; title: string; type: string }[];\n currentPosition?: number;\n naturalSize?: { height: number; orientation: 'portrait' | 'landscape'; width: number };\n textTracks?: { index: number; language: string; title: string; type: string }[];\n videoTracks?: {\n bitrate: number;\n codecs: string;\n height: number;\n trackId: number;\n width: number;\n }[];\n};\n\nexport type VideoType = {\n paused: boolean;\n testID: string;\n uri: string;\n videoRef: React.RefObject<VideoType>;\n onBuffer?: (props: { isBuffering: boolean }) => void;\n onEnd?: () => void;\n onLoad?: (payload: VideoPayloadData) => void;\n onLoadStart?: () => void;\n onPlaybackStatusUpdate?: (playbackStatus: PlaybackStatus) => void;\n onProgress?: (data: VideoProgressData) => void;\n onReadyForDisplay?: () => void;\n repeat?: boolean;\n replayAsync?: () => void;\n resizeMode?: string;\n seek?: (progress: number) => void;\n setPositionAsync?: (position: number) => void;\n style?: StyleProp<ViewStyle>;\n};\n\nexport let Video: React.ComponentType<VideoType>;\n\ntype Handlers = {\n compressImage?: CompressImage;\n deleteFile?: DeleteFile;\n FlatList?: typeof DefaultFlatList;\n getLocalAssetUri?: GetLocalAssetUri;\n getPhotos?: GetPhotos;\n NetInfo?: NetInfo;\n pickDocument?: PickDocument;\n saveFile?: SaveFile;\n SDK?: string;\n shareImage?: ShareImage;\n Sound?: SoundType;\n takePhoto?: TakePhoto;\n triggerHaptic?: TriggerHaptic;\n Video?: React.ComponentType<VideoType>;\n};\n\nexport const registerNativeHandlers = (handlers: Handlers) => {\n if (handlers.compressImage) {\n compressImage = handlers.compressImage;\n }\n\n if (handlers.deleteFile) {\n deleteFile = handlers.deleteFile;\n }\n\n if (handlers.FlatList) {\n FlatList = handlers.FlatList;\n }\n if (handlers.NetInfo) {\n NetInfo = handlers.NetInfo;\n }\n\n if (handlers.getLocalAssetUri) {\n getLocalAssetUri = handlers.getLocalAssetUri;\n }\n\n if (handlers.getPhotos) {\n getPhotos = handlers.getPhotos;\n }\n\n if (handlers.pickDocument) {\n pickDocument = handlers.pickDocument;\n }\n\n if (handlers.saveFile) {\n saveFile = handlers.saveFile;\n }\n\n if (handlers.SDK) {\n SDK = handlers.SDK;\n }\n\n if (handlers.shareImage) {\n shareImage = handlers.shareImage;\n }\n\n if (handlers.Sound) {\n Sound = handlers.Sound;\n }\n\n if (handlers.takePhoto) {\n takePhoto = handlers.takePhoto;\n }\n\n if (handlers.triggerHaptic) {\n triggerHaptic = handlers.triggerHaptic;\n }\n\n if (handlers.Video) {\n Video = handlers.Video;\n }\n};\n\nexport const isVideoPackageAvailable = () => !!Video;\nexport const isAudioPackageAvailable = () => !!Sound.Player || !!Sound.initializeSound;\n"]}
1
+ {"version":3,"sources":["native.ts"],"names":["fail","Error","compressImage","deleteFile","getLocalAssetUri","getPhotos","FlatList","DefaultFlatList","NetInfo","addEventListener","fetch","pickDocument","saveFile","shareImage","takePhoto","triggerHaptic","SDK","Sound","Video","registerNativeHandlers","handlers","isVideoPackageAvailable","isAudioPackageAvailable","Player","initializeSound"],"mappings":";;;;;AACA;;AAMA,IAAMA,IAAI,GAAG,SAAPA,IAAO,GAAM;AACjB,QAAMC,KAAK,CACT,mGADS,CAAX;AAGD,CAJD;;AAiBO,IAAIC,aAA4B,GAAGF,IAAnC;;AAGA,IAAIG,UAAsB,GAAGH,IAA7B;;AAGA,IAAII,gBAAkC,GAAGJ,IAAzC;;AASA,IAAIK,SAAoB,GAAGL,IAA3B;;AAOA,IAAIM,QAAQ,GAAGC,qBAAf;;AAEA,IAAIC,OAAgB,GAAG;AAC5BC,EAAAA,gBAAgB,EAAET,IADU;AAE5BU,EAAAA,KAAK,EAAEV;AAFqB,CAAvB;;AAWA,IAAIW,YAA0B,GAAGX,IAAjC;;AAOA,IAAIY,QAAkB,GAAGZ,IAAzB;;AAOA,IAAIa,UAAsB,GAAGb,IAA7B;;AASA,IAAIc,SAAoB,GAAGd,IAA3B;;AAWA,IAAIe,aAA4B,GAAGf,IAAnC;;AAwBA,IAAIgB,GAAJ;;AA8CA,IAAIC,KAAJ;;AA2CA,IAAIC,KAAJ;;;AAmBA,IAAMC,sBAAsB,GAAG,SAAzBA,sBAAyB,CAACC,QAAD,EAAwB;AAC5D,MAAIA,QAAQ,CAAClB,aAAb,EAA4B;AAC1B,4BAAAA,aAAa,GAAGkB,QAAQ,CAAClB,aAAzB;AACD;;AAED,MAAIkB,QAAQ,CAACjB,UAAb,EAAyB;AACvB,yBAAAA,UAAU,GAAGiB,QAAQ,CAACjB,UAAtB;AACD;;AAED,MAAIiB,QAAQ,CAACd,QAAb,EAAuB;AACrB,uBAAAA,QAAQ,GAAGc,QAAQ,CAACd,QAApB;AACD;;AACD,MAAIc,QAAQ,CAACZ,OAAb,EAAsB;AACpB,sBAAAA,OAAO,GAAGY,QAAQ,CAACZ,OAAnB;AACD;;AAED,MAAIY,QAAQ,CAAChB,gBAAb,EAA+B;AAC7B,+BAAAA,gBAAgB,GAAGgB,QAAQ,CAAChB,gBAA5B;AACD;;AAED,MAAIgB,QAAQ,CAACf,SAAb,EAAwB;AACtB,wBAAAA,SAAS,GAAGe,QAAQ,CAACf,SAArB;AACD;;AAED,MAAIe,QAAQ,CAACT,YAAb,EAA2B;AACzB,2BAAAA,YAAY,GAAGS,QAAQ,CAACT,YAAxB;AACD;;AAED,MAAIS,QAAQ,CAACR,QAAb,EAAuB;AACrB,uBAAAA,QAAQ,GAAGQ,QAAQ,CAACR,QAApB;AACD;;AAED,MAAIQ,QAAQ,CAACJ,GAAb,EAAkB;AAChB,kBAAAA,GAAG,GAAGI,QAAQ,CAACJ,GAAf;AACD;;AAED,MAAII,QAAQ,CAACP,UAAb,EAAyB;AACvB,yBAAAA,UAAU,GAAGO,QAAQ,CAACP,UAAtB;AACD;;AAED,MAAIO,QAAQ,CAACH,KAAb,EAAoB;AAClB,oBAAAA,KAAK,GAAGG,QAAQ,CAACH,KAAjB;AACD;;AAED,MAAIG,QAAQ,CAACN,SAAb,EAAwB;AACtB,wBAAAA,SAAS,GAAGM,QAAQ,CAACN,SAArB;AACD;;AAED,MAAIM,QAAQ,CAACL,aAAb,EAA4B;AAC1B,4BAAAA,aAAa,GAAGK,QAAQ,CAACL,aAAzB;AACD;;AAED,MAAIK,QAAQ,CAACF,KAAb,EAAoB;AAClB,oBAAAA,KAAK,GAAGE,QAAQ,CAACF,KAAjB;AACD;AACF,CAvDM;;;;AAyDA,IAAMG,uBAAuB,GAAG,SAA1BA,uBAA0B;AAAA,SAAM,CAAC,CAACH,KAAR;AAAA,CAAhC;;;;AACA,IAAMI,uBAAuB,GAAG,SAA1BA,uBAA0B;AAAA,SAAM,CAAC,CAACL,KAAK,CAACM,MAAR,IAAkB,CAAC,CAACN,KAAK,CAACO,eAAhC;AAAA,CAAhC","sourcesContent":["import type React from 'react';\nimport { FlatList as DefaultFlatList, StyleProp, ViewStyle } from 'react-native';\n\nimport type { NetInfoSubscription } from '@react-native-community/netinfo';\n\nimport type { Asset, File } from './types/types';\n\nconst fail = () => {\n throw Error(\n 'Native handler was not registered, you should import stream-chat-expo or stream-chat-react-native',\n );\n};\n\ntype CompressImage = ({\n compressImageQuality,\n height,\n uri,\n width,\n}: {\n compressImageQuality: number;\n height: number;\n uri: string;\n width: number;\n}) => Promise<string> | never;\nexport let compressImage: CompressImage = fail;\n\ntype DeleteFile = ({ uri }: { uri: string }) => Promise<boolean> | never;\nexport let deleteFile: DeleteFile = fail;\n\ntype GetLocalAssetUri = (uriOrAssetId: string) => Promise<string> | never;\nexport let getLocalAssetUri: GetLocalAssetUri = fail;\n\ntype GetPhotos = ({ after, first }: { first: number; after?: string }) =>\n | Promise<{\n assets: Array<Omit<Asset, 'source'> & { source: 'picker' }>;\n endCursor: string;\n hasNextPage: boolean;\n }>\n | never;\nexport let getPhotos: GetPhotos = fail;\n\ntype NetInfo = {\n addEventListener: (listener: (isConnected: boolean) => void) => NetInfoSubscription | never;\n fetch: (requestedInterface?: string | undefined) => Promise<boolean> | never;\n};\n\nexport let FlatList = DefaultFlatList;\n\nexport let NetInfo: NetInfo = {\n addEventListener: fail,\n fetch: fail,\n};\n\ntype PickDocument = ({ maxNumberOfFiles }: { maxNumberOfFiles?: number }) =>\n | Promise<{\n cancelled: boolean;\n docs?: File[];\n }>\n | never;\nexport let pickDocument: PickDocument = fail;\n\ntype SaveFileOptions = {\n fileName: string;\n fromUrl: string;\n};\ntype SaveFile = (options: SaveFileOptions) => Promise<string> | never;\nexport let saveFile: SaveFile = fail;\n\ntype ShareOptions = {\n type?: string;\n url?: string;\n};\ntype ShareImage = (options: ShareOptions) => Promise<boolean> | never;\nexport let shareImage: ShareImage = fail;\n\ntype Photo =\n | (Omit<Asset, 'source'> & {\n cancelled: false;\n source: 'camera';\n })\n | { cancelled: true };\ntype TakePhoto = (options: { compressImageQuality?: number }) => Promise<Photo> | never;\nexport let takePhoto: TakePhoto = fail;\n\ntype HapticFeedbackMethod =\n | 'impactHeavy'\n | 'impactLight'\n | 'impactMedium'\n | 'notificationError'\n | 'notificationSuccess'\n | 'notificationWarning'\n | 'selection';\ntype TriggerHaptic = (method: HapticFeedbackMethod) => void | never;\nexport let triggerHaptic: TriggerHaptic = fail;\n\nexport type PlaybackStatus = {\n didJustFinish: boolean;\n durationMillis: number;\n error: string;\n isBuffering: boolean;\n isLoaded: boolean;\n isLooping: boolean;\n isPlaying: boolean;\n positionMillis: number;\n};\n\nexport type AVPlaybackStatusToSet = {\n isLooping: boolean;\n isMuted: boolean;\n positionMillis: number;\n progressUpdateIntervalMillis: number;\n rate: number;\n shouldCorrectPitch: boolean;\n shouldPlay: boolean;\n volume: number;\n};\n\nexport let SDK: string;\n\nexport type SoundOptions = {\n basePathOrCallback?: string;\n callback?: () => void;\n filenameOrFile?: string;\n initialStatus?: Partial<AVPlaybackStatusToSet>;\n onPlaybackStatusUpdate?: (playbackStatus: PlaybackStatus) => void;\n source?: { uri: string };\n};\n\nexport type SoundReturnType = {\n paused: boolean;\n testID: string;\n getDuration?: () => number;\n isPlaying?: () => boolean;\n onBuffer?: (props: { isBuffering: boolean }) => void;\n onEnd?: () => void;\n onLoad?: (payload: VideoPayloadData) => void;\n onLoadStart?: () => void;\n onPlaybackStatusUpdate?: (playbackStatus: PlaybackStatus) => void;\n onProgress?: (data: VideoProgressData) => void;\n onReadyForDisplay?: () => void;\n pauseAsync?: () => void;\n play?: () => void;\n playAsync?: () => void;\n replayAsync?: () => void;\n resizeMode?: string;\n seek?: (progress: number) => void;\n setPositionAsync?: (millis: number) => void;\n soundRef?: React.RefObject<SoundReturnType>;\n stopAsync?: () => void;\n style?: StyleProp<ViewStyle>;\n unloadAsync?: () => void;\n uri?: string;\n};\n\nexport type SoundType = {\n initializeSound: (\n source?: { uri: string },\n initialStatus?: Partial<AVPlaybackStatusToSet>,\n onPlaybackStatusUpdate?: (playbackStatus: PlaybackStatus) => void,\n ) => Promise<SoundReturnType | null>;\n Player: React.ComponentType<SoundReturnType> | null;\n};\n\nexport let Sound: SoundType;\n\nexport type VideoProgressData = {\n currentTime: number;\n seekableDuration: number;\n playableDuration?: number;\n};\n\nexport type VideoPayloadData = {\n duration: number;\n audioTracks?: { index: number; language: string; title: string; type: string }[];\n currentPosition?: number;\n naturalSize?: { height: number; orientation: 'portrait' | 'landscape'; width: number };\n textTracks?: { index: number; language: string; title: string; type: string }[];\n videoTracks?: {\n bitrate: number;\n codecs: string;\n height: number;\n trackId: number;\n width: number;\n }[];\n};\n\nexport type VideoType = {\n paused: boolean;\n testID: string;\n uri: string;\n videoRef: React.RefObject<VideoType>;\n onBuffer?: (props: { isBuffering: boolean }) => void;\n onEnd?: () => void;\n onLoad?: (payload: VideoPayloadData) => void;\n onLoadStart?: () => void;\n onPlaybackStatusUpdate?: (playbackStatus: PlaybackStatus) => void;\n onProgress?: (data: VideoProgressData) => void;\n onReadyForDisplay?: () => void;\n repeat?: boolean;\n replayAsync?: () => void;\n resizeMode?: string;\n seek?: (progress: number) => void;\n setPositionAsync?: (position: number) => void;\n style?: StyleProp<ViewStyle>;\n};\n\nexport let Video: React.ComponentType<VideoType>;\n\ntype Handlers = {\n compressImage?: CompressImage;\n deleteFile?: DeleteFile;\n FlatList?: typeof DefaultFlatList;\n getLocalAssetUri?: GetLocalAssetUri;\n getPhotos?: GetPhotos;\n NetInfo?: NetInfo;\n pickDocument?: PickDocument;\n saveFile?: SaveFile;\n SDK?: string;\n shareImage?: ShareImage;\n Sound?: SoundType;\n takePhoto?: TakePhoto;\n triggerHaptic?: TriggerHaptic;\n Video?: React.ComponentType<VideoType>;\n};\n\nexport const registerNativeHandlers = (handlers: Handlers) => {\n if (handlers.compressImage) {\n compressImage = handlers.compressImage;\n }\n\n if (handlers.deleteFile) {\n deleteFile = handlers.deleteFile;\n }\n\n if (handlers.FlatList) {\n FlatList = handlers.FlatList;\n }\n if (handlers.NetInfo) {\n NetInfo = handlers.NetInfo;\n }\n\n if (handlers.getLocalAssetUri) {\n getLocalAssetUri = handlers.getLocalAssetUri;\n }\n\n if (handlers.getPhotos) {\n getPhotos = handlers.getPhotos;\n }\n\n if (handlers.pickDocument) {\n pickDocument = handlers.pickDocument;\n }\n\n if (handlers.saveFile) {\n saveFile = handlers.saveFile;\n }\n\n if (handlers.SDK) {\n SDK = handlers.SDK;\n }\n\n if (handlers.shareImage) {\n shareImage = handlers.shareImage;\n }\n\n if (handlers.Sound) {\n Sound = handlers.Sound;\n }\n\n if (handlers.takePhoto) {\n takePhoto = handlers.takePhoto;\n }\n\n if (handlers.triggerHaptic) {\n triggerHaptic = handlers.triggerHaptic;\n }\n\n if (handlers.Video) {\n Video = handlers.Video;\n }\n};\n\nexport const isVideoPackageAvailable = () => !!Video;\nexport const isAudioPackageAvailable = () => !!Sound.Player || !!Sound.initializeSound;\n"]}
@@ -1,3 +1,3 @@
1
1
  {
2
- "version": "5.2.0"
2
+ "version": "5.3.0-beta.3"
3
3
  }
@@ -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
- export declare const GalleryImage: React.FC<Omit<ImageProps, 'height' | 'source'> & {
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<ChatContextValue<StreamChatGenerics>, 'client' | 'mutedUsers'> & 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'> & {
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: ChatContextValue<StreamChatGenerics>;
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[];
@@ -13,7 +13,7 @@ declare type DeleteFile = ({ uri }: {
13
13
  uri: string;
14
14
  }) => Promise<boolean> | never;
15
15
  export declare let deleteFile: DeleteFile;
16
- declare type GetLocalAssetUri = (uriOrAssetId: string) => never;
16
+ declare type GetLocalAssetUri = (uriOrAssetId: string) => Promise<string> | never;
17
17
  export declare let getLocalAssetUri: GetLocalAssetUri;
18
18
  declare type GetPhotos = ({ after, first }: {
19
19
  first: number;
@@ -125,7 +125,7 @@ export declare type SoundReturnType = {
125
125
  export declare type SoundType = {
126
126
  initializeSound: (source?: {
127
127
  uri: string;
128
- }, initialStatus?: Partial<AVPlaybackStatusToSet>, onPlaybackStatusUpdate?: (playbackStatus: PlaybackStatus) => void) => SoundReturnType | null;
128
+ }, initialStatus?: Partial<AVPlaybackStatusToSet>, onPlaybackStatusUpdate?: (playbackStatus: PlaybackStatus) => void) => Promise<SoundReturnType | null>;
129
129
  Player: React.ComponentType<SoundReturnType> | null;
130
130
  };
131
131
  export declare let Sound: SoundType;
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.2.0",
4
+ "version": "5.3.0-beta.3",
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.map((channel) => (
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
- ImageBackground,
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<MessageContextValue<StreamChatGenerics>, 'onLongPress' | 'onPress' | 'onPressIn'> &
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
- <MemoizedGalleryImage
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 { ImageBackground, ImageProps } from 'react-native';
2
+ import { Image, ImageProps } from 'react-native';
3
3
 
4
- import { makeImageCompatibleUrl } from '../../utils/utils';
4
+ import { ChatContextValue, useChatContext } from '../../contexts/chatContext/ChatContext';
5
5
 
6
- export const GalleryImage: React.FC<
7
- Omit<ImageProps, 'height' | 'source'> & {
8
- uri: string;
9
- }
10
- > = (props) => {
11
- const { uri, ...rest } = props;
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
- <ImageBackground
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
+ };