catamphetamine / react-phone-number-input

React component for international phone number input

Home Page:http://catamphetamine.gitlab.io/react-phone-number-input/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dial code getting added to input when clearing leading "+" sign

manesid opened this issue · comments

Description:

When using countryCallingCodeEditable={false} to prevent editing of the country calling code, attempting to clear the leading "+" sign still results in the code being added back to the input.

Steps to Reproduce:

  1. Set countryCallingCodeEditable={false} on the react-phone-number-input component.
  2. Focus on the input field and move the cursor till + sign
  3. Try to clear the + sign using backspace

Expected Behavior:

  • The country calling code should not get added to the input

Actual Behavior:

  • The country calling code is unexpectedly inserted back into the input field.

Code

<PhoneInput
  international
  countryCallingCodeEditable={false}
  defaultCountry="RU"
  value={value}
  onChange={setValue}/>

Additional Information
The issue can be reproduced on https://catamphetamine.gitlab.io/react-phone-number-input/ Force international format section's 2nd example

React-Phone-Number-Input.mp4

Published react-phone-number-input@3.3.10 with a fix.