-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathphoneInputProps.ts
54 lines (49 loc) · 1.65 KB
/
phoneInputProps.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import React, { Ref, ReactNode } from 'react';
import { TextInputProps } from 'react-native';
import { ICountry } from './country';
import { ICountryCca2 } from './countryCca2';
import { ILanguage } from './language';
import { ITheme } from './theme';
import { IModalStyles } from './modalStyles';
import { IPhoneInputStyles } from './phoneInputStyles';
import { IPhoneInputRef } from './phoneInputRef';
interface BasePhoneInput extends TextInputProps {
language?: ILanguage;
placeholder?: string;
placeholderTextColor?: string;
selectionColor?: string;
phoneInputStyles?: IPhoneInputStyles;
modalStyles?: IModalStyles;
theme?: ITheme;
disabled?: boolean;
modalDisabled?: boolean;
modalHeight?: number | string;
defaultCountry?: ICountryCca2;
defaultValue?: string;
customMask?: Array<string>;
showOnly?: Array<ICountryCca2>;
excludedCountries?: Array<ICountryCca2>;
popularCountries?: Array<ICountryCca2>;
modalSearchInputPlaceholder?: string;
modalSearchInputPlaceholderTextColor?: string;
modalSearchInputSelectionColor?: string;
modalNotFoundCountryMessage?: string;
customCaret?: ReactNode;
}
interface IPhoneInputPropsWithoutRef extends BasePhoneInput {
value: string;
onChangePhoneNumber: (phoneNumber: string) => void;
selectedCountry: ICountry | undefined | null;
onChangeSelectedCountry: (country: ICountry) => void;
ref?: never;
}
interface IPhoneInputPropsWithRef extends BasePhoneInput {
value?: never;
onChangePhoneNumber?: never;
selectedCountry?: never;
onChangeSelectedCountry?: never;
ref: Ref<IPhoneInputRef>;
}
export type PhoneInputProps =
| IPhoneInputPropsWithRef
| IPhoneInputPropsWithoutRef;