Skip to content

Commit 3f57c0a

Browse files
authored
Merge pull request Expensify#83158 from truph01/fix/82487
fix: Character limit error is not shown for sanskrit characters
2 parents 90d1750 + 745165c commit 3f57c0a

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/pages/settings/Wallet/ImportTransactionsCardNamePage.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import useThemeStyles from '@hooks/useThemeStyles';
1313
import {setImportTransactionCardName} from '@libs/actions/ImportSpreadsheet';
1414
import {addErrorMessage} from '@libs/ErrorUtils';
1515
import Navigation from '@libs/Navigation/Navigation';
16+
import {isValidInputLength} from '@libs/ValidationUtils';
1617
import CONST from '@src/CONST';
1718
import ONYXKEYS from '@src/ONYXKEYS';
1819
import INPUT_IDS from '@src/types/form/ImportTransactionsForm';
@@ -34,8 +35,10 @@ function ImportTransactionsCardNamePage() {
3435
const errors: FormInputErrors<typeof ONYXKEYS.FORMS.IMPORT_TRANSACTIONS_FORM> = {};
3536
const name = values.cardDisplayName.trim();
3637

37-
if ([...name].length > CONST.TITLE_CHARACTER_LIMIT) {
38-
addErrorMessage(errors, 'cardDisplayName', translate('common.error.characterLimitExceedCounter', [...name].length, CONST.TITLE_CHARACTER_LIMIT));
38+
const {isValid, byteLength} = isValidInputLength(name, CONST.TITLE_CHARACTER_LIMIT);
39+
40+
if (!isValid) {
41+
addErrorMessage(errors, 'cardDisplayName', translate('common.error.characterLimitExceedCounter', byteLength, CONST.TITLE_CHARACTER_LIMIT));
3942
}
4043

4144
return errors;

0 commit comments

Comments
 (0)