1
- import { Str } from 'expensify-common' ;
2
1
import React from 'react' ;
3
2
import { View } from 'react-native' ;
4
3
import { useOnyx } from 'react-native-onyx' ;
@@ -9,8 +8,6 @@ import useLocalize from '@hooks/useLocalize';
9
8
import useThemeStyles from '@hooks/useThemeStyles' ;
10
9
import * as LoginUtils from '@libs/LoginUtils' ;
11
10
import type { PlatformStackScreenProps } from '@libs/Navigation/PlatformStackNavigation/types' ;
12
- import * as PhoneNumberUtils from '@libs/PhoneNumber' ;
13
- import * as ValidationUtils from '@libs/ValidationUtils' ;
14
11
import type { SettingsNavigatorParamList } from '@navigation/types' ;
15
12
import CONST from '@src/CONST' ;
16
13
import ONYXKEYS from '@src/ONYXKEYS' ;
@@ -43,17 +40,12 @@ function GetPhysicalCardPhone({
43
40
44
41
const errors : OnValidateResult = { } ;
45
42
46
- if ( ! ValidationUtils . isRequiredFulfilled ( phoneNumberToValidate ) ) {
43
+ if ( ! LoginUtils . validateNumber ( phoneNumberToValidate ) ) {
44
+ errors . phoneNumber = translate ( 'common.error.phoneNumber' ) ;
45
+ } else if ( ! phoneNumberToValidate ) {
47
46
errors . phoneNumber = translate ( 'common.error.fieldRequired' ) ;
48
47
}
49
48
50
- const phoneNumberWithCountryCode = LoginUtils . appendCountryCode ( phoneNumberToValidate ) ;
51
- const parsedPhoneNumber = PhoneNumberUtils . parsePhoneNumber ( phoneNumberWithCountryCode ) ;
52
-
53
- if ( ! parsedPhoneNumber . possible || ! Str . isValidE164Phone ( phoneNumberWithCountryCode . slice ( 0 ) ) ) {
54
- errors . phoneNumber = translate ( 'bankAccount.error.phoneNumber' ) ;
55
- }
56
-
57
49
return errors ;
58
50
} ;
59
51
0 commit comments