diff --git a/src/components/auth/CountryCodeInput.tsx b/src/components/auth/CountryCodeInput.tsx index b527e726c..4a735b417 100644 --- a/src/components/auth/CountryCodeInput.tsx +++ b/src/components/auth/CountryCodeInput.tsx @@ -58,16 +58,11 @@ const CountryCodeInput: FC = ({ } }, [phoneCodeList, updateFilter]); - const handleChange = useCallback((e: React.SyntheticEvent) => { - const { countryCode } = (e.currentTarget.firstElementChild as HTMLDivElement).dataset; - const country = phoneCodeList.find((c) => c.countryCode === countryCode); - - if (country) { - onChange(country); - } + const handleChange = useCallback((country: ApiCountryCode) => { + onChange(country); setTimeout(() => updateFilter(undefined), MENU_HIDING_DURATION); - }, [phoneCodeList, onChange, updateFilter]); + }, [onChange, updateFilter]); const handleInput = useCallback((e: React.FormEvent) => { updateFilter(e.currentTarget.value); @@ -141,11 +136,10 @@ const CountryCodeInput: FC = ({ {filteredList .map((country: ApiCountryCode) => ( handleChange(country)} > - {renderText(isoToEmoji(country.iso2), ['hq_emoji'])} {country.name || country.defaultName} {country.countryCode}