Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently country code in the input field can't be deleted on a controlled or uncontrolled component
#197
If the user deletes the numbers of the country code and only has "+" in value. updateFlagFromNumber will populate the flag to the default country which in turn will populate the input field with the default code.
I've removed the setting a default country code because the default country is always the currently selected flag and seems to be redundant (Let me know if i'm wrong ).
Here is where default country is set: https://github.com/MatthewAnstey/react-intl-tel-input/blob/c731a6b913b5d8852d886c4b0e35ae7cbc7c37b7/src/components/IntlTelInputApp.js#L241 on every flag change, making it redundant. I think its redundant because its the same as the currently selected flag.
Although this fixes the bug. I think we should decide what default country was suppose to do (apart from obviously setting the default country). I'm guessing it was meant to update the flag to default flag when just '+' was typed? If this is case I think we should remove https://github.com/MatthewAnstey/react-intl-tel-input/blob/c731a6b913b5d8852d886c4b0e35ae7cbc7c37b7/src/components/IntlTelInputApp.js#L241 and look at a different fix for this.