From 95b68fbfa8fffee2c32710b415f2b6bd010e0823 Mon Sep 17 00:00:00 2001 From: Sachin Chavda Date: Fri, 23 May 2025 15:13:45 +0530 Subject: [PATCH] fix iOS emojis cut-off --- src/components/AccountSwitcher.tsx | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/components/AccountSwitcher.tsx b/src/components/AccountSwitcher.tsx index d3bfa1930341..59f74dcde6b8 100644 --- a/src/components/AccountSwitcher.tsx +++ b/src/components/AccountSwitcher.tsx @@ -13,6 +13,7 @@ import {clearDelegatorErrors, connect, disconnect} from '@libs/actions/Delegate' import {close} from '@libs/actions/Modal'; import {getLatestError} from '@libs/ErrorUtils'; import {getPersonalDetailByEmail} from '@libs/PersonalDetailsUtils'; +import TextWithEmojiFragment from '@pages/home/report/comment/TextWithEmojiFragment'; import variables from '@styles/variables'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; @@ -53,6 +54,8 @@ function AccountSwitcher({isScreenFocused}: AccountSwitcherProps) { const isActingAsDelegate = !!account?.delegatedAccess?.delegate; const canSwitchAccounts = delegators.length > 0 || isActingAsDelegate; + const displayName = currentUserPersonalDetails?.displayName ?? ''; + const doesDisplayNameContainEmojis = new RegExp(CONST.REGEX.EMOJIS, CONST.REGEX.EMOJIS.flags.concat('g')).test(displayName); const {shouldShowProductTrainingTooltip, renderProductTrainingTooltip, hideProductTrainingTooltip} = useProductTrainingContext( CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.ACCOUNT_SWITCHER, @@ -189,12 +192,21 @@ function AccountSwitcher({isScreenFocused}: AccountSwitcherProps) { /> - - {currentUserPersonalDetails?.displayName} - + {doesDisplayNameContainEmojis ? ( + + + + ) : ( + + {displayName} + + )} {!!canSwitchAccounts && (