Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The phone is not populating from the Chrome address book when the country prop is passed #704

Open
sohaib57 opened this issue Dec 10, 2024 · 0 comments

Comments

@sohaib57
Copy link

Thanks for such an excellent library!

When I select an email, I’m trying to populate the phone number as well, but it isn’t working. If I comment out the country prop, a random country is displayed, but the email selection then works to pre-populate the phone. Is there a solution to make it work with the country? It would really help save the user time by avoiding the need to manually select the country or enter the country code if there is no phone in the address book?

   <PhoneInput
              country={
                values.phoneDefaultCountry ? values.phoneDefaultCountry : values.customerRegion === 'GBP' ? 'gb' : 'us'
              }
              inputClass='pl-4 py-6 !w-full outline-none text-gray-600 font-light'
              containerClass='phone-input-container'
              specialLabel=''
              value={values.phone}
              onChange={(value: any) => {
                setFieldValue('phone', value)
                console.log(value, 'value phone')
              }}
              preferredCountries={['gb', 'us']}
              inputProps={{
                name: 'phone',
                required: true,
                autoComplete: 'tel'
              }}
            />

On selection of email phone is not populating:
Screenshot (32)

When I removed the country prop, the number populates correctly, but the country shows as random. However, when the phone number populates, it gives me the correct country that the code belongs to, which is correct

Screenshot (33)

@sohaib57 sohaib57 changed the title Phone is not populating from chrome address book if country prop is passed The phone is not populating from the Chrome address book when the country prop is passed Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant