react-native-international-phone-number 0.7.4 → 0.7.5
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 +2 -0
- package/lib/index.js +36 -0
- package/lib/interfaces/phoneInputProps.ts +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -699,6 +699,8 @@ export default function App() {
|
|
|
699
699
|
- `phoneInputStyles?:` [IPhoneInputStyles](lib/interfaces/phoneInputStyles.ts);
|
|
700
700
|
- `modalStyles?:` [IModalStyles](lib/interfaces/modalStyles.ts);
|
|
701
701
|
- `modalSearchInputPlaceholder?:` string;
|
|
702
|
+
- `modalSearchInputPlaceholderTextColor?:` string;
|
|
703
|
+
- `modalSearchInputSelectionColor?:` string;
|
|
702
704
|
- `modalNotFoundCountryMessage?:` string;
|
|
703
705
|
- `customCaret?:` [ReactNode](https://reactnative.dev/docs/react-node);
|
|
704
706
|
- `ref?:` [Ref](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/663f439d11d78b65f1dfd38d120f3728ea2cc207/types/react/index.d.ts#L100)<[IPhoneInputRef](lib/interfaces/phoneInputRef.ts)>
|
package/lib/index.js
CHANGED
|
@@ -60,6 +60,8 @@ const PhoneInput = forwardRef(
|
|
|
60
60
|
excludedCountries,
|
|
61
61
|
popularCountries,
|
|
62
62
|
modalSearchInputPlaceholder,
|
|
63
|
+
modalSearchInputPlaceholderTextColor,
|
|
64
|
+
modalSearchInputSelectionColor,
|
|
63
65
|
modalNotFoundCountryMessage,
|
|
64
66
|
customCaret,
|
|
65
67
|
...rest
|
|
@@ -105,6 +107,8 @@ const PhoneInput = forwardRef(
|
|
|
105
107
|
excludedCountries,
|
|
106
108
|
popularCountries,
|
|
107
109
|
modalSearchInputPlaceholder,
|
|
110
|
+
modalSearchInputPlaceholderTextColor,
|
|
111
|
+
modalSearchInputSelectionColor,
|
|
108
112
|
modalNotFoundCountryMessage,
|
|
109
113
|
customCaret,
|
|
110
114
|
...rest,
|
|
@@ -158,6 +162,28 @@ const PhoneInput = forwardRef(
|
|
|
158
162
|
}
|
|
159
163
|
|
|
160
164
|
function onChangeText(phoneNumber, callingCode) {
|
|
165
|
+
if (phoneNumber.includes('+')) {
|
|
166
|
+
const matchingCountry = getCountryByPhoneNumber(phoneNumber);
|
|
167
|
+
|
|
168
|
+
if (matchingCountry) {
|
|
169
|
+
setDefaultCca2(matchingCountry.cca2);
|
|
170
|
+
|
|
171
|
+
if (ref) {
|
|
172
|
+
setCountryValue(matchingCountry);
|
|
173
|
+
updateRef('', matchingCountry);
|
|
174
|
+
} else {
|
|
175
|
+
onChangeSelectedCountry(matchingCountry);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
onChangeText(
|
|
179
|
+
phoneNumber.replace(matchingCountry.callingCode, ''),
|
|
180
|
+
null
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
|
|
161
187
|
const res = getInputMask(
|
|
162
188
|
phoneNumber,
|
|
163
189
|
callingCode ? callingCode : countryValue?.callingCode,
|
|
@@ -381,6 +407,16 @@ const PhoneInput = forwardRef(
|
|
|
381
407
|
modalSearchInputPlaceholder ||
|
|
382
408
|
getSearchInputPlaceholder(language || 'en')
|
|
383
409
|
}
|
|
410
|
+
inputPlaceholderTextColor={
|
|
411
|
+
modalSearchInputPlaceholderTextColor ||
|
|
412
|
+
(theme === 'dark' ? '#CCCCCC' : '#AAAAAA')
|
|
413
|
+
}
|
|
414
|
+
selectionColor={
|
|
415
|
+
modalSearchInputSelectionColor ||
|
|
416
|
+
(theme === 'dark'
|
|
417
|
+
? 'rgba(255,255,255, .4)'
|
|
418
|
+
: 'rgba(0 ,0 ,0 , .4)')
|
|
419
|
+
}
|
|
384
420
|
searchMessage={
|
|
385
421
|
modalNotFoundCountryMessage ||
|
|
386
422
|
getCountryNotFoundMessage(language || 'en')
|
|
@@ -27,6 +27,8 @@ interface BasePhoneInput extends TextInputProps {
|
|
|
27
27
|
excludedCountries?: Array<ICountryCca2>;
|
|
28
28
|
popularCountries?: Array<ICountryCca2>;
|
|
29
29
|
modalSearchInputPlaceholder?: string;
|
|
30
|
+
modalSearchInputPlaceholderTextColor?: string;
|
|
31
|
+
modalSearchInputSelectionColor?: string;
|
|
30
32
|
modalNotFoundCountryMessage?: string;
|
|
31
33
|
customCaret?: ReactNode;
|
|
32
34
|
}
|
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.7.
|
|
4
|
+
"version": "0.7.5",
|
|
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",
|