Skip to content

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

Open
@sohaib57

Description

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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions