Skip to content

Commit

Permalink
cleanup: don't run through containsOnlyEmojis for an empty string
Browse files Browse the repository at this point in the history
  • Loading branch information
hannojg committed Jul 4, 2024
1 parent a84f68e commit 0cf6951
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/hooks/useMarkdownStyle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ const defaultEmptyArray: Array<keyof MarkdownStyle> = [];

function useMarkdownStyle(message: string | null = null, excludeStyles: Array<keyof MarkdownStyle> = defaultEmptyArray): MarkdownStyle {
const theme = useTheme();
const emojiFontSize = containsOnlyEmojis(message ?? '') ? variables.fontSizeOnlyEmojis : variables.fontSizeNormal;
const hasMessageOnlyEmojis = message != null && message.length > 0 && containsOnlyEmojis(message);
const emojiFontSize = hasMessageOnlyEmojis ? variables.fontSizeOnlyEmojis : variables.fontSizeNormal;

// this map is used to reset the styles that are not needed - passing undefined value can break the native side
const nonStylingDefaultValues: Record<string, string | number> = useMemo(
Expand Down

0 comments on commit 0cf6951

Please sign in to comment.