Skip to content

Commit

Permalink
feat(intl-phone-input): move onPaste
Browse files Browse the repository at this point in the history
  • Loading branch information
Kafturov Roman authored and Kafturov Roman committed Jul 27, 2023
1 parent 9339739 commit e83c2e2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/intl-phone-input/src/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,8 @@ export const IntlPhoneInput = forwardRef<HTMLInputElement, IntlPhoneInputProps>(
};

const handlePaste: React.ClipboardEventHandler<HTMLInputElement> = (event) => {
inputProps?.onPaste?.(event);

event.preventDefault();
const text = event.clipboardData?.getData('Text');

Expand All @@ -461,7 +463,6 @@ export const IntlPhoneInput = forwardRef<HTMLInputElement, IntlPhoneInputProps>(
const resultNumber = preparedNumber.substring(0, maxPhoneLength + 1);

if (resultNumber) {
inputProps?.onPaste?.(event);
setCountryIso2(targetCountry ? targetCountry.iso2 : undefined);
changePhone(addCountryCode(resultNumber));
}
Expand Down

0 comments on commit e83c2e2

Please sign in to comment.