Skip to content

Commit

Permalink
Fix input value on select
Browse files Browse the repository at this point in the history
Signed-off-by: Artyom Vancyan <[email protected]>
  • Loading branch information
ArtyomVancyan committed Dec 6, 2023
1 parent 5e71f9a commit bbf07ce
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@ const PhoneInput = ({
suffixIcon={null}
value={selectValue}
open={disableDropdown ? false : undefined}
onSelect={(selectedOption, {key: mask}) => {
onSelect={(selectedOption, {key}) => {
const [_, mask] = key.split("_");
if (selectValue === selectedOption) return;
const selectedCountryCode = selectedOption.slice(0, 2);
const formattedNumber = displayFormat(cleanInput(mask, mask).join(""));
Expand All @@ -241,8 +242,8 @@ const PhoneInput = ({
>
{countriesList.map(([iso, name, dial, mask]) => (
<Select.Option
key={iso + mask}
value={iso + dial}
key={`${iso}_${mask}`}
label={<div className={`flag ${iso}`}/>}
children={<div className="ant-phone-input-select-item">
<div className={`flag ${iso}`}/>
Expand Down

0 comments on commit bbf07ce

Please sign in to comment.