Skip to content

Commit

Permalink
🤖 Merge PR DefinitelyTyped#55820 [react-phone-number-input] Add the m…
Browse files Browse the repository at this point in the history
…issing countryCallingCodeEditable prop to PhoneInputProps by @anddon

* Add the missing countryCallingCodeEditable prop to PhoneInputProps

* Add a test to include the countryCallingCodeEditable prop
  • Loading branch information
anddon committed Sep 16, 2021
1 parent cda00ce commit e49422a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
6 changes: 6 additions & 0 deletions types/react-phone-number-input/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,12 @@ export interface PhoneInputProps extends Omit<React.InputHTMLAttributes<string>,
* set `useNationalFormatForDefaultCountryValue` property to `true`.
*/
useNationalFormatForDefaultCountryValue?: boolean;
/**
* If set to false, and international is true, then users won't be able
* to erase the "country calling part" of a phone number in the <input/>.
* @default true
*/
countryCallingCodeEditable?: boolean;
}

export default class PhoneInput extends React.Component<PhoneInputProps, object> {}
11 changes: 11 additions & 0 deletions types/react-phone-number-input/test/react-phone-number-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,14 @@ const test3 = (
flagComponent={(props: {country: string, flagUrl: string}) => <span>country: {props.country}, flagUrl: {props.flagUrl}</span>}
/>
);

const test4 = (
<PhoneInput
value="+12345678901"
onChange={(value: string) => {
console.log(value);
}}
international
countryCallingCodeEditable={false}
/>
);

0 comments on commit e49422a

Please sign in to comment.