diff --git a/package.json b/package.json index 63d7e00..33dba63 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "0.3.2", + "version": "0.3.3", "name": "antd-phone-input", "description": "Advanced, highly customizable phone input component for Ant Design.", "keywords": [ diff --git a/src/index.tsx b/src/index.tsx index f00bda8..6aa7c78 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -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("")); @@ -241,8 +242,8 @@ const PhoneInput = ({ > {countriesList.map(([iso, name, dial, mask]) => ( } children={