DefinitelyTyped/types/react-phone-number-input/react-phone-number-input-tests.tsx
jlismore 545837cb3e
Update phone-input props (#41957)
Replace oudated props
Add jsdoc help to most functions
Update util function types
2020-01-30 13:13:59 -08:00

41 lines
1.1 KiB
TypeScript

import * as React from 'react';
import PhoneInput from 'react-phone-number-input';
const test1 = (
<PhoneInput
value={'+64271231234'}
onChange={(value: string) => {
console.log(value);
}}
displayInitialValueAsLocalNumber={false}
disabled={false}
autoComplete="tel"
defaultCountry="NZ"
countries={['NZ', 'US', 'FR']}
placeholder="Place holder"
>
<div>panel 1</div>
<div>panel 2</div>
<div>panel 3</div>
</PhoneInput>
);
const InputComponent = React.forwardRef<HTMLInputElement, React.InputHTMLAttributes<HTMLInputElement>>((props, ref) => (
<input ref={ref} {...props} />
));
const test2 = (
<PhoneInput
value={'+64271231234'}
onChange={(value: string) => {
console.log(value);
}}
addInternationalOption
countryOptionsOrder={['US', 'CA', 'AU', '|', '...']}
disabled
inputComponent={InputComponent}
numberInputProps={{ type: 'tel' }}
smartCaret={false}
/>
);