How do I remove the international option from the select options in react-phone-number-input
package? I am trying to limit the countries to only six. I have added the defaultCountry
and countries
prop but it still allows for other countries' phone numbers to be typed in. Here is how I am using it:
<PhoneInput
placeholder={placeholder}
name={name}
value={value}
onChange={onValueChange}
onBlur={handleInputBlur}
onFocus={handleInputFocus}
defaultCountry={country}
countries={["NG", "MG", "SC", "KM", "BW", "MR"]}
/>
Here is how it shows up with the international option included without being specified in the props:
How do I remove the international option.
Thank you
CodePudding user response:
It is mentioned in the documentary
defaultCountry: string? — If defaultCountry is specified then the phone number can be input both in "international" format and "national" format. A phone number that's being input in "national" format will be parsed as a phone number belonging to the defaultCountry. Must be a supported country code. Example: defaultCountry="US".
SRC: https://www.npmjs.com/package/react-phone-number-input
<PhoneInput
placeholder={placeholder}
name={name}
value={value}
onChange={onValueChange}
onBlur={handleInputBlur}
onFocus={handleInputFocus}
defaultCountry={US}//