react-native-international-phone-number 0.6.1 → 0.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -0
- package/lib/index.js +17 -11
- package/lib/interfaces/phoneInputProps.ts +10 -20
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
- [Customizing Lib](#customizing-lib)
|
|
59
59
|
- [Dark Mode](#dark-mode)
|
|
60
60
|
- [Custom Lib Styles](#custom-lib-styles)
|
|
61
|
+
- [Custom Placeholders/Messages](#custom-placeholdersmessages)
|
|
61
62
|
- [Custom Modal Height](#custom-modal-height)
|
|
62
63
|
- [Country Modal Disabled Mode](#country-modal-disabled-mode)
|
|
63
64
|
- [Phone Input Disabled Mode](#phone-input-disabled-mode)
|
|
@@ -508,6 +509,19 @@ export default function App() {
|
|
|
508
509
|
...
|
|
509
510
|
```
|
|
510
511
|
|
|
512
|
+
- ### Custom Placeholders/Messages:
|
|
513
|
+
|
|
514
|
+
```jsx
|
|
515
|
+
...
|
|
516
|
+
<PhoneInput
|
|
517
|
+
...
|
|
518
|
+
placeholder="Custom Phone Input Placeholder"
|
|
519
|
+
modalSearchInputPlaceholder="Custom Modal Search Input Placeholder"
|
|
520
|
+
modalNotFoundCountryMessage="Custom Modal Not Found Country Message"
|
|
521
|
+
/>
|
|
522
|
+
...
|
|
523
|
+
```
|
|
524
|
+
|
|
511
525
|
- ### Custom Modal Height:
|
|
512
526
|
|
|
513
527
|
```jsx
|
|
@@ -645,6 +659,8 @@ export default function App() {
|
|
|
645
659
|
- `theme?:` [ITheme](lib/interfaces/theme.ts);
|
|
646
660
|
- `phoneInputStyle?:` [IPhoneInputStyles](lib/interfaces/phoneInputStyles.ts);
|
|
647
661
|
- `modalStyles?:` [IModalStyles](lib/interfaces/modalStyles.ts);
|
|
662
|
+
- `modalSearchInputPlaceholder?:` string;
|
|
663
|
+
- `modalNotFoundCountryMessage?:` string;
|
|
648
664
|
- `ref?:` [Ref](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/663f439d11d78b65f1dfd38d120f3728ea2cc207/types/react/index.d.ts#L100)<[IPhoneInputRef](lib/interfaces/phoneInputRef.ts)>
|
|
649
665
|
|
|
650
666
|
<br>
|
package/lib/index.js
CHANGED
|
@@ -53,6 +53,8 @@ const PhoneInput = forwardRef(
|
|
|
53
53
|
customMask,
|
|
54
54
|
showOnly,
|
|
55
55
|
excludedCountries,
|
|
56
|
+
modalSearchInputPlaceholder,
|
|
57
|
+
modalNotFoundCountryMessage,
|
|
56
58
|
...rest
|
|
57
59
|
},
|
|
58
60
|
ref
|
|
@@ -94,6 +96,8 @@ const PhoneInput = forwardRef(
|
|
|
94
96
|
customMask,
|
|
95
97
|
showOnly,
|
|
96
98
|
excludedCountries,
|
|
99
|
+
modalSearchInputPlaceholder,
|
|
100
|
+
modalNotFoundCountryMessage,
|
|
97
101
|
...rest,
|
|
98
102
|
},
|
|
99
103
|
};
|
|
@@ -318,14 +322,14 @@ const PhoneInput = forwardRef(
|
|
|
318
322
|
getPhoneNumberInputPlaceholder(language || 'en')
|
|
319
323
|
}
|
|
320
324
|
placeholderTextColor={
|
|
321
|
-
placeholderTextColor ||
|
|
322
|
-
|
|
323
|
-
: '#AAAAAA'
|
|
325
|
+
placeholderTextColor ||
|
|
326
|
+
(theme === 'dark' ? '#CCCCCC' : '#AAAAAA')
|
|
324
327
|
}
|
|
325
328
|
selectionColor={
|
|
326
|
-
selectionColor ||
|
|
329
|
+
selectionColor ||
|
|
330
|
+
(theme === 'dark'
|
|
327
331
|
? 'rgba(255,255,255, .4)'
|
|
328
|
-
: 'rgba(0 ,0 ,0 , .4)'
|
|
332
|
+
: 'rgba(0 ,0 ,0 , .4)')
|
|
329
333
|
}
|
|
330
334
|
editable={!disabled}
|
|
331
335
|
value={inputValue}
|
|
@@ -339,12 +343,14 @@ const PhoneInput = forwardRef(
|
|
|
339
343
|
<CountryPicker
|
|
340
344
|
show={show}
|
|
341
345
|
lang={language}
|
|
342
|
-
inputPlaceholder={
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
346
|
+
inputPlaceholder={
|
|
347
|
+
modalSearchInputPlaceholder ||
|
|
348
|
+
getSearchInputPlaceholder(language || 'en')
|
|
349
|
+
}
|
|
350
|
+
searchMessage={
|
|
351
|
+
modalNotFoundCountryMessage ||
|
|
352
|
+
getCountryNotFoundMessage(language || 'en')
|
|
353
|
+
}
|
|
348
354
|
enableModalAvoiding
|
|
349
355
|
style={getCountryPickerStyle(
|
|
350
356
|
theme,
|
|
@@ -9,7 +9,7 @@ import { IModalStyles } from './modalStyles';
|
|
|
9
9
|
import { IPhoneInputStyles } from './phoneInputStyles';
|
|
10
10
|
import { IPhoneInputRef } from './phoneInputRef';
|
|
11
11
|
|
|
12
|
-
interface
|
|
12
|
+
interface BasePhoneInput extends TextInputProps {
|
|
13
13
|
language?: ILanguage;
|
|
14
14
|
placeholder?: string;
|
|
15
15
|
placeholderTextColor?: string;
|
|
@@ -22,36 +22,26 @@ interface IPhoneInputPropsWithoutRef extends TextInputProps {
|
|
|
22
22
|
modalHeight?: number | string;
|
|
23
23
|
defaultCountry?: ICountryCca2;
|
|
24
24
|
defaultValue?: string;
|
|
25
|
+
customMask?: Array<string>;
|
|
26
|
+
showOnly?: Array<ICountryCca2>;
|
|
27
|
+
excludedCountries?: Array<ICountryCca2>;
|
|
28
|
+
modalSearchInputPlaceholder?: string;
|
|
29
|
+
modalNotFoundCountryMessage?: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
interface IPhoneInputPropsWithoutRef extends BasePhoneInput {
|
|
25
33
|
value: string;
|
|
26
34
|
onChangePhoneNumber: (phoneNumber: string) => void;
|
|
27
35
|
selectedCountry: ICountry | undefined | null;
|
|
28
36
|
onChangeSelectedCountry: (country: ICountry) => void;
|
|
29
|
-
customMask?: Array<string>;
|
|
30
|
-
showOnly?: Array<ICountryCca2>;
|
|
31
|
-
excludedCountries?: Array<ICountryCca2>;
|
|
32
37
|
ref?: never;
|
|
33
38
|
}
|
|
34
39
|
|
|
35
|
-
interface IPhoneInputPropsWithRef extends
|
|
36
|
-
language?: ILanguage;
|
|
37
|
-
placeholder?: string;
|
|
38
|
-
placeholderTextColor?: string;
|
|
39
|
-
selectionColor?: string;
|
|
40
|
-
phoneInputStyle?: IPhoneInputStyles;
|
|
41
|
-
modalStyle?: IModalStyles;
|
|
42
|
-
theme?: ITheme;
|
|
43
|
-
disabled?: boolean;
|
|
44
|
-
modalDisabled?: boolean;
|
|
45
|
-
modalHeight?: number | string;
|
|
46
|
-
defaultCountry?: ICountryCca2;
|
|
47
|
-
defaultValue?: string;
|
|
40
|
+
interface IPhoneInputPropsWithRef extends BasePhoneInput {
|
|
48
41
|
value?: never;
|
|
49
42
|
onChangePhoneNumber?: never;
|
|
50
43
|
selectedCountry?: never;
|
|
51
44
|
onChangeSelectedCountry?: never;
|
|
52
|
-
customMask?: Array<string>;
|
|
53
|
-
showOnly?: Array<ICountryCca2>;
|
|
54
|
-
excludedCountries?: Array<ICountryCca2>;
|
|
55
45
|
ref: Ref<IPhoneInputRef>;
|
|
56
46
|
}
|
|
57
47
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-international-phone-number",
|
|
3
3
|
"author": "AstrOOnauta (https://github.com/AstrOOnauta)",
|
|
4
|
-
"version": "0.6.
|
|
4
|
+
"version": "0.6.3",
|
|
5
5
|
"description": "International mobile phone input component with mask for React Native",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"types": "lib/index.d.ts",
|