From 8ea57553455a3177f51f625e045ca9cf6730d408 Mon Sep 17 00:00:00 2001 From: Danish Ahmed Mirza Date: Tue, 28 Jun 2022 01:02:34 +0530 Subject: [PATCH] Add searchbar for Emojis --- app/containers/EmojiPicker/EmojiCategory.tsx | 2 +- app/containers/EmojiPicker/Footer.tsx | 4 +- app/containers/EmojiPicker/index.tsx | 9 +- app/containers/EmojiPicker/interfaces.ts | 7 +- app/containers/MessageBox/EmojiSearchbar.tsx | 117 ++++++++++++++++++ app/containers/MessageBox/constants.ts | 1 + app/containers/MessageBox/index.tsx | 120 +++++++++++++++---- app/i18n/locales/en.json | 1 + 8 files changed, 232 insertions(+), 29 deletions(-) create mode 100644 app/containers/MessageBox/EmojiSearchbar.tsx diff --git a/app/containers/EmojiPicker/EmojiCategory.tsx b/app/containers/EmojiPicker/EmojiCategory.tsx index f5fed80de..fc8188982 100644 --- a/app/containers/EmojiPicker/EmojiCategory.tsx +++ b/app/containers/EmojiPicker/EmojiCategory.tsx @@ -47,7 +47,7 @@ const EmojiCategory = React.memo(({ baseUrl, onEmojiSelected, emojis, width, tab return ( (item && item.isCustom && item.content) || item} data={emojis} diff --git a/app/containers/EmojiPicker/Footer.tsx b/app/containers/EmojiPicker/Footer.tsx index 1d0a139c7..cd602b621 100644 --- a/app/containers/EmojiPicker/Footer.tsx +++ b/app/containers/EmojiPicker/Footer.tsx @@ -7,11 +7,11 @@ import { CustomIcon } from '../CustomIcon'; import styles from './styles'; import { IFooterProps } from './interfaces'; -const Footer = React.memo(({ onBackspacePressed }: IFooterProps) => { +const Footer = React.memo(({ onSearchPressed, onBackspacePressed }: IFooterProps) => { const { colors } = useTheme(); return ( - console.log('Search!')} style={styles.footerButtonsContainer}> + diff --git a/app/containers/EmojiPicker/index.tsx b/app/containers/EmojiPicker/index.tsx index 2e563c927..06075305a 100644 --- a/app/containers/EmojiPicker/index.tsx +++ b/app/containers/EmojiPicker/index.tsx @@ -56,7 +56,7 @@ const EmojiPicker = React.memo(({ onItemClicked, tabEmojiStyle }: IEmojiPickerPr const content = emoji; _addFrequentlyUsed({ content, isCustom: false }); const shortname = `:${emoji}:`; - onItemClicked(EventTypes.EMOJI_PRESSED, shortnameToUnicode(shortname), shortname); + onItemClicked(EventTypes.EMOJI_PRESSED, shortnameToUnicode(shortname)); } } catch (e) { log(e); @@ -131,8 +131,6 @@ const EmojiPicker = React.memo(({ onItemClicked, tabEmojiStyle }: IEmojiPickerPr ); }; - const onBackspacePressed = () => onItemClicked(EventTypes.BACKSPACE_PRESSED); - if (!show) { return null; } @@ -154,7 +152,10 @@ const EmojiPicker = React.memo(({ onItemClicked, tabEmojiStyle }: IEmojiPickerPr : renderCategory(tab.category, i, tab.tabLabel, tabsCount) )} -