validate phone number based on country

zio/stable
RonyVidaur 2024-02-03 21:54:37 -06:00
parent 15e90356e7
commit 6f228a598e
1 changed files with 5 additions and 4 deletions

View File

@ -42,10 +42,11 @@ export function Step2({
const {isMobile} = useWebMediaQueries() const {isMobile} = useWebMediaQueries()
const onPressRequest = React.useCallback(() => { const onPressRequest = React.useCallback(() => {
if ( const phoneNumber = parsePhoneNumber(
uiState.verificationPhone.length >= 9 && uiState.verificationPhone,
parsePhoneNumber(uiState.verificationPhone, uiState.phoneCountry) uiState.phoneCountry,
) { );
if (phoneNumber.isValid()) {
requestVerificationCode({uiState, uiDispatch, _}) requestVerificationCode({uiState, uiDispatch, _})
} else { } else {
uiDispatch({ uiDispatch({