react-native-international-phone-number 0.4.7 → 0.4.9
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 +7 -6
- package/lib/index.d.ts +7 -29
- package/lib/index.js +2 -0
- package/lib/interfaces/country.ts +6 -0
- package/lib/interfaces/phoneInputProps.ts +23 -0
- package/lib/utils/getAllCountries.js +16 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -497,8 +497,8 @@ export default function App() {
|
|
|
497
497
|
- `defaultValue?:` string;
|
|
498
498
|
- `value:` string;
|
|
499
499
|
- `onChangePhoneNumber:` (phoneNumber: string) => void;
|
|
500
|
-
- `selectedCountry:` undefined | ICountry;
|
|
501
|
-
- `onChangeSelectedCountry:` (country: ICountry) => void;
|
|
500
|
+
- `selectedCountry:` undefined | [ICountry](https://github.com/AstrOOnauta/react-native-international-phone-number/blob/master/lib/interfaces/country.ts);
|
|
501
|
+
- `onChangeSelectedCountry:` (country: [ICountry](https://github.com/AstrOOnauta/react-native-international-phone-number/blob/master/lib/interfaces/country.ts)) => void;
|
|
502
502
|
- `disabled?:` boolean;
|
|
503
503
|
- `withDarkTheme?:` boolean;
|
|
504
504
|
- `containerStyle?:` StyleProp<[ViewStyle](https://reactnative.dev/docs/view-style-props)>;
|
|
@@ -509,10 +509,11 @@ export default function App() {
|
|
|
509
509
|
|
|
510
510
|
## Functions
|
|
511
511
|
|
|
512
|
-
- `
|
|
513
|
-
- `
|
|
514
|
-
- `
|
|
515
|
-
- `
|
|
512
|
+
- `getAllCountries:` () => [ICountry](https://github.com/AstrOOnauta/react-native-international-phone-number/blob/master/lib/interfaces/country.ts)[];
|
|
513
|
+
- `getCountryByPhoneNumber:` (phoneNumber: string) => [ICountry](https://github.com/AstrOOnauta/react-native-international-phone-number/blob/master/lib/interfaces/country.ts) | undefined;
|
|
514
|
+
- `getCountryByCca2:` (phoneNumber: string) => [ICountry](https://github.com/AstrOOnauta/react-native-international-phone-number/blob/master/lib/interfaces/country.ts) | undefined;
|
|
515
|
+
- `getCountriesByCallingCode:` (phoneNumber: string) => [ICountry](https://github.com/AstrOOnauta/react-native-international-phone-number/blob/master/lib/interfaces/country.ts)[] | undefined;
|
|
516
|
+
- `getCountriesByName:` (phoneNumber: string) => [ICountry](https://github.com/AstrOOnauta/react-native-international-phone-number/blob/master/lib/interfaces/country.ts)[] | undefined;
|
|
516
517
|
|
|
517
518
|
</br>
|
|
518
519
|
|
package/lib/index.d.ts
CHANGED
|
@@ -1,34 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
TextInputProps,
|
|
4
|
-
TextStyle,
|
|
5
|
-
ViewStyle,
|
|
6
|
-
} from 'react-native';
|
|
7
|
-
|
|
8
|
-
interface ICountry {
|
|
9
|
-
callingCode: string;
|
|
10
|
-
cca2: string;
|
|
11
|
-
flag: string;
|
|
12
|
-
name: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
interface PhoneInputProps extends TextInputProps {
|
|
16
|
-
placeholder?: string;
|
|
17
|
-
placeholderTextColor?: string;
|
|
18
|
-
containerStyle?: StyleProp<ViewStyle>;
|
|
19
|
-
flagContainerStyle?: StyleProp<ViewStyle>;
|
|
20
|
-
inputStyle?: StyleProp<TextStyle>;
|
|
21
|
-
withDarkTheme?: boolean;
|
|
22
|
-
disabled?: boolean;
|
|
23
|
-
defaultValue?: string;
|
|
24
|
-
value: string;
|
|
25
|
-
onChangePhoneNumber: (phoneNumber: string) => void;
|
|
26
|
-
selectedCountry: undefined | ICountry;
|
|
27
|
-
onChangeSelectedCountry: (country: ICountry) => void;
|
|
28
|
-
}
|
|
1
|
+
import { ICountry } from './interfaces/country';
|
|
2
|
+
import { PhoneInputProps } from './interfaces/phoneInputProps';
|
|
29
3
|
|
|
30
4
|
declare function PhoneInput(props: PhoneInputProps): JSX.Element;
|
|
31
5
|
|
|
6
|
+
declare function getAllCountries(): ICountry[];
|
|
7
|
+
|
|
32
8
|
declare function getCountryByPhoneNumber(
|
|
33
9
|
phoneNumber: string
|
|
34
10
|
): ICountry | undefined;
|
|
@@ -47,9 +23,11 @@ declare function getCountriesByName(
|
|
|
47
23
|
|
|
48
24
|
export {
|
|
49
25
|
PhoneInput,
|
|
50
|
-
|
|
26
|
+
getAllCountries,
|
|
51
27
|
getCountryByPhoneNumber,
|
|
52
28
|
getCountryByCca2,
|
|
53
29
|
getCountriesByCallingCode,
|
|
54
30
|
getCountriesByName,
|
|
31
|
+
ICountry,
|
|
32
|
+
PhoneInputProps,
|
|
55
33
|
};
|
package/lib/index.js
CHANGED
|
@@ -10,6 +10,7 @@ import CountryPicker, {
|
|
|
10
10
|
DEFAULT_THEME,
|
|
11
11
|
} from 'react-native-country-picker-modal';
|
|
12
12
|
|
|
13
|
+
import getAllCountries from './utils/getAllCountries';
|
|
13
14
|
import getCountriesByName from './utils/getCountriesByName';
|
|
14
15
|
import getCountriesByCallingCode from './utils/getCountriesByCallingCode';
|
|
15
16
|
import getCountryByCca2 from './utils/getCountryByCca2';
|
|
@@ -252,6 +253,7 @@ const styles = StyleSheet.create({
|
|
|
252
253
|
|
|
253
254
|
export {
|
|
254
255
|
PhoneInput,
|
|
256
|
+
getAllCountries,
|
|
255
257
|
getCountryByPhoneNumber,
|
|
256
258
|
getCountryByCca2,
|
|
257
259
|
getCountriesByCallingCode,
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {
|
|
2
|
+
StyleProp,
|
|
3
|
+
TextInputProps,
|
|
4
|
+
TextStyle,
|
|
5
|
+
ViewStyle,
|
|
6
|
+
} from 'react-native';
|
|
7
|
+
|
|
8
|
+
import { ICountry } from './country';
|
|
9
|
+
|
|
10
|
+
export interface PhoneInputProps extends TextInputProps {
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
placeholderTextColor?: string;
|
|
13
|
+
containerStyle?: StyleProp<ViewStyle>;
|
|
14
|
+
flagContainerStyle?: StyleProp<ViewStyle>;
|
|
15
|
+
inputStyle?: StyleProp<TextStyle>;
|
|
16
|
+
withDarkTheme?: boolean;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
defaultValue?: string;
|
|
19
|
+
value: string;
|
|
20
|
+
onChangePhoneNumber: (phoneNumber: string) => void;
|
|
21
|
+
selectedCountry: undefined | ICountry;
|
|
22
|
+
onChangeSelectedCountry: (country: ICountry) => void;
|
|
23
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {countries} from './countries';
|
|
2
|
+
|
|
3
|
+
export default function getAllCountries() {
|
|
4
|
+
const formatedCountries = [];
|
|
5
|
+
|
|
6
|
+
countries.forEach(country => {
|
|
7
|
+
formatedCountries.push({
|
|
8
|
+
name: country.name,
|
|
9
|
+
cca2: country.cca2,
|
|
10
|
+
flag: country.flag,
|
|
11
|
+
callingCode: country.callingCode,
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
return formatedCountries;
|
|
16
|
+
}
|
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.4.
|
|
4
|
+
"version": "0.4.9",
|
|
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",
|