From 0f26898a67ecfb17258abf0a3bf5c46d6a479f7d Mon Sep 17 00:00:00 2001 From: Rafael Date: Tue, 3 Aug 2021 13:03:50 -0300 Subject: [PATCH] remove changes to OptionsList --- src/CONST.js | 1 + src/libs/OptionsListUtils.js | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/CONST.js b/src/CONST.js index 1856c35f03a17..7899e918f19b8 100755 --- a/src/CONST.js +++ b/src/CONST.js @@ -365,6 +365,7 @@ const CONST = { REGEX: { US_PHONE: /^\+1\d{10}$/, + DIGITS_AND_PLUS: /^\+?[0-9]*$/, PHONE_E164_PLUS: /^\+?[1-9]\d{1,14}$/, NON_ALPHA_NUMERIC: /[^A-Za-z0-9+]/g, PO_BOX: /\b[P|p]?(OST|ost)?\.?\s*[O|o|0]?(ffice|FFICE)?\.?\s*[B|b][O|o|0]?[X|x]?\.?\s+[#]?(\d+)\b/, diff --git a/src/libs/OptionsListUtils.js b/src/libs/OptionsListUtils.js index b02ab906b00e0..399d39572be75 100644 --- a/src/libs/OptionsListUtils.js +++ b/src/libs/OptionsListUtils.js @@ -667,6 +667,10 @@ function getHeaderMessage(hasSelectableOptions, hasUserToInvite, searchValue, ma return translate(preferredLocale, 'messages.maxParticipantsReached'); } + if (searchValue && CONST.REGEX.DIGITS_AND_PLUS.test(searchValue) && !Str.isValidPhone(searchValue)) { + return translate(preferredLocale, 'messages.noPhoneNumber'); + } + if (!hasSelectableOptions && !hasUserToInvite) { if (/^\d+$/.test(searchValue)) { return translate(preferredLocale, 'messages.noPhoneNumber');