Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/components/Composer/implementation/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,13 @@ function Composer({
ref,
...props
}: ComposerProps) {
const textContainsOnlyEmojis = useMemo(() => containsOnlyEmojis(Parser.htmlToText(Parser.replace(value ?? ''))), [value]);
const textContainsOnlyEmojis = useMemo(() => {
if (!value) {
return false;
}
return containsOnlyEmojis(Parser.htmlToText(Parser.replace(value)));
}, [value]);

const theme = useTheme();
const styles = useThemeStyles();
const session = useSession();
Expand Down
4 changes: 4 additions & 0 deletions src/libs/EmojiUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,10 @@ function isFirstLetterEmoji(message: string): boolean {
* Validates that this message contains only emojis
*/
function containsOnlyEmojis(message: string): boolean {
if (!message) {
return false;
}

const trimmedMessage = Str.replaceAll(message.replaceAll(' ', ''), '\n', '');
const match = trimmedMessage.match(CONST.REGEX.ALL_EMOJIS);

Expand Down
Loading