react-native-international-phone-number 0.4.14 → 0.5.0
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 +152 -133
- package/images/preview.png +0 -0
- package/lib/constants/countries.js +7163 -0
- package/lib/index.d.ts +10 -6
- package/lib/index.js +107 -139
- package/lib/interfaces/country.ts +3 -1
- package/lib/interfaces/countryCca2.ts +242 -0
- package/lib/interfaces/countryName.ts +20 -0
- package/lib/interfaces/language.ts +19 -0
- package/lib/interfaces/phoneInputProps.ts +19 -4
- package/lib/interfaces/theme.ts +1 -0
- package/lib/styles.js +149 -0
- package/lib/utils/getAllCountries.js +2 -2
- package/lib/utils/getCountriesByCallingCode.js +3 -3
- package/lib/utils/getCountriesByName.js +5 -5
- package/lib/utils/getCountryByCca2.js +2 -2
- package/lib/utils/getCountryByPhoneNumber.js +1 -1
- package/lib/utils/{inputMask.js → getInputMask.js} +20 -15
- package/lib/utils/getPlaceholders.js +122 -0
- package/lib/utils/getStyles.js +59 -0
- package/package.json +8 -4
- package/lib/utils/countries.js +0 -1815
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
<br>
|
|
2
|
+
|
|
1
3
|
<div align = "center">
|
|
2
|
-
<img src="https://github.com/AstrOOnauta/react-native-international-phone-number/blob/master/
|
|
4
|
+
<img src="https://github.com/AstrOOnauta/react-native-international-phone-number/blob/master/images/preview.png" alt="React Native International Phone Number Input Lib preview">
|
|
3
5
|
</div>
|
|
4
6
|
|
|
5
7
|
<br>
|
|
@@ -41,14 +43,13 @@
|
|
|
41
43
|
|
|
42
44
|
## List of Contents
|
|
43
45
|
|
|
46
|
+
- [Old Versions](#old-versions)
|
|
44
47
|
- [Installation](#installation)
|
|
45
48
|
- [Features](#features)
|
|
46
49
|
- [Basic Usage](#basic-usage)
|
|
47
50
|
- [With Class Component](#class-component)
|
|
48
51
|
- [With Function Component](#function-component)
|
|
49
|
-
- [
|
|
50
|
-
- [Default Phone Number Value](#default-phone-number-value)
|
|
51
|
-
- [Typescript](#typescript)
|
|
52
|
+
- [With Typescript](#typescript)
|
|
52
53
|
- [Intermediate Usage](#intermediate-usage)
|
|
53
54
|
- [Typescript + useRef](#typescript--useref)
|
|
54
55
|
- [Advanced Usage](#advanced-usage)
|
|
@@ -56,16 +57,28 @@
|
|
|
56
57
|
- [Customizing Lib](#customizing-lib)
|
|
57
58
|
- [Dark Mode](#dark-mode)
|
|
58
59
|
- [Custom Lib Styles](#custom-lib-styles)
|
|
59
|
-
- [
|
|
60
|
+
- [Custom Modal Height](#custom-modal-height)
|
|
60
61
|
- [Country Modal Disabled Mode](#country-modal-disabled-mode)
|
|
62
|
+
- [Phone Input Disabled Mode](#phone-input-disabled-mode)
|
|
61
63
|
- [Custom Disabled Mode Style](#custom-disabled-mode-style)
|
|
64
|
+
- [Change Default Language](#change-default-language)
|
|
65
|
+
- [Custom Phone Mask](#custom-phone-mask)
|
|
66
|
+
- [Custom Default Flag/Country](#custom-default-flagcountry)
|
|
67
|
+
- [Default Phone Number Value](#default-phone-number-value)
|
|
62
68
|
- [Lib Props](#component-props-phoneinputprops)
|
|
63
69
|
- [Lib Functions](#functions)
|
|
70
|
+
- [Supported languages](#🎌-supported-languages-🎌)
|
|
64
71
|
- [Contributing](#contributing)
|
|
65
72
|
- [License](#license)
|
|
66
73
|
|
|
67
74
|
<br>
|
|
68
75
|
|
|
76
|
+
## Old Versions
|
|
77
|
+
|
|
78
|
+
- [Version 0.4.x](https://github.com/AstrOOnauta/react-native-international-phone-number/tree/v0.4.x)
|
|
79
|
+
|
|
80
|
+
<br>
|
|
81
|
+
|
|
69
82
|
## Installation
|
|
70
83
|
|
|
71
84
|
```bash
|
|
@@ -97,8 +110,9 @@ AND
|
|
|
97
110
|
|
|
98
111
|
- 📱 Works with iOS, Android (Cross-platform) and Expo;
|
|
99
112
|
- 🎨 Lib with UI customizable;
|
|
100
|
-
- 🌎 Phone Input Mask according
|
|
101
|
-
- 👨💻 Functional and class component support
|
|
113
|
+
- 🌎 Phone Input Mask according with the selected country;
|
|
114
|
+
- 👨💻 Functional and class component support;
|
|
115
|
+
- 🈶 18 languages supported.
|
|
102
116
|
|
|
103
117
|
<br>
|
|
104
118
|
|
|
@@ -109,13 +123,13 @@ AND
|
|
|
109
123
|
```jsx
|
|
110
124
|
import React from 'react';
|
|
111
125
|
import { View, Text } from 'react-native';
|
|
112
|
-
import
|
|
126
|
+
import PhoneInput from 'react-native-international-phone-number';
|
|
113
127
|
|
|
114
128
|
export class App extends React.Component {
|
|
115
129
|
constructor(props) {
|
|
116
130
|
super(props)
|
|
117
131
|
this.state = {
|
|
118
|
-
selectedCountry:
|
|
132
|
+
selectedCountry: null,
|
|
119
133
|
inputValue: ''
|
|
120
134
|
}
|
|
121
135
|
}
|
|
@@ -144,7 +158,7 @@ export class App extends React.Component {
|
|
|
144
158
|
<View style={{ marginTop: 10 }}>
|
|
145
159
|
<Text>
|
|
146
160
|
Country:{' '}
|
|
147
|
-
{`${this.state.selectedCountry?.name} (${this.state.selectedCountry?.cca2})`}
|
|
161
|
+
{`${this.state.selectedCountry?.name?.en} (${this.state.selectedCountry?.cca2})`}
|
|
148
162
|
</Text>
|
|
149
163
|
<Text>
|
|
150
164
|
Phone Number: {`${this.state.selectedCountry?.callingCode} ${this.state.inputValue}`}
|
|
@@ -161,99 +175,10 @@ export class App extends React.Component {
|
|
|
161
175
|
```jsx
|
|
162
176
|
import React, { useState } from 'react';
|
|
163
177
|
import { View, Text } from 'react-native';
|
|
164
|
-
import
|
|
165
|
-
|
|
166
|
-
export default function App() {
|
|
167
|
-
const [selectedCountry, setSelectedCountry] = useState(undefined);
|
|
168
|
-
const [inputValue, setInputValue] = useState('');
|
|
169
|
-
|
|
170
|
-
function handleInputValue(phoneNumber) {
|
|
171
|
-
setInputValue(phoneNumber);
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
function handleSelectedCountry(country) {
|
|
175
|
-
setSelectedCountry(country);
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
return (
|
|
179
|
-
<View style={{ width: '100%', flex: 1, padding: 24 }}>
|
|
180
|
-
<PhoneInput
|
|
181
|
-
value={inputValue}
|
|
182
|
-
onChangePhoneNumber={handleInputValue}
|
|
183
|
-
selectedCountry={selectedCountry}
|
|
184
|
-
onChangeSelectedCountry={handleSelectedCountry}
|
|
185
|
-
/>
|
|
186
|
-
<View style={{ marginTop: 10 }}>
|
|
187
|
-
<Text>
|
|
188
|
-
Country:{' '}
|
|
189
|
-
{`${selectedCountry?.name} (${selectedCountry?.cca2})`}
|
|
190
|
-
</Text>
|
|
191
|
-
<Text>
|
|
192
|
-
Phone Number:{' '}
|
|
193
|
-
{`${selectedCountry?.callingCode} ${inputValue}`}
|
|
194
|
-
</Text>
|
|
195
|
-
</View>
|
|
196
|
-
</View>
|
|
197
|
-
);
|
|
198
|
-
}
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
- ### Custom Default Flag:
|
|
202
|
-
|
|
203
|
-
```jsx
|
|
204
|
-
import React, { useState } from 'react';
|
|
205
|
-
import { View, Text } from 'react-native';
|
|
206
|
-
import {
|
|
207
|
-
PhoneInput,
|
|
208
|
-
getCountryByCca2,
|
|
209
|
-
} from 'react-native-international-phone-number';
|
|
210
|
-
|
|
211
|
-
export default function App() {
|
|
212
|
-
const [selectedCountry, setSelectedCountry] = useState(
|
|
213
|
-
getCountryByCca2('CA') // <--- In this exemple, returns the CANADA Country and PhoneInput CANADA Flag
|
|
214
|
-
);
|
|
215
|
-
const [inputValue, setInputValue] = useState('');
|
|
216
|
-
|
|
217
|
-
function handleInputValue(phoneNumber) {
|
|
218
|
-
setInputValue(phoneNumber);
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
function handleSelectedCountry(country) {
|
|
222
|
-
setSelectedCountry(country);
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
return (
|
|
226
|
-
<View style={{ width: '100%', flex: 1, padding: 24 }}>
|
|
227
|
-
<PhoneInput
|
|
228
|
-
value={inputValue}
|
|
229
|
-
onChangePhoneNumber={handleInputValue}
|
|
230
|
-
selectedCountry={selectedCountry}
|
|
231
|
-
onChangeSelectedCountry={handleSelectedCountry}
|
|
232
|
-
/>
|
|
233
|
-
<View style={{ marginTop: 10 }}>
|
|
234
|
-
<Text>
|
|
235
|
-
Country:{' '}
|
|
236
|
-
{`${selectedCountry?.name} (${selectedCountry?.cca2})`}
|
|
237
|
-
</Text>
|
|
238
|
-
<Text>
|
|
239
|
-
Phone Number:{' '}
|
|
240
|
-
{`${selectedCountry?.callingCode} ${inputValue}`}
|
|
241
|
-
</Text>
|
|
242
|
-
</View>
|
|
243
|
-
</View>
|
|
244
|
-
);
|
|
245
|
-
}
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
- ### Default Phone Number Value
|
|
249
|
-
|
|
250
|
-
```tsx
|
|
251
|
-
import React, { useState } from 'react';
|
|
252
|
-
import { View, Text } from 'react-native';
|
|
253
|
-
import { PhoneInput } from 'react-native-international-phone-number';
|
|
178
|
+
import PhoneInput from 'react-native-international-phone-number';
|
|
254
179
|
|
|
255
180
|
export default function App() {
|
|
256
|
-
const [selectedCountry, setSelectedCountry] = useState(
|
|
181
|
+
const [selectedCountry, setSelectedCountry] = useState(null);
|
|
257
182
|
const [inputValue, setInputValue] = useState('');
|
|
258
183
|
|
|
259
184
|
function handleInputValue(phoneNumber) {
|
|
@@ -267,7 +192,6 @@ export default function App() {
|
|
|
267
192
|
return (
|
|
268
193
|
<View style={{ width: '100%', flex: 1, padding: 24 }}>
|
|
269
194
|
<PhoneInput
|
|
270
|
-
defaultValue="+12505550199"
|
|
271
195
|
value={inputValue}
|
|
272
196
|
onChangePhoneNumber={handleInputValue}
|
|
273
197
|
selectedCountry={selectedCountry}
|
|
@@ -276,7 +200,7 @@ export default function App() {
|
|
|
276
200
|
<View style={{ marginTop: 10 }}>
|
|
277
201
|
<Text>
|
|
278
202
|
Country:{' '}
|
|
279
|
-
{`${selectedCountry?.name} (${selectedCountry?.cca2})`}
|
|
203
|
+
{`${selectedCountry?.name?.en} (${selectedCountry?.cca2})`}
|
|
280
204
|
</Text>
|
|
281
205
|
<Text>
|
|
282
206
|
Phone Number:{' '}
|
|
@@ -288,25 +212,18 @@ export default function App() {
|
|
|
288
212
|
}
|
|
289
213
|
```
|
|
290
214
|
|
|
291
|
-
> Observations:
|
|
292
|
-
>
|
|
293
|
-
> 1. You need to use a default value with the following format: `+(country callling code)(area code)(number phone)`
|
|
294
|
-
> 2. The lib has the mechanism to set the flag and mask of the supplied `defaultValue`. However, if the supplied `defaultValue` does not match any international standard, the `input mask of the defaultValue` will be set to "BR" (please make sure that the default value is in the format mentioned above).
|
|
295
|
-
|
|
296
215
|
- ### Typescript
|
|
297
216
|
|
|
298
217
|
```tsx
|
|
299
218
|
import React, { useState } from 'react';
|
|
300
219
|
import { View, Text } from 'react-native';
|
|
301
|
-
import {
|
|
302
|
-
PhoneInput,
|
|
220
|
+
import PhoneInput, {
|
|
303
221
|
ICountry,
|
|
304
222
|
} from 'react-native-international-phone-number';
|
|
305
223
|
|
|
306
224
|
export default function App() {
|
|
307
|
-
const [selectedCountry, setSelectedCountry] =
|
|
308
|
-
|
|
309
|
-
>(undefined);
|
|
225
|
+
const [selectedCountry, setSelectedCountry] =
|
|
226
|
+
useState<null | ICountry>(null);
|
|
310
227
|
const [inputValue, setInputValue] = useState<string>('');
|
|
311
228
|
|
|
312
229
|
function handleInputValue(phoneNumber: string) {
|
|
@@ -328,7 +245,7 @@ export default function App() {
|
|
|
328
245
|
<View style={{ marginTop: 10 }}>
|
|
329
246
|
<Text>
|
|
330
247
|
Country:{' '}
|
|
331
|
-
{`${selectedCountry?.name} (${selectedCountry?.cca2})`}
|
|
248
|
+
{`${selectedCountry?.name?.en} (${selectedCountry?.cca2})`}
|
|
332
249
|
</Text>
|
|
333
250
|
<Text>
|
|
334
251
|
Phone Number:{' '}
|
|
@@ -347,10 +264,9 @@ export default function App() {
|
|
|
347
264
|
- ### Typescript + useRef
|
|
348
265
|
|
|
349
266
|
```tsx
|
|
350
|
-
import React, {
|
|
267
|
+
import React, { useRef } from 'react';
|
|
351
268
|
import { View, Text } from 'react-native';
|
|
352
|
-
import {
|
|
353
|
-
PhoneInput,
|
|
269
|
+
import PhoneInput, {
|
|
354
270
|
ICountry,
|
|
355
271
|
IPhoneInputRef,
|
|
356
272
|
} from 'react-native-international-phone-number';
|
|
@@ -396,6 +312,8 @@ export default function App() {
|
|
|
396
312
|
|
|
397
313
|
> Observation: Don't use the useRef hook combined with the useState hook to manage the phoneNumber and selectedCountry values. Instead, choose to use just one of them (useRef or useState).
|
|
398
314
|
|
|
315
|
+
<br>
|
|
316
|
+
|
|
399
317
|
## Advanced Usage
|
|
400
318
|
|
|
401
319
|
- ### React-Hook-Form + Typescript + Default Phone Number Value
|
|
@@ -403,8 +321,7 @@ export default function App() {
|
|
|
403
321
|
```tsx
|
|
404
322
|
import React, { useState, useEffect } from 'react';
|
|
405
323
|
import { View, Text, TouchableOpacity, Alert } from 'react-native';
|
|
406
|
-
import {
|
|
407
|
-
PhoneInput,
|
|
324
|
+
import PhoneInput, {
|
|
408
325
|
ICountry,
|
|
409
326
|
} from 'react-native-international-phone-number';
|
|
410
327
|
import { Controller, FieldValues } from 'react-hook-form';
|
|
@@ -481,19 +398,22 @@ export default function App() {
|
|
|
481
398
|
- ### Dark Mode:
|
|
482
399
|
|
|
483
400
|
```jsx
|
|
401
|
+
...
|
|
484
402
|
<PhoneInput
|
|
485
403
|
...
|
|
486
|
-
|
|
404
|
+
theme="dark"
|
|
487
405
|
/>
|
|
406
|
+
...
|
|
488
407
|
```
|
|
489
408
|
|
|
490
409
|
- ### Custom Lib Styles:
|
|
491
410
|
|
|
492
411
|
<div>
|
|
493
|
-
<img src="https://github.com/AstrOOnauta/react-native-international-phone-number/blob/master/images/custom-styles.png">
|
|
412
|
+
<img src="https://github.com/AstrOOnauta/react-native-international-phone-number/blob/master/images/custom-styles.png" alt="Lib with custom styles">
|
|
494
413
|
</div>
|
|
495
414
|
|
|
496
415
|
```jsx
|
|
416
|
+
...
|
|
497
417
|
<PhoneInput
|
|
498
418
|
...
|
|
499
419
|
inputStyle={{
|
|
@@ -504,7 +424,6 @@ export default function App() {
|
|
|
504
424
|
borderWidth: 1,
|
|
505
425
|
borderStyle: 'solid',
|
|
506
426
|
borderColor: '#F3F3F3',
|
|
507
|
-
marginVertical: 16,
|
|
508
427
|
}}
|
|
509
428
|
flagContainerStyle={{
|
|
510
429
|
borderTopLeftRadius: 7,
|
|
@@ -512,31 +431,51 @@ export default function App() {
|
|
|
512
431
|
backgroundColor: '#808080',
|
|
513
432
|
justifyContent: 'center',
|
|
514
433
|
}}
|
|
434
|
+
flagTextStyle={{
|
|
435
|
+
fontSize: 16,
|
|
436
|
+
fontWeight: 'bold',
|
|
437
|
+
color: '#F3F3F3',
|
|
438
|
+
}}
|
|
515
439
|
/>
|
|
440
|
+
...
|
|
516
441
|
```
|
|
517
442
|
|
|
518
|
-
- ###
|
|
443
|
+
- ### Custom Modal Height:
|
|
519
444
|
|
|
520
445
|
```jsx
|
|
446
|
+
...
|
|
521
447
|
<PhoneInput
|
|
522
448
|
...
|
|
523
|
-
|
|
449
|
+
modalHeight="80%"
|
|
524
450
|
/>
|
|
451
|
+
...
|
|
525
452
|
```
|
|
526
453
|
|
|
527
454
|
- ### Country Modal Disabled Mode:
|
|
528
455
|
|
|
529
456
|
```jsx
|
|
457
|
+
...
|
|
530
458
|
<PhoneInput
|
|
531
459
|
...
|
|
532
460
|
modalDisabled
|
|
533
461
|
/>
|
|
462
|
+
...
|
|
534
463
|
```
|
|
535
464
|
|
|
536
|
-
- ###
|
|
465
|
+
- ### Phone Input Disabled Mode:
|
|
537
466
|
|
|
538
467
|
```jsx
|
|
539
468
|
...
|
|
469
|
+
<PhoneInput
|
|
470
|
+
...
|
|
471
|
+
disabled
|
|
472
|
+
/>
|
|
473
|
+
...
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
- ### Custom Disabled Mode Style:
|
|
477
|
+
|
|
478
|
+
```jsx
|
|
540
479
|
const [isDisabled, setIsDisabled] = useState<boolean>(true)
|
|
541
480
|
...
|
|
542
481
|
<PhoneInput
|
|
@@ -547,21 +486,74 @@ export default function App() {
|
|
|
547
486
|
...
|
|
548
487
|
```
|
|
549
488
|
|
|
489
|
+
- ### Change Default Language:
|
|
490
|
+
|
|
491
|
+
```jsx
|
|
492
|
+
...
|
|
493
|
+
<PhoneInput
|
|
494
|
+
...
|
|
495
|
+
language="pt"
|
|
496
|
+
/>
|
|
497
|
+
...
|
|
498
|
+
```
|
|
499
|
+
|
|
500
|
+
- ### Custom Phone Mask:
|
|
501
|
+
|
|
502
|
+
```jsx
|
|
503
|
+
...
|
|
504
|
+
<PhoneInput
|
|
505
|
+
...
|
|
506
|
+
customMask={['#### ####', '##### ####']}
|
|
507
|
+
/>
|
|
508
|
+
...
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
- ### Custom Default Flag/Country:
|
|
512
|
+
|
|
513
|
+
```jsx
|
|
514
|
+
...
|
|
515
|
+
<PhoneInput
|
|
516
|
+
...
|
|
517
|
+
defaultCountry="CA"
|
|
518
|
+
/>
|
|
519
|
+
...
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
- ### Default Phone Number Value:
|
|
523
|
+
|
|
524
|
+
```jsx
|
|
525
|
+
...
|
|
526
|
+
<PhoneInput
|
|
527
|
+
...
|
|
528
|
+
defaultValue="+12505550199"
|
|
529
|
+
/>
|
|
530
|
+
...
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
> Observations:
|
|
534
|
+
>
|
|
535
|
+
> 1. You need to use a default value with the following format: `+(country callling code)(area code)(number phone)`
|
|
536
|
+
> 2. The lib has the mechanism to set the flag and mask of the supplied `defaultValue`. However, if the supplied `defaultValue` does not match any international standard, the `input mask of the defaultValue` will be set to "BR" (please make sure that the default value is in the format mentioned above).
|
|
537
|
+
|
|
550
538
|
</br>
|
|
551
539
|
|
|
552
540
|
## Component Props ([PhoneInputProps](https://github.com/AstrOOnauta/react-native-international-phone-number/blob/master/lib/interfaces/phoneInputProps.ts))
|
|
553
541
|
|
|
542
|
+
- `language?:` [ILanguage](https://github.com/AstrOOnauta/react-native-international-phone-number/blob/master/lib/interfaces/language.ts);
|
|
543
|
+
- `customMask?:` string[];
|
|
554
544
|
- `defaultValue?:` string;
|
|
555
545
|
- `value?:` string;
|
|
556
546
|
- `onChangePhoneNumber?:` (phoneNumber: string) => void;
|
|
557
|
-
- `selectedCountry?:`
|
|
547
|
+
- `selectedCountry?:` [ICountry](https://github.com/AstrOOnauta/react-native-international-phone-number/blob/master/lib/interfaces/country.ts);
|
|
558
548
|
- `onChangeSelectedCountry?:` (country: [ICountry](https://github.com/AstrOOnauta/react-native-international-phone-number/blob/master/lib/interfaces/country.ts)) => void;
|
|
559
549
|
- `disabled?:` boolean;
|
|
560
550
|
- `modalDisabled?:` boolean;
|
|
561
|
-
- `
|
|
562
|
-
- `
|
|
563
|
-
- `
|
|
564
|
-
- `
|
|
551
|
+
- `modalHeight?:` number | string;
|
|
552
|
+
- `theme?:` [ITheme](https://github.com/AstrOOnauta/react-native-international-phone-number/blob/master/lib/interfaces/theme.ts);
|
|
553
|
+
- `containerStyle?:` [StyleProp](https://reactnative.dev/docs/style)<[ViewStyle](https://reactnative.dev/docs/view-style-props)>;
|
|
554
|
+
- `flagContainerStyle?:` [StyleProp](https://reactnative.dev/docs/style)<[ViewStyle](https://reactnative.dev/docs/view-style-props)>;
|
|
555
|
+
- `flagTextStyle?:` [StyleProp](https://reactnative.dev/docs/style)<[TextStyle](https://reactnative.dev/docs/text-style-props)>;
|
|
556
|
+
- `inputStyle?:` [StyleProp](https://reactnative.dev/docs/style)<[TextStyle](https://reactnative.dev/docs/text-style-props)>;
|
|
565
557
|
- `ref?:` [Ref](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/663f439d11d78b65f1dfd38d120f3728ea2cc207/types/react/index.d.ts#L100)<[IPhoneInputRef](https://github.com/AstrOOnauta/react-native-international-phone-number/blob/master/lib/interfaces/phoneInputRef.ts)>
|
|
566
558
|
|
|
567
559
|
<br>
|
|
@@ -569,13 +561,40 @@ export default function App() {
|
|
|
569
561
|
## Functions
|
|
570
562
|
|
|
571
563
|
- `getAllCountries:` () => [ICountry](https://github.com/AstrOOnauta/react-native-international-phone-number/blob/master/lib/interfaces/country.ts)[];
|
|
564
|
+
- `getCountriesByCallingCode:` (callingCode: string) => [ICountry](https://github.com/AstrOOnauta/react-native-international-phone-number/blob/master/lib/interfaces/country.ts)[] | undefined;
|
|
565
|
+
- `getCountryByCca2:` (cca2: string) => [ICountry](https://github.com/AstrOOnauta/react-native-international-phone-number/blob/master/lib/interfaces/country.ts) | undefined;
|
|
566
|
+
- `getCountriesByName:` (name: string, language: [ILanguage](https://github.com/AstrOOnauta/react-native-international-phone-number/blob/master/lib/interfaces/language.ts)) => [ICountry](https://github.com/AstrOOnauta/react-native-international-phone-number/blob/master/lib/interfaces/country.ts)[] | undefined;
|
|
572
567
|
- `getCountryByPhoneNumber:` (phoneNumber: string) => [ICountry](https://github.com/AstrOOnauta/react-native-international-phone-number/blob/master/lib/interfaces/country.ts) | undefined;
|
|
573
|
-
- `getCountryByCca2:` (phoneNumber: string) => [ICountry](https://github.com/AstrOOnauta/react-native-international-phone-number/blob/master/lib/interfaces/country.ts) | undefined;
|
|
574
|
-
- `getCountriesByCallingCode:` (phoneNumber: string) => [ICountry](https://github.com/AstrOOnauta/react-native-international-phone-number/blob/master/lib/interfaces/country.ts)[] | undefined;
|
|
575
|
-
- `getCountriesByName:` (phoneNumber: string) => [ICountry](https://github.com/AstrOOnauta/react-native-international-phone-number/blob/master/lib/interfaces/country.ts)[] | undefined;
|
|
576
568
|
|
|
577
569
|
</br>
|
|
578
570
|
|
|
571
|
+
## 🎌 Supported languages 🎌
|
|
572
|
+
|
|
573
|
+
```js
|
|
574
|
+
"name": {
|
|
575
|
+
"en": "English",
|
|
576
|
+
"ru": "Russian",
|
|
577
|
+
"pl": "Polish",
|
|
578
|
+
"ua": "Ukrainian",
|
|
579
|
+
"cz": "Czech",
|
|
580
|
+
"by": "Belarusian",
|
|
581
|
+
"pt": "Portuguese",
|
|
582
|
+
"es": "Espanol",
|
|
583
|
+
"ro": "Romanian",
|
|
584
|
+
"bg": "Bulgarian",
|
|
585
|
+
"de": "German",
|
|
586
|
+
"fr": "French",
|
|
587
|
+
"nl": "Dutch",
|
|
588
|
+
"it": "Italian",
|
|
589
|
+
"cn": "Chinese",
|
|
590
|
+
"ee": "Estonian",
|
|
591
|
+
"jp": "Japanese",
|
|
592
|
+
"he": "Hebrew"
|
|
593
|
+
},
|
|
594
|
+
```
|
|
595
|
+
|
|
596
|
+
<br>
|
|
597
|
+
|
|
579
598
|
## Contributing
|
|
580
599
|
|
|
581
600
|
- Fork or clone this repository
|
|
Binary file
|