From a790fc09dae0fc4ca61823bfcdecf6341d591c45 Mon Sep 17 00:00:00 2001 From: Anton Arnautov Date: Fri, 6 Oct 2023 16:25:57 +0200 Subject: [PATCH] Remove unused Emoji component --- src/components/Channel/Channel.tsx | 4 +--- src/components/Channel/__tests__/Channel.test.js | 4 +--- src/context/EmojiContext.tsx | 12 +----------- 3 files changed, 3 insertions(+), 17 deletions(-) diff --git a/src/components/Channel/Channel.tsx b/src/components/Channel/Channel.tsx index 28918da85c..bf53f5fade 100644 --- a/src/components/Channel/Channel.tsx +++ b/src/components/Channel/Channel.tsx @@ -142,8 +142,7 @@ export type ChannelProps< dragAndDropWindow?: boolean; /** Custom UI component to override default edit message input, defaults to and accepts same props as: [EditMessageForm](https://github.com/GetStream/stream-chat-react/blob/master/src/components/MessageInput/EditMessageForm.tsx) */ EditMessageInput?: ComponentContextValue['EditMessageInput']; - /** Custom UI component to override default `NimbleEmoji` from `emoji-mart` */ - Emoji?: EmojiContextValue['Emoji']; + /** Custom prop to override default `facebook.json` emoji data set from `emoji-mart` */ emojiData?: EmojiMartData; /** Custom UI component for emoji button in input, defaults to and accepts same props as: [EmojiIconSmall](https://github.com/GetStream/stream-chat-react/blob/master/src/components/MessageInput/icons.tsx) */ @@ -1000,7 +999,6 @@ const ChannelInner = < const emojiContextValue: EmojiContextValue = useMemo( () => ({ - Emoji: props.Emoji, emojiConfig, EmojiIndex: props.EmojiIndex, EmojiPicker: props.EmojiPicker, diff --git a/src/components/Channel/__tests__/Channel.test.js b/src/components/Channel/__tests__/Channel.test.js index 6cd9484ce1..3805de2af7 100644 --- a/src/components/Channel/__tests__/Channel.test.js +++ b/src/components/Channel/__tests__/Channel.test.js @@ -397,9 +397,8 @@ describe('Channel', () => { emojis: {}, }; const CustomEmojiPicker = () =>
; - const CustomEmoji = () => ; - renderComponent({ Emoji: CustomEmoji, emojiData, EmojiPicker: CustomEmojiPicker }, (ctx) => { + renderComponent({ emojiData, EmojiPicker: CustomEmojiPicker }, (ctx) => { context = ctx; }); @@ -407,7 +406,6 @@ describe('Channel', () => { expect(context).toBeInstanceOf(Object); expect(context.emojiConfig.emojiData).toBe(emojiData); expect(context.EmojiPicker).toBe(CustomEmojiPicker); - expect(context.Emoji).toBe(CustomEmoji); }); }); diff --git a/src/context/EmojiContext.tsx b/src/context/EmojiContext.tsx index 838e40f4e1..7b2ac4ecf0 100644 --- a/src/context/EmojiContext.tsx +++ b/src/context/EmojiContext.tsx @@ -6,7 +6,6 @@ import type { Data as EmojiMartData, EmojiSheetSize, NimbleEmojiIndex, - NimbleEmojiProps, NimblePickerProps, } from 'emoji-mart'; @@ -44,13 +43,10 @@ export type EmojiConfig = { export type EmojiContextValue = { emojiConfig: EmojiConfig; - Emoji?: React.ComponentType; EmojiIndex?: NimbleEmojiIndex; EmojiPicker?: React.ComponentType; }; -const DefaultEmoji = React.lazy(() => import('./DefaultEmoji')); - const DefaultEmojiPicker = React.lazy(() => import('./DefaultEmojiPicker')); export const EmojiContext = React.createContext(undefined); @@ -61,15 +57,9 @@ export const EmojiProvider = ({ }: PropsWithChildren<{ value: EmojiContextValue; }>) => { - const { - Emoji = DefaultEmoji, - emojiConfig, - EmojiIndex = DefaultEmojiIndex, - EmojiPicker = DefaultEmojiPicker, - } = value; + const { emojiConfig, EmojiIndex = DefaultEmojiIndex, EmojiPicker = DefaultEmojiPicker } = value; const emojiContextValue: Required = { - Emoji, emojiConfig, EmojiIndex, EmojiPicker,