diff --git a/docusaurus/docs/reactnative/contexts/channel-context.mdx b/docusaurus/docs/reactnative/contexts/channel-context.mdx index bdce6b97d..4d943b6fc 100644 --- a/docusaurus/docs/reactnative/contexts/channel-context.mdx +++ b/docusaurus/docs/reactnative/contexts/channel-context.mdx @@ -141,28 +141,6 @@ loadChannelAroundMessage({ | -------- | | function | -### loadChannelAtMessage - -Function to reload channel at particular message in history. - -:::caution - -This function is deprecated. Use [loadChannelAroundMessage](#loadchannelaroundmessage) instead. - -::: - -```tsx -loadChannelAtMessage({ - before: 10, // Number of messages to load before messageId - after: 10, // Number of messages to load after messageId - messageId, -}); -``` - -| Type | -| -------- | -| function | - ### loading True if channel is loading messages during first load. diff --git a/docusaurus/docs/reactnative/contexts/message-context.mdx b/docusaurus/docs/reactnative/contexts/message-context.mdx index 9a4b509bd..40080a425 100644 --- a/docusaurus/docs/reactnative/contexts/message-context.mdx +++ b/docusaurus/docs/reactnative/contexts/message-context.mdx @@ -90,54 +90,6 @@ True if one of the following condition is true: -### handleDeleteMessage - -Callback function for "Delete Message" action. - -| Type | -| -------- | -| function | - -### handleEditMessage - -Callback function for "Edit Message" action. - -| Type | -| -------- | -| function | - -### handleQuotedReplyMessage - -Callback function for "Quoted Reply" action. - -| Type | -| -------- | -| function | - -### handleResendMessage - -Callback function for "Resend Message" (for failed message) action. - -| Type | -| -------- | -| function | - -### handleToggleBanUser - -Callback function for "Ban/Unban User" action. - -| Type | -| -------- | -| function | - -### handleToggleMuteUser - -Callback function for "Mute/Unmute User" action. - -| Type | -| -------- | -| function | - ### handleToggleReaction Callback function for toggling reaction from reaction selector. diff --git a/docusaurus/docs/reactnative/contexts/messages-context.mdx b/docusaurus/docs/reactnative/contexts/messages-context.mdx index 455c1cc30..fb377ef3c 100644 --- a/docusaurus/docs/reactnative/contexts/messages-context.mdx +++ b/docusaurus/docs/reactnative/contexts/messages-context.mdx @@ -26,7 +26,6 @@ import Gallery from '../common-content/ui-components/channel/props/gallery.mdx'; import Giphy from '../common-content/ui-components/channel/props/giphy.mdx'; import GiphyVersion from '../common-content/ui-components/channel/props/giphy_version.mdx'; import HandleBan from '../common-content/ui-components/channel/props/handle_ban.mdx'; -import HandleBlock from '../common-content/ui-components/channel/props/handle_block.mdx'; import HandleCopy from '../common-content/ui-components/channel/props/handle_copy.mdx'; import HandleDelete from '../common-content/ui-components/channel/props/handle_delete.mdx'; import HandleEdit from '../common-content/ui-components/channel/props/handle_edit.mdx'; @@ -115,10 +114,6 @@ Id of current channel. -###
_forwarded from [Channel](../../core-components/channel#handleblock)_ props
`handleBlock` {#handleblock} - - - ###
_forwarded from [Channel](../../core-components/channel#handlecopy)_ props
`handleCopy` {#handlecopy} diff --git a/docusaurus/docs/reactnative/core-components/channel-list.mdx b/docusaurus/docs/reactnative/core-components/channel-list.mdx index b8af02ea1..33d737deb 100644 --- a/docusaurus/docs/reactnative/core-components/channel-list.mdx +++ b/docusaurus/docs/reactnative/core-components/channel-list.mdx @@ -218,21 +218,6 @@ Override for the default Event Listener behavior when a channel is updated. Th | setChannels | Setter function for the internal channels state | | event | [Event Object](https://getstream.io/chat/docs/react/event_object/#event-object) corresponding to channel.deleted | -### `onMessageNew` - -Override for the default Event Listener behavior when a message is received on a channel that is not being watched. The default behavior adds the channel to the list. - -> Warning: This function is deprecated. Use **[`onNewMessageNotification`](#onNewMessageNotification)** instead. - -| Type | -| -------- | -| Function | - -| Parameter | Description | -| ----------- | ---------------------------------------------------------------------------------------------------------------- | -| setChannels | Setter function for the internal channels state | -| event | [Event Object](https://getstream.io/chat/docs/react/event_object/#event-object) corresponding to channel.deleted | - ### **`onNewMessageNotification`** Override for the default Event Listener behavior when a message is received on a channel that is not being watched. The default behavior adds the channel to the list. diff --git a/docusaurus/docs/reactnative/core-components/channel.mdx b/docusaurus/docs/reactnative/core-components/channel.mdx index 529e1a459..ccabe5709 100644 --- a/docusaurus/docs/reactnative/core-components/channel.mdx +++ b/docusaurus/docs/reactnative/core-components/channel.mdx @@ -65,7 +65,6 @@ import GiphyEnabled from '../common-content/ui-components/channel/props/giphy_en import GiphyVersion from '../common-content/ui-components/channel/props/giphy_version.mdx'; import HandleAttachButtonPress from '../common-content/ui-components/channel/props/handle_attach_button_press.mdx'; import HandleBan from '../common-content/ui-components/channel/props/handle_ban.mdx'; -import HandleBlock from '../common-content/ui-components/channel/props/handle_block.mdx'; import HandleCopy from '../common-content/ui-components/channel/props/handle_copy.mdx'; import HandleDelete from '../common-content/ui-components/channel/props/handle_delete.mdx'; import HandleEdit from '../common-content/ui-components/channel/props/handle_edit.mdx'; @@ -491,10 +490,6 @@ The max allowable is 255, which when reached displays as `255+`. -### `handleBlock` - - - ### `handleCopy` diff --git a/docusaurus/docs/reactnative/guides/custom-message-actions.mdx b/docusaurus/docs/reactnative/guides/custom-message-actions.mdx index 7abc635a1..c5d2f5353 100644 --- a/docusaurus/docs/reactnative/guides/custom-message-actions.mdx +++ b/docusaurus/docs/reactnative/guides/custom-message-actions.mdx @@ -391,7 +391,6 @@ Please note that these intercepts will neither change the standard functions nor ::: - `handleBan` -- `handleBlock`(deprecated) - `handleCopy` - `handleDelete` - `handleEdit` diff --git a/package/src/components/Channel/Channel.tsx b/package/src/components/Channel/Channel.tsx index 63a9ae050..b3b7c0828 100644 --- a/package/src/components/Channel/Channel.tsx +++ b/package/src/components/Channel/Channel.tsx @@ -1082,28 +1082,6 @@ const ChannelWithContext = < // eslint-disable-next-line react-hooks/exhaustive-deps }, [targetedMessage]); - /** - * @deprecated use loadChannelAroundMessage instead - * - * Loads channel at specific message - * - * @param messageId If undefined, channel will be loaded at most recent message. - * @param before Number of message to query before messageId - * @param after Number of message to query after messageId - */ - const loadChannelAtMessage: ChannelContextValue['loadChannelAtMessage'] = ({ - after = 2, - before = 30, - messageId, - }) => - channelQueryCallRef.current(async () => { - await queryAtMessage({ after, before, messageId }); - - if (messageId) { - setTargetedMessage(messageId); - } - }); - /** * Utility method to mark that current set if latest into two. * With an empty latest set @@ -1399,95 +1377,6 @@ const ChannelWithContext = < setHasNoMoreRecentMessagesToLoad(true); }); - /** - * @deprecated - * Makes a query to load messages at particular message id. - * - * @param messageId Targeted message id - * @param before Number of messages to load before messageId - * @param after Number of messages to load after messageId - */ - const queryAtMessage = async ({ - after = 10, - before = 10, - messageId, - }: Parameters['loadChannelAtMessage']>[0]) => { - if (!channel) return; - channel.state.setIsUpToDate(false); - hasOverlappingRecentMessagesRef.current = false; - clearInterval(mergeSetsIntervalRef.current); - channel.state.clearMessages(); - setMessages([]); - if (!messageId) { - await channel.query({ - messages: { - limit: before, - }, - watch: true, - }); - - channel.state.setIsUpToDate(true); - return; - } - - await queryBeforeMessage(messageId, before); - await queryAfterMessage(messageId, after); - }; - - /** - * @deprecated - * Makes a query to load messages before particular message id. - * - * @param messageId Targeted message id - * @param limit Number of messages to load - */ - const queryBeforeMessage = async (messageId: string, limit = 5) => { - if (!channel) return; - - await channel.query({ - messages: { - id_lt: messageId, - limit, - }, - watch: true, - }); - - channel.state.setIsUpToDate(false); - }; - - /** - * @deprecated - * Makes a query to load messages later than particular message id. - * - * @param messageId Targeted message id - * @param limit Number of messages to load. - */ - const queryAfterMessage = async (messageId: string, limit = 5) => { - if (!channel) return; - const state = await channel.query({ - messages: { - id_gte: messageId, - limit, - }, - watch: true, - }); - - if (state.messages.length < limit) { - // make current set as the latest - const currentSet = channel.state.messageSets.find((set) => set.isCurrent); - if (currentSet && !currentSet.isLatest) { - channel.state.messageSets = channel.state.messageSets.filter((set) => !set.isLatest); - currentSet.isLatest = true; - } - channel.state.setIsUpToDate(true); - setHasNoMoreRecentMessagesToLoad(true); - } else { - splitLatestCurrentMessageSetRef.current(); - channel.state.setIsUpToDate(false); - setHasNoMoreRecentMessagesToLoad(false); - } - }; - // In case the channel is disconnected which may happen when channel is deleted, // underlying js client throws an error. Following function ensures that Channel component // won't result in error in such a case. @@ -2209,7 +2098,6 @@ const ChannelWithContext = < isOwner, lastRead, loadChannelAroundMessage, - loadChannelAtMessage, loading, LoadingIndicator, markRead, diff --git a/package/src/components/Channel/hooks/useCreateChannelContext.ts b/package/src/components/Channel/hooks/useCreateChannelContext.ts index a51c3bd99..b7e3cc467 100644 --- a/package/src/components/Channel/hooks/useCreateChannelContext.ts +++ b/package/src/components/Channel/hooks/useCreateChannelContext.ts @@ -21,7 +21,6 @@ export const useCreateChannelContext = < isOwner, lastRead, loadChannelAroundMessage, - loadChannelAtMessage, loading, LoadingIndicator, markRead, @@ -65,7 +64,6 @@ export const useCreateChannelContext = < isOwner, lastRead, loadChannelAroundMessage, - loadChannelAtMessage, loading, LoadingIndicator, markRead, diff --git a/package/src/components/ChannelList/ChannelList.tsx b/package/src/components/ChannelList/ChannelList.tsx index 0321a01a6..b70dd0b2e 100644 --- a/package/src/components/ChannelList/ChannelList.tsx +++ b/package/src/components/ChannelList/ChannelList.tsx @@ -156,21 +156,6 @@ export type ChannelListProps< setChannels: React.Dispatch[] | null>>, event: Event, ) => void; - /** - * @deprecated use onNewMessageNotification instead - * - * Override the default listener/handler for event `notification.message_new` - * This event is received on channel, which is not being watched. - * - * @param setChannels Setter for internal state property - `channels`. It's created from useState() hook. - * @param event An [Event object](https://getstream.io/chat/docs/event_object) corresponding to `notification.message_new` event - * - * @overrideType Function - * */ - onMessageNew?: ( - setChannels: React.Dispatch[] | null>>, - event: Event, - ) => void; /** * Override the default listener/handler for event `message.new` * This event is received on channel, when a new message is added on a channel. @@ -262,7 +247,6 @@ export const ChannelList = < onChannelTruncated, onChannelUpdated, onChannelVisible, - onMessageNew, onNewMessage, onNewMessageNotification, onRemovedFromChannel, @@ -342,7 +326,6 @@ export const ChannelList = < }); useNewMessageNotification({ - onMessageNew, onNewMessageNotification, setChannels, }); diff --git a/package/src/components/ChannelList/hooks/listeners/useNewMessageNotification.ts b/package/src/components/ChannelList/hooks/listeners/useNewMessageNotification.ts index ad7e51d09..4a42810f7 100644 --- a/package/src/components/ChannelList/hooks/listeners/useNewMessageNotification.ts +++ b/package/src/components/ChannelList/hooks/listeners/useNewMessageNotification.ts @@ -12,10 +12,7 @@ import { getChannel } from '../../utils'; type Parameters = { setChannels: React.Dispatch[] | null>>; - onMessageNew?: ( - setChannels: React.Dispatch[] | null>>, - event: Event, - ) => void; + onNewMessageNotification?: ( setChannels: React.Dispatch[] | null>>, event: Event, @@ -25,7 +22,6 @@ type Parameters({ - onMessageNew, onNewMessageNotification, setChannels, }: Parameters) => { @@ -33,12 +29,7 @@ export const useNewMessageNotification = < useEffect(() => { const handleEvent = async (event: Event) => { - if (typeof onMessageNew === 'function') { - onMessageNew(setChannels, event); - console.warn( - 'onMessageNew is deprecated and will be removed in future release. Please use onNewMessageNotification to establish the same behaviour', - ); - } else if (typeof onNewMessageNotification === 'function') { + if (typeof onNewMessageNotification === 'function') { onNewMessageNotification(setChannels, event); } else { if (event.channel?.id && event.channel?.type) { diff --git a/package/src/components/ImageGallery/ImageGallery.tsx b/package/src/components/ImageGallery/ImageGallery.tsx index b3d0c8a64..0749ce749 100644 --- a/package/src/components/ImageGallery/ImageGallery.tsx +++ b/package/src/components/ImageGallery/ImageGallery.tsx @@ -638,6 +638,7 @@ const styles = StyleSheet.create({ animatedContainer: { alignItems: 'center', flexDirection: 'row', + backgroundColor: 'red', }, }); diff --git a/package/src/components/Message/Message.tsx b/package/src/components/Message/Message.tsx index 1e962a96d..231b55315 100644 --- a/package/src/components/Message/Message.tsx +++ b/package/src/components/Message/Message.tsx @@ -122,11 +122,6 @@ export type MessageActionHandlers< pinMessage: () => Promise; quotedReply: () => void; resendMessage: () => Promise; - /** - * @deprecated - * TODO: This seems useless for the action handlers here so can be removed. - */ - showMessageOverlay: () => void; toggleBanUser: () => Promise; toggleMuteUser: () => Promise; toggleReaction: (reactionType: string) => Promise; @@ -147,7 +142,6 @@ export type MessagePropsWithContext< | 'dismissKeyboardOnMessageTouch' | 'forceAlignMessages' | 'handleBan' - | 'handleBlock' | 'handleCopy' | 'handleDelete' | 'handleEdit' @@ -255,7 +249,6 @@ const MessageWithContext = < goToMessage, groupStyles = ['bottom'], handleBan, - handleBlock, handleCopy, handleDelete, handleEdit, @@ -514,7 +507,6 @@ const MessageWithContext = < const { banUser, - blockUser, copyMessage, deleteMessage, editMessage, @@ -533,7 +525,6 @@ const MessageWithContext = < deleteReaction, enforceUniqueReaction, handleBan, - handleBlock, handleCopy, handleDelete, handleEdit, @@ -573,7 +564,6 @@ const MessageWithContext = < ? messageActionsProp : messageActionsProp({ banUser, - blockUser, copyMessage, deleteMessage, dismissOverlay, @@ -584,7 +574,6 @@ const MessageWithContext = < isMyMessage, isThreadMessage, message, - messageReactions: isMessageActionsVisible === false, muteUser, ownCapabilities, pinMessage, @@ -628,7 +617,6 @@ const MessageWithContext = < pinMessage: handleTogglePinMessage, quotedReply: handleQuotedReplyMessage, resendMessage: handleResendMessage, - showMessageOverlay, threadReply: handleThreadReply, toggleBanUser: handleToggleBanUser, toggleMuteUser: handleToggleMuteUser, @@ -676,14 +664,6 @@ const MessageWithContext = < goToMessage, groupStyles, handleAction, - handleCopyMessage, - handleDeleteMessage, - handleEditMessage, - handleFlagMessage, - handleQuotedReplyMessage, - handleResendMessage, - handleToggleBanUser, - handleToggleMuteUser, handleToggleReaction, hasReactions, images: attachments.images, diff --git a/package/src/components/Message/hooks/useCreateMessageContext.ts b/package/src/components/Message/hooks/useCreateMessageContext.ts index eedd4d561..dac0259ee 100644 --- a/package/src/components/Message/hooks/useCreateMessageContext.ts +++ b/package/src/components/Message/hooks/useCreateMessageContext.ts @@ -14,14 +14,6 @@ export const useCreateMessageContext = < goToMessage, groupStyles, handleAction, - handleCopyMessage, - handleDeleteMessage, - handleEditMessage, - handleFlagMessage, - handleQuotedReplyMessage, - handleResendMessage, - handleToggleBanUser, - handleToggleMuteUser, handleToggleReaction, hasReactions, images, @@ -66,14 +58,6 @@ export const useCreateMessageContext = < goToMessage, groupStyles, handleAction, - handleCopyMessage, - handleDeleteMessage, - handleEditMessage, - handleFlagMessage, - handleQuotedReplyMessage, - handleResendMessage, - handleToggleBanUser, - handleToggleMuteUser, handleToggleReaction, hasReactions, images, diff --git a/package/src/components/Message/hooks/useMessageActions.tsx b/package/src/components/Message/hooks/useMessageActions.tsx index 3ee3ad8bf..094205b41 100644 --- a/package/src/components/Message/hooks/useMessageActions.tsx +++ b/package/src/components/Message/hooks/useMessageActions.tsx @@ -39,7 +39,6 @@ export const useMessageActions = < deleteReaction, enforceUniqueReaction, handleBan, - handleBlock, handleCopy, handleDelete, handleEdit, @@ -66,7 +65,6 @@ export const useMessageActions = < | 'deleteMessage' | 'sendReaction' | 'handleBan' - | 'handleBlock' | 'handleCopy' | 'handleDelete' | 'handleEdit' @@ -155,25 +153,6 @@ export const useMessageActions = < title: message.user?.banned ? t('Unban User') : t('Ban User'), }; - /** - * @deprecated use `banUser` instead - */ - const blockUser: MessageActionType = { - action: async () => { - setOverlay('none'); - if (message.user?.id) { - if (handleBlock) { - handleBlock(message); - } - - await handleToggleBanUser(); - } - }, - actionType: 'blockUser', - icon: , - title: message.user?.banned ? t('Unblock User') : t('Block User'), - }; - const copyMessage: MessageActionType = { action: () => { setOverlay('none'); @@ -325,7 +304,6 @@ export const useMessageActions = < return { banUser, - blockUser, copyMessage, deleteMessage, editMessage, diff --git a/package/src/components/Message/utils/messageActions.ts b/package/src/components/Message/utils/messageActions.ts index fea05791b..466289dbd 100644 --- a/package/src/components/Message/utils/messageActions.ts +++ b/package/src/components/Message/utils/messageActions.ts @@ -19,10 +19,6 @@ export type MessageActionsParams< */ isMessageActionsVisible: boolean; isThreadMessage: boolean; - /** - * @deprecated use `isMessageActionsVisible` instead. - */ - messageReactions: boolean; muteUser: MessageActionType; ownCapabilities: OwnCapabilitiesContextValue; pinMessage: MessageActionType; @@ -30,10 +26,6 @@ export type MessageActionsParams< retry: MessageActionType; threadReply: MessageActionType; unpinMessage: MessageActionType; - /** - * @deprecated use `banUser` instead. - */ - blockUser?: MessageActionType; } & Pick, 'message' | 'isMyMessage'>; export type MessageActionsProp< @@ -44,7 +36,6 @@ export const messageActions = < StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics, >({ banUser, - blockUser, copyMessage, deleteMessage, editMessage, @@ -54,7 +45,6 @@ export const messageActions = < isMyMessage, isThreadMessage, message, - messageReactions, ownCapabilities, pinMessage, quotedReply, @@ -62,7 +52,7 @@ export const messageActions = < threadReply, unpinMessage, }: MessageActionsParams) => { - if (messageReactions || !isMessageActionsVisible) { + if (!isMessageActionsVisible) { return []; } @@ -104,7 +94,7 @@ export const messageActions = < } if (!isMyMessage && ownCapabilities.banChannelMembers) { - actions.push(banUser || blockUser); + actions.push(banUser); } if ( diff --git a/package/src/components/MessageOverlay/hooks/useMessageActionAnimation.tsx b/package/src/components/MessageOverlay/hooks/useMessageActionAnimation.tsx deleted file mode 100644 index 6125f8863..000000000 --- a/package/src/components/MessageOverlay/hooks/useMessageActionAnimation.tsx +++ /dev/null @@ -1,48 +0,0 @@ -import type { ViewStyle } from 'react-native'; -import { TapGestureHandlerStateChangeEvent } from 'react-native-gesture-handler'; -import { - runOnJS, - useAnimatedGestureHandler, - useAnimatedStyle, - useSharedValue, -} from 'react-native-reanimated'; - -import type { MessageActionListItemProps } from '../MessageActionListItem'; - -/** - * @deprecated - * The implementation is done in the component itself using new API of `react-native-gesture-handler`. - */ -export const useMessageActionAnimation = ({ - action, - activeOpacity = 0.2, -}: Pick & { - activeOpacity?: number; -}) => { - const opacity = useSharedValue(1); - - const onTap = useAnimatedGestureHandler( - { - onEnd: () => { - runOnJS(action)(); - }, - onFinish: () => { - opacity.value = 1; - }, - onStart: () => { - opacity.value = activeOpacity; - }, - }, - [action], - ); - - const animatedStyle = useAnimatedStyle(() => ({ - opacity: opacity.value, - })); - - return { - animatedStyle, - onTap, - opacity, - }; -}; diff --git a/package/src/components/Reply/Reply.tsx b/package/src/components/Reply/Reply.tsx index bfe0b9a62..9e713a30a 100644 --- a/package/src/components/Reply/Reply.tsx +++ b/package/src/components/Reply/Reply.tsx @@ -31,6 +31,7 @@ import { FileIcon as FileIconDefault } from '../Attachment/FileIcon'; import { VideoThumbnail } from '../Attachment/VideoThumbnail'; import { MessageAvatar as MessageAvatarDefault } from '../Message/MessageSimple/MessageAvatar'; import { MessageTextContainer } from '../Message/MessageSimple/MessageTextContainer'; +import { useChatContext } from '../../contexts/chatContext/ChatContext'; const styles = StyleSheet.create({ container: { @@ -142,6 +143,7 @@ const ReplyWithContext = < styles: stylesProp = {}, t, } = props; + const { resizableCDNHosts } = useChatContext(); const [error, setError] = useState(false); @@ -230,6 +232,7 @@ const ReplyWithContext = < (stylesProp.imageAttachment?.height as number) || (imageAttachment?.height as number) || styles.imageAttachment.height, + resizableCDNHosts, url: (lastAttachment.image_url || lastAttachment.thumb_url || lastAttachment.og_scrape_url) as string, diff --git a/package/src/components/index.ts b/package/src/components/index.ts index abeb80568..c2c0ebe50 100644 --- a/package/src/components/index.ts +++ b/package/src/components/index.ts @@ -152,7 +152,6 @@ export * from './MessageList/utils/getGroupStyles'; export * from './MessageList/utils/getLastReceivedMessage'; export * from './MessageList/utils/getReadStates'; -export * from './MessageOverlay/hooks/useMessageActionAnimation'; export * from './MessageOverlay/MessageActionList'; export * from './MessageOverlay/MessageActionListItem'; export * from './MessageOverlay/MessageOverlay'; diff --git a/package/src/contexts/activeChannelsRefContext/ActiveChannelsRefContext.tsx b/package/src/contexts/activeChannelsRefContext/ActiveChannelsRefContext.tsx index 9c28b72ce..a2de73dc9 100644 --- a/package/src/contexts/activeChannelsRefContext/ActiveChannelsRefContext.tsx +++ b/package/src/contexts/activeChannelsRefContext/ActiveChannelsRefContext.tsx @@ -1,9 +1,5 @@ import React, { PropsWithChildren, useContext } from 'react'; -import type { UnknownType } from '../../types/types'; - -import { getDisplayName } from '../utils/getDisplayName'; - type ActiveChannels = React.MutableRefObject; const ActiveChannelsContext = React.createContext({ current: [] } as ActiveChannels); @@ -17,26 +13,3 @@ export const ActiveChannelsProvider = ({ export const useActiveChannelsRefContext = () => useContext(ActiveChannelsContext) as unknown as ActiveChannels; - -/** - * @deprecated - * - * This will be removed in the next major version. - * - * Typescript currently does not support partial inference so if ChatContext - * typing is desired while using the HOC withActiveChannelsRefContext the Props for the - * wrapped component must be provided as the first generic. - */ -export const withActiveChannelsRefContext =

( - Component: React.ComponentType

, -): React.ComponentType> => { - const WithActiveChannelsContextComponent = (props: Omit) => { - const ActiveChannelsContext = useActiveChannelsRefContext(); - - return ; - }; - WithActiveChannelsContextComponent.displayName = `WithActiveChannelsContext${getDisplayName( - Component, - )}`; - return WithActiveChannelsContextComponent; -}; diff --git a/package/src/contexts/attachmentPickerContext/AttachmentPickerContext.tsx b/package/src/contexts/attachmentPickerContext/AttachmentPickerContext.tsx index d89de3b6d..1c235d356 100644 --- a/package/src/contexts/attachmentPickerContext/AttachmentPickerContext.tsx +++ b/package/src/contexts/attachmentPickerContext/AttachmentPickerContext.tsx @@ -2,10 +2,9 @@ import React, { PropsWithChildren, useContext, useEffect, useState } from 'react import { BottomSheetHandleProps } from '@gorhom/bottom-sheet'; -import type { Asset, DefaultStreamChatGenerics, File } from '../../types/types'; +import type { Asset, File } from '../../types/types'; import { DEFAULT_BASE_CONTEXT_VALUE } from '../utils/defaultBaseContextValue'; -import { getDisplayName } from '../utils/getDisplayName'; import { isTestEnvironment } from '../utils/isTestEnvironment'; export type AttachmentPickerIconProps = { @@ -158,30 +157,3 @@ export const useAttachmentPickerContext = () => { return contextValue; }; - -/** - * @deprecated - * - * This will be removed in the next major version. - * - * Typescript currently does not support partial inference so if ChatContext - * typing is desired while using the HOC withAttachmentPickerContext the Props for the - * wrapped component must be provided as the first generic. - */ -export const withAttachmentPickerContext = < - StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics, ->( - Component: React.ComponentType, -): React.ComponentType> => { - const WithAttachmentPickerContextComponent = ( - props: Omit, - ) => { - const attachmentPickerContext = useAttachmentPickerContext(); - - return ; - }; - WithAttachmentPickerContextComponent.displayName = `WithAttachmentPickerContext${getDisplayName( - Component as React.ComponentType, - )}`; - return WithAttachmentPickerContextComponent; -}; diff --git a/package/src/contexts/channelContext/ChannelContext.tsx b/package/src/contexts/channelContext/ChannelContext.tsx index 6e276058a..fbf3b0464 100644 --- a/package/src/contexts/channelContext/ChannelContext.tsx +++ b/package/src/contexts/channelContext/ChannelContext.tsx @@ -5,10 +5,9 @@ import type { Channel, ChannelState } from 'stream-chat'; import type { EmptyStateProps } from '../../components/Indicators/EmptyStateIndicator'; import type { LoadingProps } from '../../components/Indicators/LoadingIndicator'; import { StickyHeaderProps } from '../../components/MessageList/StickyHeader'; -import type { DefaultStreamChatGenerics, UnknownType } from '../../types/types'; +import type { DefaultStreamChatGenerics } from '../../types/types'; import { DEFAULT_BASE_CONTEXT_VALUE } from '../utils/defaultBaseContextValue'; -import { getDisplayName } from '../utils/getDisplayName'; import { isTestEnvironment } from '../utils/isTestEnvironment'; export type ChannelContextValue< @@ -78,24 +77,7 @@ export type ChannelContextValue< * @param messageId If undefined, channel will be loaded at most recent message. */ loadChannelAroundMessage: ({ messageId }: { messageId?: string }) => Promise; - /** - * @deprecated use loadChannelAroundMessage instead - * - * Loads channel at specific message - * - * @param messageId If undefined, channel will be loaded at most recent message. - * @param before Number of message to query before messageId - * @param after Number of message to query after messageId - */ - loadChannelAtMessage: ({ - after, - before, - messageId, - }: { - after?: number; - before?: number; - messageId?: string; - }) => Promise; + loading: boolean; /** * Custom loading indicator to override the Stream default @@ -223,29 +205,3 @@ export const useChannelContext = < return contextValue; }; - -/** - * @deprecated - * - * This will be removed in the next major version. - * - * Typescript currently does not support partial inference so if ChatContext - * typing is desired while using the HOC withChannelContext the Props for the - * wrapped component must be provided as the first generic. - */ -export const withChannelContext = < - P extends UnknownType, - StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics, ->( - Component: React.ComponentType

, -): React.ComponentType>> => { - const WithChannelContextComponent = ( - props: Omit>, - ) => { - const channelContext = useChannelContext(); - - return ; - }; - WithChannelContextComponent.displayName = `WithChannelContext${getDisplayName(Component)}`; - return WithChannelContextComponent; -}; diff --git a/package/src/contexts/channelsContext/ChannelsContext.tsx b/package/src/contexts/channelsContext/ChannelsContext.tsx index 6a61fc63e..8cf38d706 100644 --- a/package/src/contexts/channelsContext/ChannelsContext.tsx +++ b/package/src/contexts/channelsContext/ChannelsContext.tsx @@ -16,10 +16,9 @@ import type { ChannelPreviewUnreadCountProps } from '../../components/ChannelPre import type { EmptyStateProps } from '../../components/Indicators/EmptyStateIndicator'; import type { LoadingErrorProps } from '../../components/Indicators/LoadingErrorIndicator'; import type { LoadingProps } from '../../components/Indicators/LoadingIndicator'; -import type { DefaultStreamChatGenerics, UnknownType } from '../../types/types'; +import type { DefaultStreamChatGenerics } from '../../types/types'; import { DEFAULT_BASE_CONTEXT_VALUE } from '../utils/defaultBaseContextValue'; -import { getDisplayName } from '../utils/getDisplayName'; import { isTestEnvironment } from '../utils/isTestEnvironment'; export type ChannelsContextValue< @@ -240,29 +239,3 @@ export const useChannelsContext = < return contextValue; }; - -/** - * @deprecated - * - * This will be removed in the next major version. - * - * Typescript currently does not support partial inference so if ChatContext - * typing is desired while using the HOC withChannelsContext the Props for the - * wrapped component must be provided as the first generic. - */ -export const withChannelsContext = < - P extends UnknownType, - StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics, ->( - Component: React.ComponentType

, -): React.ComponentType>> => { - const WithChannelsContextComponent = ( - props: Omit>, - ) => { - const channelsContext = useChannelsContext(); - - return ; - }; - WithChannelsContextComponent.displayName = `WithChannelsContext${getDisplayName(Component)}`; - return WithChannelsContextComponent; -}; diff --git a/package/src/contexts/channelsStateContext/ChannelsStateContext.tsx b/package/src/contexts/channelsStateContext/ChannelsStateContext.tsx index 7869b6dec..32f0c68c6 100644 --- a/package/src/contexts/channelsStateContext/ChannelsStateContext.tsx +++ b/package/src/contexts/channelsStateContext/ChannelsStateContext.tsx @@ -8,7 +8,7 @@ import React, { useRef, } from 'react'; -import type { DefaultStreamChatGenerics, UnknownType } from '../../types/types'; +import type { DefaultStreamChatGenerics } from '../../types/types'; import { ActiveChannelsProvider } from '../activeChannelsRefContext/ActiveChannelsRefContext'; import type { ChannelContextValue } from '../channelContext/ChannelContext'; @@ -17,7 +17,6 @@ import type { ThreadContextValue } from '../threadContext/ThreadContext'; import type { TypingContextValue } from '../typingContext/TypingContext'; import { DEFAULT_BASE_CONTEXT_VALUE } from '../utils/defaultBaseContextValue'; -import { getDisplayName } from '../utils/getDisplayName'; import { isTestEnvironment } from '../utils/isTestEnvironment'; export type ChannelState< @@ -198,31 +197,3 @@ export const useChannelsStateContext = < return contextValue; }; - -/** - * @deprecated - * - * This will be removed in the next major version. - * - * Typescript currently does not support partial inference so if ChatContext - * typing is desired while using the HOC withChannelsStateContext the Props for the - * wrapped component must be provided as the first generic. - */ -export const withChannelsStateContext = < - P extends UnknownType, - StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics, ->( - Component: React.ComponentType

, -): React.ComponentType>> => { - const WithChannelsStateContextComponent = ( - props: Omit>, - ) => { - const channelsStateContext = useChannelsStateContext(); - - return ; - }; - WithChannelsStateContextComponent.displayName = `WithChannelsStateContext${getDisplayName( - Component, - )}`; - return WithChannelsStateContextComponent; -}; diff --git a/package/src/contexts/chatContext/ChatContext.tsx b/package/src/contexts/chatContext/ChatContext.tsx index 79dc046ae..cfc3ef99a 100644 --- a/package/src/contexts/chatContext/ChatContext.tsx +++ b/package/src/contexts/chatContext/ChatContext.tsx @@ -3,10 +3,9 @@ import type { ImageProps } from 'react-native'; import type { AppSettingsAPIResponse, Channel, Mute, StreamChat } from 'stream-chat'; -import type { DefaultStreamChatGenerics, UnknownType } from '../../types/types'; +import type { DefaultStreamChatGenerics } from '../../types/types'; import { DEFAULT_BASE_CONTEXT_VALUE } from '../utils/defaultBaseContextValue'; -import { getDisplayName } from '../utils/getDisplayName'; import { isTestEnvironment } from '../utils/isTestEnvironment'; export type ChatContextValue< @@ -99,27 +98,3 @@ export const useChatContext = < return contextValue; }; - -/** - * @deprecated - * - * This will be removed in the next major version. - * - * Typescript currently does not support partial inference so if ChatContext - * typing is desired while using the HOC withChatContext the Props for the - * wrapped component must be provided as the first generic. - */ -export const withChatContext = < - P extends UnknownType, - StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics, ->( - Component: React.ComponentType

, -): React.ComponentType>> => { - const WithChatContextComponent = (props: Omit>) => { - const chatContext = useChatContext(); - - return ; - }; - WithChatContextComponent.displayName = `WithChatContext${getDisplayName(Component)}`; - return WithChatContextComponent; -}; diff --git a/package/src/contexts/imageGalleryContext/ImageGalleryContext.tsx b/package/src/contexts/imageGalleryContext/ImageGalleryContext.tsx index affcd8738..094ec4e1c 100644 --- a/package/src/contexts/imageGalleryContext/ImageGalleryContext.tsx +++ b/package/src/contexts/imageGalleryContext/ImageGalleryContext.tsx @@ -4,7 +4,6 @@ import type { MessageType } from '../../components/MessageList/hooks/useMessageL import type { DefaultStreamChatGenerics, UnknownType } from '../../types/types'; import { DEFAULT_BASE_CONTEXT_VALUE } from '../utils/defaultBaseContextValue'; -import { getDisplayName } from '../utils/getDisplayName'; import { isTestEnvironment } from '../utils/isTestEnvironment'; type SelectedMessage = { @@ -64,31 +63,3 @@ export const useImageGalleryContext = < return contextValue as ImageGalleryContextValue; }; - -/** - * @deprecated - * - * This will be removed in the next major version. - * - * Typescript currently does not support partial inference so if ChatContext - * typing is desired while using the HOC withImageGalleryContext the Props for the - * wrapped component must be provided as the first generic. - */ -export const withImageGalleryContext = < - P extends UnknownType, - StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics, ->( - Component: React.ComponentType

, -): React.ComponentType>> => { - const WithImageGalleryContextComponent = ( - props: Omit>, - ) => { - const imageGalleryContext = useImageGalleryContext(); - - return ; - }; - WithImageGalleryContextComponent.displayName = `WithImageGalleryContext${getDisplayName( - Component, - )}`; - return WithImageGalleryContextComponent; -}; diff --git a/package/src/contexts/keyboardContext/KeyboardContext.tsx b/package/src/contexts/keyboardContext/KeyboardContext.tsx index 5a1cd139a..f3fa23b7d 100644 --- a/package/src/contexts/keyboardContext/KeyboardContext.tsx +++ b/package/src/contexts/keyboardContext/KeyboardContext.tsx @@ -2,9 +2,6 @@ import React, { useContext } from 'react'; import { Keyboard } from 'react-native'; -import type { DefaultStreamChatGenerics } from '../../types/types'; -import { getDisplayName } from '../utils/getDisplayName'; - export type KeyboardContextValue = { dismissKeyboard: () => void; }; @@ -22,30 +19,3 @@ export const KeyboardProvider = ({ children, value }: Props) => ( ); export const useKeyboardContext = () => useContext(KeyboardContext); - -/** - * @deprecated - * - * This will be removed in the next major version. - * - * Typescript currently does not support partial inference so if ChatContext - * typing is desired while using the HOC withKeyboardContext the Props for the - * wrapped component must be provided as the first generic. - */ -export const withKeyboardContext = < - StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics, ->( - Component: React.ComponentType, -): React.ComponentType> => { - const WithKeyboardContextComponent = ( - props: Omit, - ) => { - const keyboardContext = useKeyboardContext(); - - return ; - }; - WithKeyboardContextComponent.displayName = `WithKeyboardContext${getDisplayName( - Component as React.ComponentType, - )}`; - return WithKeyboardContextComponent; -}; diff --git a/package/src/contexts/messageContext/MessageContext.tsx b/package/src/contexts/messageContext/MessageContext.tsx index e482e19f5..796ed6b7d 100644 --- a/package/src/contexts/messageContext/MessageContext.tsx +++ b/package/src/contexts/messageContext/MessageContext.tsx @@ -13,11 +13,9 @@ import type { ChannelContextValue } from '../../contexts/channelContext/ChannelC import type { MessageContentType } from '../../contexts/messagesContext/MessagesContext'; import type { DeepPartial } from '../../contexts/themeContext/ThemeContext'; import type { Theme } from '../../contexts/themeContext/utils/theme'; -import type { DefaultStreamChatGenerics, UnknownType } from '../../types/types'; +import type { DefaultStreamChatGenerics } from '../../types/types'; import { DEFAULT_BASE_CONTEXT_VALUE } from '../utils/defaultBaseContextValue'; -import { getDisplayName } from '../utils/getDisplayName'; - export type Alignment = 'right' | 'left'; export type MessageContextValue< @@ -38,46 +36,6 @@ export type MessageContextValue< groupStyles: GroupType[]; /** Handler for actions. Actions in combination with attachments can be used to build [commands](https://getstream.io/chat/docs/#channel_commands). */ handleAction: ActionHandler; - /** - * @deprecated - * @returns Promise - */ - handleCopyMessage: () => void; - /** - * @deprecated - * @returns Promise - */ - handleDeleteMessage: () => void; - /** - * @deprecated - * @returns Promise - */ - handleEditMessage: () => void; - /** - * @deprecated - * @returns Promise - */ - handleFlagMessage: () => void; - /** - * @deprecated - * @returns Promise - */ - handleQuotedReplyMessage: () => void; - /** - * @deprecated - * @returns Promise - */ - handleResendMessage: () => Promise; - /** - * @deprecated - * @returns Promise - */ - handleToggleBanUser: () => Promise; - /** - * @deprecated - * @returns Promise - */ - handleToggleMuteUser: () => Promise; handleToggleReaction: (reactionType: string) => Promise; /** Whether or not message has reactions */ hasReactions: boolean; @@ -170,29 +128,3 @@ export const useMessageContext = < return contextValue; }; - -/** - * @deprecated - * - * This will be removed in the next major version. - * - * Typescript currently does not support partial inference so if ChatContext - * typing is desired while using the HOC withMessageContext the Props for the - * wrapped component must be provided as the first generic. - */ -export const withMessageContext = < - P extends UnknownType, - StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics, ->( - Component: React.ComponentType

, -): React.ComponentType>> => { - const WithMessageContextComponent = ( - props: Omit>, - ) => { - const messageContext = useMessageContext(); - - return ; - }; - WithMessageContextComponent.displayName = `WithMessageContext${getDisplayName(Component)}`; - return WithMessageContextComponent; -}; diff --git a/package/src/contexts/messageInputContext/MessageInputContext.tsx b/package/src/contexts/messageInputContext/MessageInputContext.tsx index 5fa70fbec..d923b1509 100644 --- a/package/src/contexts/messageInputContext/MessageInputContext.tsx +++ b/package/src/contexts/messageInputContext/MessageInputContext.tsx @@ -67,7 +67,6 @@ import { FileTypes, FileUpload, ImageUpload, - UnknownType, } from '../../types/types'; import { ACITriggerSettings, @@ -92,7 +91,6 @@ import { useThreadContext } from '../threadContext/ThreadContext'; import { useTranslationContext } from '../translationContext/TranslationContext'; import { DEFAULT_BASE_CONTEXT_VALUE } from '../utils/defaultBaseContextValue'; -import { getDisplayName } from '../utils/getDisplayName'; import { isTestEnvironment } from '../utils/isTestEnvironment'; /** @@ -1468,31 +1466,3 @@ export const useMessageInputContext = < return contextValue; }; - -/** - * @deprecated - * - * This will be removed in the next major version. - * - * Typescript currently does not support partial inference so if ChatContext - * typing is desired while using the HOC withMessageInputContext the Props for the - * wrapped component must be provided as the first generic. - */ -export const withMessageInputContext = < - P extends UnknownType, - StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics, ->( - Component: React.ComponentType

, -): React.ComponentType>> => { - const WithMessageInputContextComponent = ( - props: Omit>, - ) => { - const messageInputContext = useMessageInputContext(); - - return ; - }; - WithMessageInputContextComponent.displayName = `WithMessageInputContext${getDisplayName( - Component, - )}`; - return WithMessageInputContextComponent; -}; diff --git a/package/src/contexts/messageOverlayContext/MessageOverlayContext.tsx b/package/src/contexts/messageOverlayContext/MessageOverlayContext.tsx index b5d3d3aa0..7b57ffc8b 100644 --- a/package/src/contexts/messageOverlayContext/MessageOverlayContext.tsx +++ b/package/src/contexts/messageOverlayContext/MessageOverlayContext.tsx @@ -15,7 +15,7 @@ import type { import type { OverlayReactionListProps } from '../../components/MessageOverlay/OverlayReactionList'; import type { OverlayReactionsProps } from '../../components/MessageOverlay/OverlayReactions'; import type { OverlayReactionsAvatarProps } from '../../components/MessageOverlay/OverlayReactionsAvatar'; -import type { DefaultStreamChatGenerics, UnknownType } from '../../types/types'; +import type { DefaultStreamChatGenerics } from '../../types/types'; import type { ReactionData } from '../../utils/utils'; import type { ChatContextValue } from '../chatContext/ChatContext'; import type { Alignment, MessageContextValue } from '../messageContext/MessageContext'; @@ -23,7 +23,6 @@ import type { MessagesContextValue } from '../messagesContext/MessagesContext'; import type { OwnCapabilitiesContextValue } from '../ownCapabilitiesContext/OwnCapabilitiesContext'; import { DEFAULT_BASE_CONTEXT_VALUE } from '../utils/defaultBaseContextValue'; -import { getDisplayName } from '../utils/getDisplayName'; import { isTestEnvironment } from '../utils/isTestEnvironment'; export type MessageOverlayData< @@ -117,31 +116,3 @@ export const useMessageOverlayContext = < return contextValue; }; - -/** - * @deprecated - * - * This will be removed in the next major version. - * - * Typescript currently does not support partial inference so if ChatContext - * typing is desired while using the HOC withMessageOverlayContext the Props for the - * wrapped component must be provided as the first generic. - */ -export const withMessageOverlayContext = < - P extends UnknownType, - StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics, ->( - Component: React.ComponentType

, -): React.ComponentType>> => { - const WithMessageOverlayContextComponent = ( - props: Omit>, - ) => { - const messageContext = useMessageOverlayContext(); - - return ; - }; - WithMessageOverlayContextComponent.displayName = `WithMessageOverlayContext${getDisplayName( - Component, - )}`; - return WithMessageOverlayContextComponent; -}; diff --git a/package/src/contexts/messagesContext/MessagesContext.tsx b/package/src/contexts/messagesContext/MessagesContext.tsx index 0dacf0cd9..1b37f3a92 100644 --- a/package/src/contexts/messagesContext/MessagesContext.tsx +++ b/package/src/contexts/messagesContext/MessagesContext.tsx @@ -48,7 +48,7 @@ import type { getGroupStyles } from '../../components/MessageList/utils/getGroup import type { MessageActionType } from '../../components/MessageOverlay/MessageActionListItem'; import type { OverlayReactionListProps } from '../../components/MessageOverlay/OverlayReactionList'; import type { ReplyProps } from '../../components/Reply/Reply'; -import type { DefaultStreamChatGenerics, UnknownType } from '../../types/types'; +import type { DefaultStreamChatGenerics } from '../../types/types'; import type { ReactionData } from '../../utils/utils'; import type { Alignment } from '../messageContext/MessageContext'; import type { SuggestionCommand } from '../suggestionsContext/SuggestionsContext'; @@ -56,7 +56,6 @@ import type { DeepPartial } from '../themeContext/ThemeContext'; import type { Theme } from '../themeContext/utils/theme'; import { DEFAULT_BASE_CONTEXT_VALUE } from '../utils/defaultBaseContextValue'; -import { getDisplayName } from '../utils/getDisplayName'; import { isTestEnvironment } from '../utils/isTestEnvironment'; export type MessageContentType = 'attachments' | 'files' | 'gallery' | 'quoted_reply' | 'text'; @@ -320,12 +319,6 @@ export type MessagesContextValue< * @param message */ handleBan?: (message: MessageType) => Promise; - /** - * @deprecated - * Handler to access when a block user action is invoked. - * @param message - */ - handleBlock?: (message: MessageType) => Promise; /** Handler to access when a copy message action is invoked */ handleCopy?: (message: MessageType) => Promise; /** Handler to access when a delete message action is invoked */ @@ -546,29 +539,3 @@ export const useMessagesContext = < return contextValue; }; - -/** - * @deprecated - * - * This will be removed in the next major version. - * - * Typescript currently does not support partial inference so if ChatContext - * typing is desired while using the HOC withMessagesContext the Props for the - * wrapped component must be provided as the first generic. - */ -export const withMessagesContext = < - P extends UnknownType, - StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics, ->( - Component: React.ComponentType

, -): React.ComponentType>> => { - const WithMessagesContextComponent = ( - props: Omit>, - ) => { - const messagesContext = useMessagesContext(); - - return ; - }; - WithMessagesContextComponent.displayName = `WithMessagesContext${getDisplayName(Component)}`; - return WithMessagesContextComponent; -}; diff --git a/package/src/contexts/overlayContext/OverlayContext.tsx b/package/src/contexts/overlayContext/OverlayContext.tsx index 525e9f506..2fb359179 100644 --- a/package/src/contexts/overlayContext/OverlayContext.tsx +++ b/package/src/contexts/overlayContext/OverlayContext.tsx @@ -15,7 +15,6 @@ import type { DeepPartial } from '../themeContext/ThemeContext'; import type { Theme } from '../themeContext/utils/theme'; import { DEFAULT_BASE_CONTEXT_VALUE } from '../utils/defaultBaseContextValue'; -import { getDisplayName } from '../utils/getDisplayName'; import { isTestEnvironment } from '../utils/isTestEnvironment'; export type Overlay = 'alert' | 'gallery' | 'message' | 'none'; @@ -73,14 +72,6 @@ export type OverlayProviderProps< isMyMessage?: boolean; isThreadMessage?: boolean; message?: MessageType; - /** - * @deprecated use the following instead: - * messageActions={(params) => { - * const actions = messageActions({ ...params, isMessageActionsVisible: false }); - * return actions; - * }} - */ - messageReactions?: boolean; messageTextNumberOfLines?: number; numberOfImageGalleryGridColumns?: number; openPicker?: (ref: React.RefObject) => void; @@ -98,30 +89,3 @@ export const useOverlayContext = () => { return contextValue; }; - -/** - * @deprecated - * - * This will be removed in the next major version. - * - * Typescript currently does not support partial inference so if ChatContext - * typing is desired while using the HOC withOverlayContext the Props for the - * wrapped component must be provided as the first generic. - */ -export const withOverlayContext = < - StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics, ->( - Component: React.ComponentType, -): React.ComponentType> => { - const WithOverlayContextComponent = ( - props: Omit, - ) => { - const overlayContext = useOverlayContext(); - - return ; - }; - WithOverlayContextComponent.displayName = `WithOverlayContext${getDisplayName( - Component as React.ComponentType, - )}`; - return WithOverlayContextComponent; -}; diff --git a/package/src/contexts/paginatedMessageListContext/PaginatedMessageListContext.tsx b/package/src/contexts/paginatedMessageListContext/PaginatedMessageListContext.tsx index f31542347..2247aae73 100644 --- a/package/src/contexts/paginatedMessageListContext/PaginatedMessageListContext.tsx +++ b/package/src/contexts/paginatedMessageListContext/PaginatedMessageListContext.tsx @@ -2,10 +2,9 @@ import React, { PropsWithChildren, useContext } from 'react'; import type { ChannelState } from 'stream-chat'; -import type { DefaultStreamChatGenerics, UnknownType } from '../../types/types'; +import type { DefaultStreamChatGenerics } from '../../types/types'; import { DEFAULT_BASE_CONTEXT_VALUE } from '../utils/defaultBaseContextValue'; -import { getDisplayName } from '../utils/getDisplayName'; import { isTestEnvironment } from '../utils/isTestEnvironment'; export type PaginatedMessageListContextValue< @@ -83,31 +82,3 @@ export const usePaginatedMessageListContext = < return contextValue; }; - -/** - * @deprecated - * - * This will be removed in the next major version. - * - * Typescript currently does not support partial inference so if ChatContext - * typing is desired while using the HOC withPaginatedMessageListContext the Props for the - * wrapped component must be provided as the first generic. - */ -export const withPaginatedMessageListContext = < - P extends UnknownType, - StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics, ->( - Component: React.ComponentType

, -): React.ComponentType>> => { - const WithPaginatedMessageListContextComponent = ( - props: Omit>, - ) => { - const paginatedMessageListContext = usePaginatedMessageListContext(); - - return ; - }; - WithPaginatedMessageListContextComponent.displayName = `WithPaginatedMessageListContext${getDisplayName( - Component, - )}`; - return WithPaginatedMessageListContextComponent; -}; diff --git a/package/src/contexts/suggestionsContext/SuggestionsContext.tsx b/package/src/contexts/suggestionsContext/SuggestionsContext.tsx index 5fcc0b910..613a8801a 100644 --- a/package/src/contexts/suggestionsContext/SuggestionsContext.tsx +++ b/package/src/contexts/suggestionsContext/SuggestionsContext.tsx @@ -6,10 +6,9 @@ import type { AutoCompleteSuggestionHeaderProps } from '../../components/AutoCom import type { AutoCompleteSuggestionItemProps } from '../../components/AutoCompleteInput/AutoCompleteSuggestionItem'; import type { AutoCompleteSuggestionListProps } from '../../components/AutoCompleteInput/AutoCompleteSuggestionList'; import type { Emoji } from '../../emoji-data'; -import type { DefaultStreamChatGenerics, UnknownType } from '../../types/types'; +import type { DefaultStreamChatGenerics } from '../../types/types'; import { DEFAULT_BASE_CONTEXT_VALUE } from '../utils/defaultBaseContextValue'; -import { getDisplayName } from '../utils/getDisplayName'; import { isTestEnvironment } from '../utils/isTestEnvironment'; export type SuggestionComponentType = 'command' | 'emoji' | 'mention'; @@ -148,31 +147,3 @@ export const useSuggestionsContext = < return contextValue; }; - -/** - * @deprecated - * - * This will be removed in the next major version. - * - * Typescript currently does not support partial inference so if ChatContext - * typing is desired while using the HOC withSuggestionsContext the Props for the - * wrapped component must be provided as the first generic. - */ -export const withSuggestionsContext = < - P extends UnknownType, - StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics, ->( - Component: React.ComponentType

, -): React.ComponentType>> => { - const WithSuggestionsContextComponent = ( - props: Omit>, - ) => { - const suggestionsContext = useSuggestionsContext(); - - return ; - }; - WithSuggestionsContextComponent.displayName = `WithSuggestionsContext${getDisplayName( - Component, - )}`; - return WithSuggestionsContextComponent; -}; diff --git a/package/src/contexts/threadContext/ThreadContext.tsx b/package/src/contexts/threadContext/ThreadContext.tsx index 419b70e97..7b098324a 100644 --- a/package/src/contexts/threadContext/ThreadContext.tsx +++ b/package/src/contexts/threadContext/ThreadContext.tsx @@ -3,10 +3,9 @@ import React, { PropsWithChildren, useContext } from 'react'; import type { ChannelState } from 'stream-chat'; import type { MessageType } from '../../components/MessageList/hooks/useMessageList'; -import type { DefaultStreamChatGenerics, UnknownType } from '../../types/types'; +import type { DefaultStreamChatGenerics } from '../../types/types'; import { DEFAULT_BASE_CONTEXT_VALUE } from '../utils/defaultBaseContextValue'; -import { getDisplayName } from '../utils/getDisplayName'; import { isTestEnvironment } from '../utils/isTestEnvironment'; export type ThreadContextValue< @@ -58,29 +57,3 @@ export const useThreadContext = < return contextValue; }; - -/** - * @deprecated - * - * This will be removed in the next major version. - * - * Typescript currently does not support partial inference so if ChatContext - * typing is desired while using the HOC withThreadContext the Props for the - * wrapped component must be provided as the first generic. - */ -export const withThreadContext = < - P extends UnknownType, - StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics, ->( - Component: React.ComponentType

, -): React.ComponentType>> => { - const WithThreadContextComponent = ( - props: Omit>, - ) => { - const threadContext = useThreadContext(); - - return ; - }; - WithThreadContextComponent.displayName = `WithThreadContext${getDisplayName(Component)}`; - return WithThreadContextComponent; -}; diff --git a/package/src/contexts/translationContext/TranslationContext.tsx b/package/src/contexts/translationContext/TranslationContext.tsx index 98da3624b..22aa74dc5 100644 --- a/package/src/contexts/translationContext/TranslationContext.tsx +++ b/package/src/contexts/translationContext/TranslationContext.tsx @@ -7,8 +7,6 @@ import type { Moment } from 'moment-timezone'; import type { TranslationLanguages } from 'stream-chat'; -import type { DefaultStreamChatGenerics } from '../../types/types'; -import { getDisplayName } from '../utils/getDisplayName'; import { isTestEnvironment } from '../utils/isTestEnvironment'; export const DEFAULT_USER_LANGUAGE: TranslationLanguages = 'en'; @@ -60,30 +58,3 @@ export const useTranslationContext = () => { return contextValue; }; - -/** - * @deprecated - * - * This will be removed in the next major version. - * - * Typescript currently does not support partial inference so if ChatContext - * typing is desired while using the HOC withTranslationContext the Props for the - * wrapped component must be provided as the first generic. - */ -export const withTranslationContext = < - StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics, ->( - Component: React.ComponentType, -): React.ComponentType> => { - const WithTranslationContextComponent = ( - props: Omit, - ) => { - const translationContext = useTranslationContext(); - - return ; - }; - WithTranslationContextComponent.displayName = `WithTranslationContext${getDisplayName( - Component as React.ComponentType, - )}`; - return WithTranslationContextComponent; -}; diff --git a/package/src/contexts/typingContext/TypingContext.tsx b/package/src/contexts/typingContext/TypingContext.tsx index 4221d36ac..ecdd8a734 100644 --- a/package/src/contexts/typingContext/TypingContext.tsx +++ b/package/src/contexts/typingContext/TypingContext.tsx @@ -2,10 +2,9 @@ import React, { PropsWithChildren, useContext } from 'react'; import type { ChannelState } from 'stream-chat'; -import type { DefaultStreamChatGenerics, UnknownType } from '../../types/types'; +import type { DefaultStreamChatGenerics } from '../../types/types'; import { DEFAULT_BASE_CONTEXT_VALUE } from '../utils/defaultBaseContextValue'; -import { getDisplayName } from '../utils/getDisplayName'; import { isTestEnvironment } from '../utils/isTestEnvironment'; export type TypingContextValue< @@ -44,29 +43,3 @@ export const useTypingContext = < return contextValue; }; - -/** - * @deprecated - * - * This will be removed in the next major version. - * - * Typescript currently does not support partial inference so if ChatContext - * typing is desired while using the HOC withTypingContext the Props for the - * wrapped component must be provided as the first generic. - */ -export const withTypingContext = < - P extends UnknownType, - StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics, ->( - Component: React.ComponentType

, -): React.ComponentType>> => { - const WithTypingContextComponent = ( - props: Omit>, - ) => { - const typingContext = useTypingContext(); - - return ; - }; - WithTypingContextComponent.displayName = `WithTypingContext${getDisplayName(Component)}`; - return WithTypingContextComponent; -};