Skip to content

Conversation

MacKentoch
Copy link

@MacKentoch MacKentoch commented Sep 29, 2018

I was using a custom country picker (not sure it happens in other cases, but fix is good for all).

I had a bug in case when user deletes (rather than enters his phone number) pre-rendered country code: dailCode of undefined error.

lib/index.js Outdated
@@ -76,13 +76,16 @@ export default class PhoneInput extends Component {
key: index,
image: Flags.get(country.iso2),
label: country.name,
dialCode: `+${country.dialCode}`,
dialCode: `+${(country && country.dialCode) || ''}`,
Copy link
Contributor

@jling90 jling90 Oct 8, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this line change necessary? PhoneNumber.getCountryDataByCode returns an array of objects. If country is a null-type it's going to crash on the line above anyway.

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

Successfully merging this pull request may close these issues.

2 participants