PhoneInput: remove unnecessary handleCountryChange function

This commit is contained in:
Alex Gleason 2022-07-13 18:10:16 -05:00
parent ba98a8e82f
commit 0591bf72a5
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
1 changed files with 1 additions and 5 deletions

View File

@ -24,10 +24,6 @@ const PhoneInput: React.FC<IPhoneInput> = (props) => {
const [countryCode, setCountryCode] = useState<CountryCode>(defaultCountryCode); const [countryCode, setCountryCode] = useState<CountryCode>(defaultCountryCode);
const [nationalNumber, setNationalNumber] = useState<string>(''); const [nationalNumber, setNationalNumber] = useState<string>('');
const handleCountryChange = (code: CountryCode) => {
setCountryCode(code);
};
const handleChange: React.ChangeEventHandler<HTMLInputElement> = ({ target }) => { const handleChange: React.ChangeEventHandler<HTMLInputElement> = ({ target }) => {
// HACK: AsYouType is not meant to be used this way. But it works! // HACK: AsYouType is not meant to be used this way. But it works!
const asYouType = new AsYouType({ defaultCallingCode: countryCode }); const asYouType = new AsYouType({ defaultCallingCode: countryCode });
@ -64,7 +60,7 @@ const PhoneInput: React.FC<IPhoneInput> = (props) => {
<HStack alignItems='center'> <HStack alignItems='center'>
<CountryCodeDropdown <CountryCodeDropdown
countryCode={countryCode} countryCode={countryCode}
onChange={handleCountryChange} onChange={setCountryCode}
/> />
<Input <Input