From e349344fed248c677b0b1dfd7b13d31701db423c Mon Sep 17 00:00:00 2001 From: sohantalukder Date: Tue, 7 Jan 2025 09:50:20 +0600 Subject: [PATCH] add main failes --- src/index.d.ts | 2 +- src/index.tsx | 10 +- src/main/assets/assets.d.ts | 9 + src/main/assets/assets.ts | 14 + src/main/constants/constants.d.ts | 203 +++ src/main/constants/constants.ts | 1343 +++++++++++++++++ .../country-picker/CountryPickerModal.tsx | 60 + src/main/country-picker/Picker.d.ts | 12 + src/main/country-picker/Picker.tsx | 104 ++ .../country-picker/styles/picker.style.d.ts | 20 + .../country-picker/styles/picker.style.ts | 68 + 11 files changed, 1839 insertions(+), 6 deletions(-) create mode 100644 src/main/assets/assets.d.ts create mode 100644 src/main/assets/assets.ts create mode 100644 src/main/constants/constants.d.ts create mode 100644 src/main/constants/constants.ts create mode 100644 src/main/country-picker/CountryPickerModal.tsx create mode 100644 src/main/country-picker/Picker.d.ts create mode 100644 src/main/country-picker/Picker.tsx create mode 100644 src/main/country-picker/styles/picker.style.d.ts create mode 100644 src/main/country-picker/styles/picker.style.ts diff --git a/src/index.d.ts b/src/index.d.ts index c439947..b1a304e 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -5,7 +5,7 @@ import type { TextStyle, ViewStyle, } from 'react-native'; -import type { CountryCode, EachCountry } from './lib/constants/constants.d'; +import type { CountryCode, EachCountry } from './main/constants/constants.d'; /** * Props for the RNPhoneInput component. diff --git a/src/index.tsx b/src/index.tsx index 30c45dc..42d2c8c 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -7,13 +7,13 @@ import { useColorScheme, } from 'react-native'; import { forwardRef, useImperativeHandle, useState } from 'react'; -import constants from './lib/constants/constants'; -import Picker from './lib/country-picker/Picker'; -import assets from './lib/assets/assets'; +import constants from './main/constants/constants'; +import Picker from './main/country-picker/Picker'; +import assets from './main/assets/assets'; import styles from './styles'; import type { RNPhoneInputProps, RNPhoneInputRef } from './index.d'; -import type { CountryCode, EachCountry } from './lib/constants/constants.d'; -import CountryPickerModal from './lib/country-picker/CountryPickerModal'; +import type { CountryCode, EachCountry } from './main/constants/constants.d'; +import CountryPickerModal from './main/country-picker/CountryPickerModal'; declare global { namespace NodeJS { diff --git a/src/main/assets/assets.d.ts b/src/main/assets/assets.d.ts new file mode 100644 index 0000000..a34ec39 --- /dev/null +++ b/src/main/assets/assets.d.ts @@ -0,0 +1,9 @@ +type Assets = { + [key in + | 'closeDefaultIcon' + | 'closeDarkIcon' + | 'downArrowDefaultIcon' + | 'downArrowDarkIcon']: string; +}; + +export type { Assets }; diff --git a/src/main/assets/assets.ts b/src/main/assets/assets.ts new file mode 100644 index 0000000..e6571e5 --- /dev/null +++ b/src/main/assets/assets.ts @@ -0,0 +1,14 @@ +import type {Assets} from './assets'; + +const assets: Assets = { + closeDefaultIcon: + 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH0AAAB9CAYAAACPgGwlAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAATvSURBVHgB7dyLbRw3FIXhk1TgEk4HUQlbQjqIOrA6oEpQB0oHdgebDpJUwHTgdJDMtXTltbzv5eXwcX6AsA1Y5OV89sIPYIAf+7Csh2Vtl/VlWf+9fms/vl8WoVrKvBIOe51ss/OFh1Y+dzMV3kec57U5tEE68cXvV4Jas0u9fnu/webCDQS/bpeC+0f+3e4mGdehC75+14D72vommxs2EXzdbgH3tbGNngpsJPj4SoDberTNtoU2E3xcpcBtPduGJdEFX76S4LbMG58Kbyr4cpUGf/ud/hiwseBvLwLc1r1tfhe0ueCvLwrcFv2QT4g7JEFdkj2vKIvn3YOI2/6BRvBlsucUZZDx8p8z30UIfs3s+USC89DBhODXyJ7LKuAeIfia2fNYFdwjBF8jew5NgHuE4COz+zcF7hGCj8ju3SS4Rwi+ZHbfpsE9QvAlsnt2Ae4Rgr8lu19X4B4h+Guye3UJ7hGCvyS7T9fgHiH4c7J7DAHuEYI/ls0/FLhHCH5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FjJnYdLpban9pX7GYaV3MuZQ2qLOz3rj6aSOy9zSvWI7Y+XmVNyT2duqZ7Xjz73AYNL7mlESP3/q9h5hpADjOIYUVI3u4c8Bh1Scg8TJdXztHuQf6iNempL7nv8LqLuecOB743XgQeW3Df8DiLv+Oj3xQo+2BgX3z3ybvVZAQUXMMbDd76p1IaCixjj4LsuQmpDwYWM/PiOi5LaUHAxIy++2yKlNkRsQSMfvtOipTZEbFEjD75LF1IbgtDCRv/4Dl1JbQhCixv94t27lNoQhC5g9Id37lpqQ5TchndNIbUhSq53TCW1IcaV691SSm2I8eR6p9RSG2Icud5lCKkNkV+udxhKakPklWsMKrUh8sk1BpfaEHnkGoTuIjpD9C/XIHQH0SmiX7kGod1F54j+5BqEdhZJEP3INWK7imSI5cs1YjuKpIjlyrXgbiI5YnlyLbiTGASxHLkW3EUMhri9XAvuIAZF3E6uBZ8tBkdcX64FnymKV8T15FrwWaJ4h4iXa8FniOIgIvbiS+oNEX0JLalfQJTUtIiSmhZRUtMiSmpaRElNiyipaRElNS2ipKZFlNS0iJKaFlFS0yJKalpESU2LKKlpESU1LaKkpsX/hfqGz4X6exDWFF2xmvKbw4Jd6CN7b27MxDfGwF8wtOJN5J9tUvMPtogJrzZ/lygAAAAASUVORK5CYII=', +}; + +export default assets; diff --git a/src/main/constants/constants.d.ts b/src/main/constants/constants.d.ts new file mode 100644 index 0000000..14a88e7 --- /dev/null +++ b/src/main/constants/constants.d.ts @@ -0,0 +1,203 @@ +type CountryCode = + | 'AF' + | 'AL' + | 'DZ' + | 'AD' + | 'AO' + | 'AR' + | 'AM' + | 'AU' + | 'AT' + | 'AZ' + | 'BH' + | 'BD' + | 'BY' + | 'BE' + | 'BJ' + | 'BT' + | 'BO' + | 'BA' + | 'BW' + | 'BR' + | 'BN' + | 'BG' + | 'BF' + | 'BI' + | 'KH' + | 'CM' + | 'CA' + | 'CV' + | 'KY' + | 'CF' + | 'TD' + | 'CL' + | 'CN' + | 'CO' + | 'KM' + | 'CG' + | 'CD' + | 'CR' + | 'CI' + | 'HR' + | 'CU' + | 'CY' + | 'CZ' + | 'DK' + | 'DJ' + | 'DM' + | 'DO' + | 'EC' + | 'EG' + | 'SV' + | 'GQ' + | 'ER' + | 'EE' + | 'ET' + | 'FJ' + | 'FI' + | 'FR' + | 'GA' + | 'GM' + | 'GE' + | 'DE' + | 'GH' + | 'GR' + | 'GD' + | 'GU' + | 'GT' + | 'GN' + | 'GW' + | 'GY' + | 'HT' + | 'HN' + | 'HU' + | 'IS' + | 'IN' + | 'ID' + | 'IR' + | 'IQ' + | 'IE' + | 'IL' + | 'IT' + | 'JM' + | 'JP' + | 'JO' + | 'KZ' + | 'KE' + | 'KI' + | 'KW' + | 'KG' + | 'LA' + | 'LV' + | 'LB' + | 'LS' + | 'LR' + | 'LY' + | 'LI' + | 'LT' + | 'LU' + | 'MO' + | 'MK' + | 'MG' + | 'MW' + | 'MY' + | 'MV' + | 'ML' + | 'MT' + | 'MH' + | 'MR' + | 'MU' + | 'YT' + | 'MX' + | 'FM' + | 'MD' + | 'MC' + | 'MN' + | 'ME' + | 'MS' + | 'MA' + | 'MZ' + | 'MM' + | 'NA' + | 'NR' + | 'NP' + | 'NL' + | 'NZ' + | 'NI' + | 'NE' + | 'NG' + | 'KP' + | 'NO' + | 'OM' + | 'PK' + | 'PA' + | 'PG' + | 'PY' + | 'PE' + | 'PH' + | 'PL' + | 'PT' + | 'PR' + | 'QA' + | 'RO' + | 'RU' + | 'RW' + | 'KN' + | 'SC' + | 'LC' + | 'SM' + | 'ST' + | 'SA' + | 'SN' + | 'RS' + | 'SG' + | 'SX' + | 'SK' + | 'SI' + | 'SO' + | 'ZA' + | 'KR' + | 'SS' + | 'ES' + | 'LK' + | 'SD' + | 'SR' + | 'SZ' + | 'SE' + | 'CH' + | 'SY' + | 'TJ' + | 'TZ' + | 'TH' + | 'TG' + | 'TO' + | 'TT' + | 'TN' + | 'TR' + | 'TM' + | 'TV' + | 'UG' + | 'UA' + | 'AE' + | 'GB' + | 'US' + | 'UY' + | 'UZ' + | 'VU' + | 'VE' + | 'VN' + | 'WF' + | 'YE' + | 'ZM' + | 'ZW'; +type EachCountry = { + icon: string; + countryCode: string; + countryName: string; + callingCode: string; + regex: string; +}; +type Constant = { + [key in CountryCode]: EachCountry; +}; +export type { CountryCode, Constant, EachCountry }; diff --git a/src/main/constants/constants.ts b/src/main/constants/constants.ts new file mode 100644 index 0000000..799797e --- /dev/null +++ b/src/main/constants/constants.ts @@ -0,0 +1,1343 @@ +import type { Constant } from './constants.d'; + +const constants: Constant = { + AF: { + icon: '๐Ÿ‡ฆ๐Ÿ‡ซ', + countryCode: 'AF', + countryName: 'Afghanistan', + callingCode: '93', + regex: '^(+93|93)?[2-9]d{8}$', + }, + AL: { + icon: '๐Ÿ‡ฆ๐Ÿ‡ฑ', + countryCode: 'AL', + countryName: 'Albania', + callingCode: '355', + regex: '^(+355|355)?[67]d{8}$', + }, + DZ: { + icon: '๐Ÿ‡ฉ๐Ÿ‡ฟ', + countryCode: 'DZ', + countryName: 'Algeria', + callingCode: '213', + regex: '^(+213|213)?[5-7]d{8}$', + }, + AD: { + icon: '๐Ÿ‡ฆ๐Ÿ‡ฉ', + countryCode: 'AD', + countryName: 'Andorra', + callingCode: '376', + regex: '^(+376|376)?[3-9]d{5}$', + }, + AO: { + icon: '๐Ÿ‡ฆ๐Ÿ‡ด', + countryCode: 'AO', + countryName: 'Angola', + callingCode: '244', + regex: '^(+244|244)?9d{8}$', + }, + AR: { + icon: '๐Ÿ‡ฆ๐Ÿ‡ท', + countryCode: 'AR', + countryName: 'Argentina', + callingCode: '54', + regex: '^(+54|54)?[1-9]d{9}$', + }, + AM: { + icon: '๐Ÿ‡ฆ๐Ÿ‡ฒ', + countryCode: 'AM', + countryName: 'Armenia', + callingCode: '374', + regex: '^(+374|374)?[9]d{8}$', + }, + AU: { + icon: '๐Ÿ‡ฆ๐Ÿ‡บ', + countryCode: 'AU', + countryName: 'Australia', + callingCode: '61', + regex: '^(+61|61)?[2-9]d{8}$', + }, + AT: { + icon: '๐Ÿ‡ฆ๐Ÿ‡น', + countryCode: 'AT', + countryName: 'Austria', + callingCode: '43', + regex: '^(+43|43)?[1-9]d{3,8}$', + }, + AZ: { + icon: '๐Ÿ‡ฆ๐Ÿ‡ฟ', + countryCode: 'AZ', + countryName: 'Azerbaijan', + callingCode: '994', + regex: '^(+994|994)?[50-59]d{7}$', + }, + BH: { + icon: '๐Ÿ‡ง๐Ÿ‡ญ', + countryCode: 'BH', + countryName: 'Bahrain', + callingCode: '973', + regex: '^(+973|973)?[3-9]d{7}$', + }, + BD: { + icon: '๐Ÿ‡ง๐Ÿ‡ฉ', + countryCode: 'BD', + countryName: 'Bangladesh', + callingCode: '880', + regex: '^(+880|880)?1[3-9]d{8}$', + }, + BY: { + icon: '๐Ÿ‡ง๐Ÿ‡พ', + countryCode: 'BY', + countryName: 'Belarus', + callingCode: '375', + regex: '^(+375|375)?[2-9]d{7}$', + }, + BE: { + icon: '๐Ÿ‡ง๐Ÿ‡ช', + countryCode: 'BE', + countryName: 'Belgium', + callingCode: '32', + regex: '^(+32|32)?[1-9]d{7}$', + }, + BJ: { + icon: '๐Ÿ‡ง๐Ÿ‡ฏ', + countryCode: 'BJ', + countryName: 'Benin', + callingCode: '229', + regex: '^(+229|229)?[91-99]d{7}$', + }, + BT: { + icon: '๐Ÿ‡ง๐Ÿ‡น', + countryCode: 'BT', + countryName: 'Bhutan', + callingCode: '975', + regex: '^(+975|975)?1d{7}$', + }, + BO: { + icon: '๐Ÿ‡ง๐Ÿ‡ด', + countryCode: 'BO', + countryName: 'Bolivia', + callingCode: '591', + regex: '^(+591|591)?[2-7]d{7}$', + }, + BA: { + icon: '๐Ÿ‡ง๐Ÿ‡ฆ', + countryCode: 'BA', + countryName: 'Bosnia and Herzegovina', + callingCode: '387', + regex: '^(+387|387)?6d{7}$', + }, + BW: { + icon: '๐Ÿ‡ง๐Ÿ‡ผ', + countryCode: 'BW', + countryName: 'Botswana', + callingCode: '267', + regex: '^(+267|267)?7d{7}$', + }, + BR: { + icon: '๐Ÿ‡ง๐Ÿ‡ท', + countryCode: 'BR', + countryName: 'Brazil', + callingCode: '55', + regex: '^(+55|55)?[1-9]d{8}$', + }, + BN: { + icon: '๐Ÿ‡ง๐Ÿ‡ณ', + countryCode: 'BN', + countryName: 'Brunei', + callingCode: '673', + regex: '^(+673|673)?[2-8]d{6}$', + }, + BG: { + icon: '๐Ÿ‡ง๐Ÿ‡ฌ', + countryCode: 'BG', + countryName: 'Bulgaria', + callingCode: '359', + regex: '^(+359|359)?[8-9]d{8}$', + }, + BF: { + icon: '๐Ÿ‡ง๐Ÿ‡ซ', + countryCode: 'BF', + countryName: 'Burkina Faso', + callingCode: '226', + regex: '^(+226|226)?[70-79]d{6}$', + }, + BI: { + icon: '๐Ÿ‡ง๐Ÿ‡ฎ', + countryCode: 'BI', + countryName: 'Burundi', + callingCode: '257', + regex: '^(+257|257)?7d{7}$', + }, + KH: { + icon: '๐Ÿ‡ฐ๐Ÿ‡ญ', + countryCode: 'KH', + countryName: 'Cambodia', + callingCode: '855', + regex: '^(+855|855)?[1-9]d{7}$', + }, + CM: { + icon: '๐Ÿ‡จ๐Ÿ‡ฒ', + countryCode: 'CM', + countryName: 'Cameroon', + callingCode: '237', + regex: '^(+237|237)?[2-7]d{7}$', + }, + CA: { + icon: '๐Ÿ‡จ๐Ÿ‡ฆ', + countryCode: 'CA', + countryName: 'Canada', + callingCode: '1', + regex: '^(+1|1)?[2-9]d{9}$', + }, + CV: { + icon: '๐Ÿ‡จ๐Ÿ‡ป', + countryCode: 'CV', + countryName: 'Cape Verde', + callingCode: '238', + regex: '^(+238|238)?[2-9]d{6}$', + }, + KY: { + icon: '๐Ÿ‡ฐ๐Ÿ‡พ', + countryCode: 'KY', + countryName: 'Cayman Islands', + callingCode: '1-345', + regex: '^(+1-345|1-345)?[345]d{6}$', + }, + CF: { + icon: '๐Ÿ‡จ๐Ÿ‡ซ', + countryCode: 'CF', + countryName: 'Central African Republic', + callingCode: '236', + regex: '^(+236|236)?[7-8]d{7}$', + }, + TD: { + icon: '๐Ÿ‡น๐Ÿ‡ฉ', + countryCode: 'TD', + countryName: 'Chad', + callingCode: '235', + regex: '^(+235|235)?[7-9]d{7}$', + }, + CL: { + icon: '๐Ÿ‡จ๐Ÿ‡ฑ', + countryCode: 'CL', + countryName: 'Chile', + callingCode: '56', + regex: '^(+56|56)?[2-9]d{8}$', + }, + CN: { + icon: '๐Ÿ‡จ๐Ÿ‡ณ', + countryCode: 'CN', + countryName: 'China', + callingCode: '86', + regex: '^(+86|86)?1[3-9]d{9}$', + }, + CO: { + icon: '๐Ÿ‡จ๐Ÿ‡ด', + countryCode: 'CO', + countryName: 'Colombia', + callingCode: '57', + regex: '^(+57|57)?[1-9]d{9}$', + }, + KM: { + icon: '๐Ÿ‡ฐ๐Ÿ‡ฒ', + countryCode: 'KM', + countryName: 'Comoros', + callingCode: '269', + regex: '^(+269|269)?3d{7}$', + }, + CG: { + icon: '๐Ÿ‡จ๐Ÿ‡ฌ', + countryCode: 'CG', + countryName: 'Congo', + callingCode: '242', + regex: '^(+242|242)?[7-9]d{7}$', + }, + CD: { + icon: '๐Ÿ‡จ๐Ÿ‡ฉ', + countryCode: 'CD', + countryName: 'Congo (Congo-Kinshasa)', + callingCode: '243', + regex: '^(+243|243)?[7-9]d{7}$', + }, + CR: { + icon: '๐Ÿ‡จ๐Ÿ‡ท', + countryCode: 'CR', + countryName: 'Costa Rica', + callingCode: '506', + regex: '^(+506|506)?[2-8]d{6}$', + }, + CI: { + icon: '๐Ÿ‡จ๐Ÿ‡ฎ', + countryCode: 'CI', + countryName: "Cรดte d'Ivoire", + callingCode: '225', + regex: '^(+225|225)?[0-9]d{7}$', + }, + HR: { + icon: '๐Ÿ‡ญ๐Ÿ‡ท', + countryCode: 'HR', + countryName: 'Croatia', + callingCode: '385', + regex: '^(+385|385)?[1-9]d{7}$', + }, + CU: { + icon: '๐Ÿ‡จ๐Ÿ‡บ', + countryCode: 'CU', + countryName: 'Cuba', + callingCode: '53', + regex: '^(+53|53)?[2-9]d{7}$', + }, + CY: { + icon: '๐Ÿ‡จ๐Ÿ‡พ', + countryCode: 'CY', + countryName: 'Cyprus', + callingCode: '357', + regex: '^(+357|357)?[2-9]d{6}$', + }, + CZ: { + icon: '๐Ÿ‡จ๐Ÿ‡ฟ', + countryCode: 'CZ', + countryName: 'Czech Republic', + callingCode: '420', + regex: '^(+420|420)?[2-9]d{8}$', + }, + DK: { + icon: '๐Ÿ‡ฉ๐Ÿ‡ฐ', + countryCode: 'DK', + countryName: 'Denmark', + callingCode: '45', + regex: '^(+45|45)?[2-9]d{7}$', + }, + DJ: { + icon: '๐Ÿ‡ฉ๐Ÿ‡ฏ', + countryCode: 'DJ', + countryName: 'Djibouti', + callingCode: '253', + regex: '^(+253|253)?[2-9]d{6}$', + }, + DM: { + icon: '๐Ÿ‡ฉ๐Ÿ‡ฒ', + countryCode: 'DM', + countryName: 'Dominica', + callingCode: '1767', + regex: '^(+1767|1767)?[1-9]d{6}$', + }, + DO: { + icon: '๐Ÿ‡ฉ๐Ÿ‡ด', + countryCode: 'DO', + countryName: 'Dominican Republic', + callingCode: '1809', + regex: '^(+1809|1809)?[1-9]d{7}$', + }, + EC: { + icon: '๐Ÿ‡ช๐Ÿ‡จ', + countryCode: 'EC', + countryName: 'Ecuador', + callingCode: '593', + regex: '^(+593|593)?[2-9]d{8}$', + }, + EG: { + icon: '๐Ÿ‡ช๐Ÿ‡ฌ', + countryCode: 'EG', + countryName: 'Egypt', + callingCode: '20', + regex: '^(+20|20)?[1-9]d{8}$', + }, + SV: { + icon: '๐Ÿ‡ธ๐Ÿ‡ป', + countryCode: 'SV', + countryName: 'El Salvador', + callingCode: '503', + regex: '^(+503|503)?[2-9]d{7}$', + }, + GQ: { + icon: '๐Ÿ‡ฌ๐Ÿ‡ถ', + countryCode: 'GQ', + countryName: 'Equatorial Guinea', + callingCode: '240', + regex: '^(+240|240)?[2-9]d{7}$', + }, + ER: { + icon: '๐Ÿ‡ช๐Ÿ‡ท', + countryCode: 'ER', + countryName: 'Eritrea', + callingCode: '291', + regex: '^(+291|291)?[2-9]d{6}$', + }, + EE: { + icon: '๐Ÿ‡ช๐Ÿ‡ช', + countryCode: 'EE', + countryName: 'Estonia', + callingCode: '372', + regex: '^(+372|372)?[2-9]d{7}$', + }, + ET: { + icon: '๐Ÿ‡ช๐Ÿ‡น', + countryCode: 'ET', + countryName: 'Ethiopia', + callingCode: '251', + regex: '^(+251|251)?[1-9]d{8}$', + }, + FJ: { + icon: '๐Ÿ‡ซ๐Ÿ‡ฏ', + countryCode: 'FJ', + countryName: 'Fiji', + callingCode: '679', + regex: '^(+679|679)?7d{5}$', + }, + FI: { + icon: '๐Ÿ‡ซ๐Ÿ‡ฎ', + countryCode: 'FI', + countryName: 'Finland', + callingCode: '358', + regex: '^(+358|358)?[0-9]d{6,9}$', + }, + FR: { + icon: '๐Ÿ‡ซ๐Ÿ‡ท', + countryCode: 'FR', + countryName: 'France', + callingCode: '33', + regex: '^(+33|33)?[1-9]d{8}$', + }, + GA: { + icon: '๐Ÿ‡ฌ๐Ÿ‡ฆ', + countryCode: 'GA', + countryName: 'Gabon', + callingCode: '241', + regex: '^(+241|241)?[2-9]d{6}$', + }, + GM: { + icon: '๐Ÿ‡ฌ๐Ÿ‡ฒ', + countryCode: 'GM', + countryName: 'Gambia', + callingCode: '220', + regex: '^(+220|220)?[3-9]d{6}$', + }, + GE: { + icon: '๐Ÿ‡ฌ๐Ÿ‡ช', + countryCode: 'GE', + countryName: 'Georgia', + callingCode: '995', + regex: '^(+995|995)?[3-9]d{8}$', + }, + DE: { + icon: '๐Ÿ‡ฉ๐Ÿ‡ช', + countryCode: 'DE', + countryName: 'Germany', + callingCode: '49', + regex: '^(+49|49)?[1-9]d{7,10}$', + }, + GH: { + icon: '๐Ÿ‡ฌ๐Ÿ‡ญ', + countryCode: 'GH', + countryName: 'Ghana', + callingCode: '233', + regex: '^(+233|233)?[2-9]d{7}$', + }, + GR: { + icon: '๐Ÿ‡ฌ๐Ÿ‡ท', + countryCode: 'GR', + countryName: 'Greece', + callingCode: '30', + regex: '^(+30|30)?[1-9]d{8}$', + }, + GD: { + icon: '๐Ÿ‡ฌ๐Ÿ‡ฉ', + countryCode: 'GD', + countryName: 'Grenada', + callingCode: '1-473', + regex: '^(+1-473|1-473)?[1-9]d{6}$', + }, + GU: { + icon: '๐Ÿ‡ฌ๐Ÿ‡บ', + countryCode: 'GU', + countryName: 'Guam', + callingCode: '1-671', + regex: '^(+1-671|1-671)?[1-9]d{6}$', + }, + GT: { + icon: '๐Ÿ‡ฌ๐Ÿ‡น', + countryCode: 'GT', + countryName: 'Guatemala', + callingCode: '502', + regex: '^(+502|502)?[2-9]d{7}$', + }, + GN: { + icon: '๐Ÿ‡ฌ๐Ÿ‡ณ', + countryCode: 'GN', + countryName: 'Guinea', + callingCode: '224', + regex: '^(+224|224)?[2-9]d{7}$', + }, + GW: { + icon: '๐Ÿ‡ฌ๐Ÿ‡ผ', + countryCode: 'GW', + countryName: 'Guinea-Bissau', + callingCode: '245', + regex: '^(+245|245)?[2-9]d{7}$', + }, + GY: { + icon: '๐Ÿ‡ฌ๐Ÿ‡พ', + countryCode: 'GY', + countryName: 'Guyana', + callingCode: '592', + regex: '^(+592|592)?[2-9]d{7}$', + }, + HT: { + icon: '๐Ÿ‡ญ๐Ÿ‡น', + countryCode: 'HT', + countryName: 'Haiti', + callingCode: '509', + regex: '^(+509|509)?[2-9]d{7}$', + }, + HN: { + icon: '๐Ÿ‡ญ๐Ÿ‡ณ', + countryCode: 'HN', + countryName: 'Honduras', + callingCode: '504', + regex: '^(+504|504)?[2-9]d{7}$', + }, + HU: { + icon: '๐Ÿ‡ญ๐Ÿ‡บ', + countryCode: 'HU', + countryName: 'Hungary', + callingCode: '36', + regex: '^(+36|36)?[1-9]d{7}$', + }, + IS: { + icon: '๐Ÿ‡ฎ๐Ÿ‡ธ', + countryCode: 'IS', + countryName: 'Iceland', + callingCode: '354', + regex: '^(+354|354)?[1-9]d{6}$', + }, + IN: { + icon: '๐Ÿ‡ฎ๐Ÿ‡ณ', + countryCode: 'IN', + countryName: 'India', + callingCode: '91', + regex: '^(+91|91)?[7-9]d{9}$', + }, + ID: { + icon: '๐Ÿ‡ฎ๐Ÿ‡ฉ', + countryCode: 'ID', + countryName: 'Indonesia', + callingCode: '62', + regex: '^(+62|62)?[1-9]d{8,9}$', + }, + IR: { + icon: '๐Ÿ‡ฎ๐Ÿ‡ท', + countryCode: 'IR', + countryName: 'Iran', + callingCode: '98', + regex: '^(+98|98)?[1-9]d{8}$', + }, + IQ: { + icon: '๐Ÿ‡ฎ๐Ÿ‡ถ', + countryCode: 'IQ', + countryName: 'Iraq', + callingCode: '964', + regex: '^(+964|964)?[7-9]d{8}$', + }, + IE: { + icon: '๐Ÿ‡ฎ๐Ÿ‡ช', + countryCode: 'IE', + countryName: 'Ireland', + callingCode: '353', + regex: '^(+353|353)?[1-9]d{7}$', + }, + IL: { + icon: '๐Ÿ‡ฎ๐Ÿ‡ฑ', + countryCode: 'IL', + countryName: 'Israel', + callingCode: '972', + regex: '^(+972|972)?[2-9]d{7}$', + }, + IT: { + icon: '๐Ÿ‡ฎ๐Ÿ‡น', + countryCode: 'IT', + countryName: 'Italy', + callingCode: '39', + regex: '^(+39|39)?[1-9]d{8}$', + }, + JM: { + icon: '๐Ÿ‡ฏ๐Ÿ‡ฒ', + countryCode: 'JM', + countryName: 'Jamaica', + callingCode: '1876', + regex: '^(+1876|1876)?[1-9]d{6}$', + }, + JP: { + icon: '๐Ÿ‡ฏ๐Ÿ‡ต', + countryCode: 'JP', + countryName: 'Japan', + callingCode: '81', + regex: '^(+81|81)?[1-9]d{8}$', + }, + JO: { + icon: '๐Ÿ‡ฏ๐Ÿ‡ด', + countryCode: 'JO', + countryName: 'Jordan', + callingCode: '962', + regex: '^(+962|962)?[7-9]d{8}$', + }, + KZ: { + icon: '๐Ÿ‡ฐ๐Ÿ‡ฟ', + countryCode: 'KZ', + countryName: 'Kazakhstan', + callingCode: '7', + regex: '^(+7|7)?[1-9]d{9}$', + }, + KE: { + icon: '๐Ÿ‡ฐ๐Ÿ‡ช', + countryCode: 'KE', + countryName: 'Kenya', + callingCode: '254', + regex: '^(+254|254)?[7-9]d{8}$', + }, + KI: { + icon: '๐Ÿ‡ฐ๐Ÿ‡ฎ', + countryCode: 'KI', + countryName: 'Kiribati', + callingCode: '686', + regex: '^(+686|686)?[2-9]d{5}$', + }, + KW: { + icon: '๐Ÿ‡ฐ๐Ÿ‡ผ', + countryCode: 'KW', + countryName: 'Kuwait', + callingCode: '965', + regex: '^(+965|965)?[2-9]d{6}$', + }, + KG: { + icon: '๐Ÿ‡ฐ๐Ÿ‡ฌ', + countryCode: 'KG', + countryName: 'Kyrgyzstan', + callingCode: '996', + regex: '^(+996|996)?[7-9]d{8}$', + }, + LA: { + icon: '๐Ÿ‡ฑ๐Ÿ‡ธ', + countryCode: 'LA', + countryName: 'Lesotho', + callingCode: '266', + regex: '^(+266|266)?[2-8]d{6}$', + }, + LV: { + icon: '๐Ÿ‡ฑ๐Ÿ‡ป', + countryCode: 'LV', + countryName: 'Latvia', + callingCode: '371', + regex: '^(+371|371)?[2-9]d{7}$', + }, + LB: { + icon: '๐Ÿ‡ฑ๐Ÿ‡ง', + countryCode: 'LB', + countryName: 'Lebanon', + callingCode: '961', + regex: '^(+961|961)?[1-9]d{7}$', + }, + LS: { + icon: '๐Ÿ‡ฑ๐Ÿ‡ธ', + countryCode: 'LS', + countryName: 'Lesotho', + callingCode: '266', + regex: '^(+266|266)?[2-9]d{6}$', + }, + LR: { + icon: '๐Ÿ‡ฑ๐Ÿ‡ท', + countryCode: 'LR', + countryName: 'Liberia', + callingCode: '231', + regex: '^(+231|231)?[2-9]d{7}$', + }, + LY: { + icon: '๐Ÿ‡ฑ๐Ÿ‡พ', + countryCode: 'LY', + countryName: 'Libya', + callingCode: '218', + regex: '^(+218|218)?[2-9]d{7}$', + }, + LI: { + icon: '๐Ÿ‡ฑ๐Ÿ‡ฎ', + countryCode: 'LI', + countryName: 'Liechtenstein', + callingCode: '423', + regex: '^(+423|423)?[2-9]d{6}$', + }, + LT: { + icon: '๐Ÿ‡ฑ๐Ÿ‡น', + countryCode: 'LT', + countryName: 'Lithuania', + callingCode: '370', + regex: '^(+370|370)?[6-9]d{7}$', + }, + LU: { + icon: '๐Ÿ‡ฑ๐Ÿ‡บ', + countryCode: 'LU', + countryName: 'Luxembourg', + callingCode: '352', + regex: '^(+352|352)?[2-9]d{6}$', + }, + MO: { + icon: '๐Ÿ‡ฒ๐Ÿ‡ด', + countryCode: 'MO', + countryName: 'Macau', + callingCode: '853', + regex: '^(+853|853)?[6-9]d{5}$', + }, + MK: { + icon: '๐Ÿ‡ฒ๐Ÿ‡ฐ', + countryCode: 'MK', + countryName: 'North Macedonia', + callingCode: '389', + regex: '^(+389|389)?[7-9]d{7}$', + }, + MG: { + icon: '๐Ÿ‡ฒ๐Ÿ‡ฌ', + countryCode: 'MG', + countryName: 'Madagascar', + callingCode: '261', + regex: '^(+261|261)?[3-9]d{7}$', + }, + MW: { + icon: '๐Ÿ‡ฒ๐Ÿ‡ผ', + countryCode: 'MW', + countryName: 'Malawi', + callingCode: '265', + regex: '^(+265|265)?[2-9]d{7}$', + }, + MY: { + icon: '๐Ÿ‡ฒ๐Ÿ‡พ', + countryCode: 'MY', + countryName: 'Malaysia', + callingCode: '60', + regex: '^(+60|60)?[1-9]d{7}$', + }, + MV: { + icon: '๐Ÿ‡ฒ๐Ÿ‡ป', + countryCode: 'MV', + countryName: 'Maldives', + callingCode: '960', + regex: '^(+960|960)?[2-9]d{6}$', + }, + ML: { + icon: '๐Ÿ‡ฒ๐Ÿ‡ฑ', + countryCode: 'ML', + countryName: 'Mali', + callingCode: '223', + regex: '^(+223|223)?[6-9]d{7}$', + }, + MT: { + icon: '๐Ÿ‡ฒ๐Ÿ‡น', + countryCode: 'MT', + countryName: 'Malta', + callingCode: '356', + regex: '^(+356|356)?[2-9]d{7}$', + }, + MH: { + icon: '๐Ÿ‡ฒ๐Ÿ‡ญ', + countryCode: 'MH', + countryName: 'Marshall Islands', + callingCode: '692', + regex: '^(+692|692)?[2-9]d{5}$', + }, + MR: { + icon: '๐Ÿ‡ฒ๐Ÿ‡ท', + countryCode: 'MR', + countryName: 'Mauritania', + callingCode: '222', + regex: '^(+222|222)?[2-9]d{7}$', + }, + MU: { + icon: '๐Ÿ‡ฒ๐Ÿ‡บ', + countryCode: 'MU', + countryName: 'Mauritius', + callingCode: '230', + regex: '^(+230|230)?[5-9]d{5}$', + }, + YT: { + icon: '๐Ÿ‡พ๐Ÿ‡น', + countryCode: 'YT', + countryName: 'Mayotte', + callingCode: '262', + regex: '^(+262|262)?[2-9]d{6}$', + }, + MX: { + icon: '๐Ÿ‡ฒ๐Ÿ‡ฝ', + countryCode: 'MX', + countryName: 'Mexico', + callingCode: '52', + regex: '^(+52|52)?[1-9]d{9}$', + }, + FM: { + icon: '๐Ÿ‡ซ๐Ÿ‡ฒ', + countryCode: 'FM', + countryName: 'Micronesia', + callingCode: '691', + regex: '^(+691|691)?[2-9]d{5}$', + }, + MD: { + icon: '๐Ÿ‡ฒ๐Ÿ‡ฉ', + countryCode: 'MD', + countryName: 'Moldova', + callingCode: '373', + regex: '^(+373|373)?[2-9]d{7}$', + }, + MC: { + icon: '๐Ÿ‡ฒ๐Ÿ‡จ', + countryCode: 'MC', + countryName: 'Monaco', + callingCode: '377', + regex: '^(+377|377)?[2-9]d{6}$', + }, + MN: { + icon: '๐Ÿ‡ฒ๐Ÿ‡ณ', + countryCode: 'MN', + countryName: 'Mongolia', + callingCode: '976', + regex: '^(+976|976)?[1-9]d{7}$', + }, + ME: { + icon: '๐Ÿ‡ฒ๐Ÿ‡ช', + countryCode: 'ME', + countryName: 'Montenegro', + callingCode: '382', + regex: '^(+382|382)?[2-9]d{7}$', + }, + MS: { + icon: '๐Ÿ‡ฒ๐Ÿ‡ธ', + countryCode: 'MS', + countryName: 'Montserrat', + callingCode: '1-664', + regex: '^(+1-664|1-664)?[1-9]d{6}$', + }, + MA: { + icon: '๐Ÿ‡ฒ๐Ÿ‡ฆ', + countryCode: 'MA', + countryName: 'Morocco', + callingCode: '212', + regex: '^(+212|212)?[6-7]d{8}$', + }, + MZ: { + icon: '๐Ÿ‡ฒ๐Ÿ‡ฟ', + countryCode: 'MZ', + countryName: 'Mozambique', + callingCode: '258', + regex: '^(+258|258)?[8-9]d{7}$', + }, + MM: { + icon: '๐Ÿ‡ฒ๐Ÿ‡ฒ', + countryCode: 'MM', + countryName: 'Myanmar', + callingCode: '95', + regex: '^(+95|95)?[9]d{7}$', + }, + NA: { + icon: '๐Ÿ‡ณ๐Ÿ‡ฆ', + countryCode: 'NA', + countryName: 'Namibia', + callingCode: '264', + regex: '^(+264|264)?[1-9]d{7}$', + }, + NR: { + icon: '๐Ÿ‡ณ๐Ÿ‡ท', + countryCode: 'NR', + countryName: 'Nauru', + callingCode: '674', + regex: '^(+674|674)?[2-9]d{5}$', + }, + NP: { + icon: '๐Ÿ‡ณ๐Ÿ‡ต', + countryCode: 'NP', + countryName: 'Nepal', + callingCode: '977', + regex: '^(+977|977)?[1-9]d{8}$', + }, + NL: { + icon: '๐Ÿ‡ณ๐Ÿ‡ฑ', + countryCode: 'NL', + countryName: 'Netherlands', + callingCode: '31', + regex: '^(+31|31)?[1-9]d{8}$', + }, + NZ: { + icon: '๐Ÿ‡ณ๐Ÿ‡ฟ', + countryCode: 'NZ', + countryName: 'New Zealand', + callingCode: '64', + regex: '^(+64|64)?[2-9]d{7}$', + }, + NI: { + icon: '๐Ÿ‡ณ๐Ÿ‡ฎ', + countryCode: 'NI', + countryName: 'Nicaragua', + callingCode: '505', + regex: '^(+505|505)?[2-9]d{7}$', + }, + NE: { + icon: '๐Ÿ‡ณ๐Ÿ‡ช', + countryCode: 'NE', + countryName: 'Niger', + callingCode: '227', + regex: '^(+227|227)?[7-9]d{7}$', + }, + NG: { + icon: '๐Ÿ‡ณ๐Ÿ‡ฌ', + countryCode: 'NG', + countryName: 'Nigeria', + callingCode: '234', + regex: '^(+234|234)?[7-9]d{9}$', + }, + KP: { + icon: '๐Ÿ‡ฐ๐Ÿ‡ต', + countryCode: 'KP', + countryName: 'North Korea', + callingCode: '850', + regex: '^(+850|850)?[1-9]d{7}$', + }, + NO: { + icon: '๐Ÿ‡ณ๐Ÿ‡ด', + countryCode: 'NO', + countryName: 'Norway', + callingCode: '47', + regex: '^(+47|47)?[2-9]d{7}$', + }, + OM: { + icon: '๐Ÿ‡ด๐Ÿ‡ฒ', + countryCode: 'OM', + countryName: 'Oman', + callingCode: '968', + regex: '^(+968|968)?[7-9]d{7}$', + }, + PK: { + icon: '๐Ÿ‡ต๐Ÿ‡ฐ', + countryCode: 'PK', + countryName: 'Pakistan', + callingCode: '92', + regex: '^(+92|92)?[3-9]d{9}$', + }, + PA: { + icon: '๐Ÿ‡ต๐Ÿ‡ฆ', + countryCode: 'PA', + countryName: 'Panama', + callingCode: '507', + regex: '^(+507|507)?[2-9]d{7}$', + }, + PG: { + icon: '๐Ÿ‡ต๐Ÿ‡ฌ', + countryCode: 'PG', + countryName: 'Papua New Guinea', + callingCode: '675', + regex: '^(+675|675)?[2-9]d{6}$', + }, + PY: { + icon: '๐Ÿ‡ต๐Ÿ‡พ', + countryCode: 'PY', + countryName: 'Paraguay', + callingCode: '595', + regex: '^(+595|595)?[1-9]d{7}$', + }, + PE: { + icon: '๐Ÿ‡ต๐Ÿ‡ช', + countryCode: 'PE', + countryName: 'Peru', + callingCode: '51', + regex: '^(+51|51)?[9]d{8}$', + }, + PH: { + icon: '๐Ÿ‡ต๐Ÿ‡ญ', + countryCode: 'PH', + countryName: 'Philippines', + callingCode: '63', + regex: '^(+63|63)?[9]d{9}$', + }, + PL: { + icon: '๐Ÿ‡ต๐Ÿ‡ฑ', + countryCode: 'PL', + countryName: 'Poland', + callingCode: '48', + regex: '^(+48|48)?[1-9]d{8}$', + }, + PT: { + icon: '๐Ÿ‡ต๐Ÿ‡น', + countryCode: 'PT', + countryName: 'Portugal', + callingCode: '351', + regex: '^(+351|351)?[2-9]d{8}$', + }, + PR: { + icon: '๐Ÿ‡ต๐Ÿ‡ท', + countryCode: 'PR', + countryName: 'Puerto Rico', + callingCode: '1787', + regex: '^(+1787|1787)?[1-9]d{6}$', + }, + QA: { + icon: '๐Ÿ‡ถ๐Ÿ‡ฆ', + countryCode: 'QA', + countryName: 'Qatar', + callingCode: '974', + regex: '^(+974|974)?[3-9]d{7}$', + }, + RO: { + icon: '๐Ÿ‡ท๐Ÿ‡ด', + countryCode: 'RO', + countryName: 'Romania', + callingCode: '40', + regex: '^(+40|40)?[1-9]d{8}$', + }, + RU: { + icon: '๐Ÿ‡ท๐Ÿ‡บ', + countryCode: 'RU', + countryName: 'Russia', + callingCode: '7', + regex: '^(+7|7)?[1-9]d{9}$', + }, + RW: { + icon: '๐Ÿ‡ท๐Ÿ‡ผ', + countryCode: 'RW', + countryName: 'Rwanda', + callingCode: '250', + regex: '^(+250|250)?[7-9]d{8}$', + }, + KN: { + icon: '๐Ÿ‡ฐ๐Ÿ‡ณ', + countryCode: 'KN', + countryName: 'Saint Kitts and Nevis', + callingCode: '1869', + regex: '^(+1869|1869)?[2-9]d{6}$', + }, + SC: { + icon: '๐Ÿ‡ธ๐Ÿ‡จ', + countryCode: 'SC', + countryName: 'Seychelles', + callingCode: '248', + regex: '^(+248|248)?[2-9]d{6}$', + }, + LC: { + icon: '๐Ÿ‡ฑ๐Ÿ‡จ', + countryCode: 'LC', + countryName: 'Saint Lucia', + callingCode: '1758', + regex: '^(+1758|1758)?[2-9]d{6}$', + }, + SM: { + icon: '๐Ÿ‡ธ๐Ÿ‡ฒ', + countryCode: 'SM', + countryName: 'San Marino', + callingCode: '378', + regex: '^(+378|378)?[2-9]d{5}$', + }, + ST: { + icon: '๐Ÿ‡ธ๐Ÿ‡น', + countryCode: 'ST', + countryName: 'Sรฃo Tomรฉ and Prรญncipe', + callingCode: '239', + regex: '^(+239|239)?[2-9]d{6}$', + }, + SA: { + icon: '๐Ÿ‡ธ๐Ÿ‡ฆ', + countryCode: 'SA', + countryName: 'Saudi Arabia', + callingCode: '966', + regex: '^(+966|966)?[5-9]d{8}$', + }, + SN: { + icon: '๐Ÿ‡ธ๐Ÿ‡ณ', + countryCode: 'SN', + countryName: 'Senegal', + callingCode: '221', + regex: '^(+221|221)?[7-9]d{7}$', + }, + RS: { + icon: '๐Ÿ‡ท๐Ÿ‡ธ', + countryCode: 'RS', + countryName: 'Serbia', + callingCode: '381', + regex: '^(+381|381)?[2-9]d{8}$', + }, + SG: { + icon: '๐Ÿ‡ธ๐Ÿ‡ฌ', + countryCode: 'SG', + countryName: 'Singapore', + callingCode: '65', + regex: '^(+65|65)?[3-9]d{7}$', + }, + SX: { + icon: '๐Ÿ‡ธ๐Ÿ‡ฝ', + countryCode: 'SX', + countryName: 'Sint Maarten', + callingCode: '1721', + regex: '^(+1721|1721)?[2-9]d{6}$', + }, + SK: { + icon: '๐Ÿ‡ธ๐Ÿ‡ฐ', + countryCode: 'SK', + countryName: 'Slovakia', + callingCode: '421', + regex: '^(+421|421)?[2-9]d{8}$', + }, + SI: { + icon: '๐Ÿ‡ธ๐Ÿ‡ฎ', + countryCode: 'SI', + countryName: 'Slovenia', + callingCode: '386', + regex: '^(+386|386)?[2-9]d{7}$', + }, + SO: { + icon: '๐Ÿ‡ธ๐Ÿ‡ด', + countryCode: 'SO', + countryName: 'Somalia', + callingCode: '252', + regex: '^(+252|252)?[2-9]d{7}$', + }, + ZA: { + icon: '๐Ÿ‡ฟ๐Ÿ‡ฆ', + countryCode: 'ZA', + countryName: 'South Africa', + callingCode: '27', + regex: '^(+27|27)?[6-9]d{8}$', + }, + KR: { + icon: '๐Ÿ‡ฐ๐Ÿ‡ท', + countryCode: 'KR', + countryName: 'South Korea', + callingCode: '82', + regex: '^(+82|82)?[1-9]d{8}$', + }, + SS: { + icon: '๐Ÿ‡ธ๐Ÿ‡ธ', + countryCode: 'SS', + countryName: 'South Sudan', + callingCode: '211', + regex: '^(+211|211)?[1-9]d{8}$', + }, + ES: { + icon: '๐Ÿ‡ช๐Ÿ‡ธ', + countryCode: 'ES', + countryName: 'Spain', + callingCode: '34', + regex: '^(+34|34)?[6-9]d{8}$', + }, + LK: { + icon: '๐Ÿ‡ฑ๐Ÿ‡ฐ', + countryCode: 'LK', + countryName: 'Sri Lanka', + callingCode: '94', + regex: '^(+94|94)?[7-9]d{8}$', + }, + SD: { + icon: '๐Ÿ‡ธ๐Ÿ‡ฉ', + countryCode: 'SD', + countryName: 'Sudan', + callingCode: '249', + regex: '^(+249|249)?[1-9]d{8}$', + }, + SR: { + icon: '๐Ÿ‡ธ๐Ÿ‡ท', + countryCode: 'SR', + countryName: 'Suriname', + callingCode: '597', + regex: '^(+597|597)?[7-9]d{6}$', + }, + SZ: { + icon: '๐Ÿ‡ธ๐Ÿ‡ฟ', + countryCode: 'SZ', + countryName: 'Eswatini', + callingCode: '268', + regex: '^(+268|268)?[2-9]d{6}$', + }, + SE: { + icon: '๐Ÿ‡ธ๐Ÿ‡ช', + countryCode: 'SE', + countryName: 'Sweden', + callingCode: '46', + regex: '^(+46|46)?[2-9]d{7}$', + }, + CH: { + icon: '๐Ÿ‡จ๐Ÿ‡ญ', + countryCode: 'CH', + countryName: 'Switzerland', + callingCode: '41', + regex: '^(+41|41)?[2-9]d{7}$', + }, + SY: { + icon: '๐Ÿ‡ธ๐Ÿ‡พ', + countryCode: 'SY', + countryName: 'Syria', + callingCode: '963', + regex: '^(+963|963)?[1-9]d{8}$', + }, + TJ: { + icon: '๐Ÿ‡น๐Ÿ‡ฏ', + countryCode: 'TJ', + countryName: 'Tajikistan', + callingCode: '992', + regex: '^(+992|992)?[9]d{8}$', + }, + TZ: { + icon: '๐Ÿ‡น๐Ÿ‡ฟ', + countryCode: 'TZ', + countryName: 'Tanzania', + callingCode: '255', + regex: '^(+255|255)?[7-9]d{8}$', + }, + TH: { + icon: '๐Ÿ‡น๐Ÿ‡ญ', + countryCode: 'TH', + countryName: 'Thailand', + callingCode: '66', + regex: '^(+66|66)?[8-9]d{8}$', + }, + TG: { + icon: '๐Ÿ‡น๐Ÿ‡ฌ', + countryCode: 'TG', + countryName: 'Togo', + callingCode: '228', + regex: '^(+228|228)?[2-9]d{6}$', + }, + TO: { + icon: '๐Ÿ‡น๐Ÿ‡ด', + countryCode: 'TO', + countryName: 'Tonga', + callingCode: '676', + regex: '^(+676|676)?[2-9]d{5}$', + }, + TT: { + icon: '๐Ÿ‡น๐Ÿ‡น', + countryCode: 'TT', + countryName: 'Trinidad and Tobago', + callingCode: '1868', + regex: '^(+1868|1868)?[2-9]d{6}$', + }, + TN: { + icon: '๐Ÿ‡น๐Ÿ‡ณ', + countryCode: 'TN', + countryName: 'Tunisia', + callingCode: '216', + regex: '^(+216|216)?[2-9]d{7}$', + }, + TR: { + icon: '๐Ÿ‡น๐Ÿ‡ท', + countryCode: 'TR', + countryName: 'Turkey', + callingCode: '90', + regex: '^(+90|90)?[5-9]d{9}$', + }, + TM: { + icon: '๐Ÿ‡น๐Ÿ‡ฒ', + countryCode: 'TM', + countryName: 'Turkmenistan', + callingCode: '993', + regex: '^(+993|993)?[1-9]d{8}$', + }, + TV: { + icon: '๐Ÿ‡น๐Ÿ‡ป', + countryCode: 'TV', + countryName: 'Tuvalu', + callingCode: '688', + regex: '^(+688|688)?[2-9]d{5}$', + }, + UG: { + icon: '๐Ÿ‡บ๐Ÿ‡ฌ', + countryCode: 'UG', + countryName: 'Uganda', + callingCode: '256', + regex: '^(+256|256)?[7-9]d{8}$', + }, + UA: { + icon: '๐Ÿ‡บ๐Ÿ‡ฆ', + countryCode: 'UA', + countryName: 'Ukraine', + callingCode: '380', + regex: '^(+380|380)?[1-9]d{8}$', + }, + AE: { + icon: '๐Ÿ‡ฆ๐Ÿ‡ช', + countryCode: 'AE', + countryName: 'United Arab Emirates', + callingCode: '971', + regex: '^(+971|971)?[5-9]d{7}$', + }, + GB: { + icon: '๐Ÿ‡ฌ๐Ÿ‡ง', + countryCode: 'GB', + countryName: 'United Kingdom', + callingCode: '44', + regex: '^(+44|44)?[1-9]d{8}$', + }, + US: { + icon: '๐Ÿ‡บ๐Ÿ‡ธ', + countryCode: 'US', + countryName: 'United States', + callingCode: '1', + regex: '^(+1|1)?[2-9]d{9}$', + }, + UY: { + icon: '๐Ÿ‡บ๐Ÿ‡พ', + countryCode: 'UY', + countryName: 'Uruguay', + callingCode: '598', + regex: '^(+598|598)?[2-9]d{7}$', + }, + UZ: { + icon: '๐Ÿ‡บ๐Ÿ‡ฟ', + countryCode: 'UZ', + countryName: 'Uzbekistan', + callingCode: '998', + regex: '^(+998|998)?[1-9]d{8}$', + }, + VU: { + icon: '๐Ÿ‡ป๐Ÿ‡บ', + countryCode: 'VU', + countryName: 'Vanuatu', + callingCode: '678', + regex: '^(+678|678)?[2-9]d{5}$', + }, + VE: { + icon: '๐Ÿ‡ป๐Ÿ‡ช', + countryCode: 'VE', + countryName: 'Venezuela', + callingCode: '58', + regex: '^(+58|58)?[4-9]d{8}$', + }, + VN: { + icon: '๐Ÿ‡ป๐Ÿ‡ณ', + countryCode: 'VN', + countryName: 'Vietnam', + callingCode: '84', + regex: '^(+84|84)?[1-9]d{8}$', + }, + WF: { + icon: '๐Ÿ‡ผ๐Ÿ‡ซ', + countryCode: 'WF', + countryName: 'Wallis and Futuna', + callingCode: '681', + regex: '^(+681|681)?[2-9]d{5}$', + }, + YE: { + icon: '๐Ÿ‡พ๐Ÿ‡ช', + countryCode: 'YE', + countryName: 'Yemen', + callingCode: '967', + regex: '^(+967|967)?[1-9]d{7}$', + }, + ZM: { + icon: '๐Ÿ‡ฟ๐Ÿ‡ฒ', + countryCode: 'ZM', + countryName: 'Zambia', + callingCode: '260', + regex: '^(+260|260)?[9]d{8}$', + }, + ZW: { + icon: '๐Ÿ‡ฟ๐Ÿ‡ผ', + countryCode: 'ZW', + countryName: 'Zimbabwe', + callingCode: '263', + regex: '^(+263|263)?[7-9]d{8}$', + }, +}; + +export default constants; diff --git a/src/main/country-picker/CountryPickerModal.tsx b/src/main/country-picker/CountryPickerModal.tsx new file mode 100644 index 0000000..8cf3b87 --- /dev/null +++ b/src/main/country-picker/CountryPickerModal.tsx @@ -0,0 +1,60 @@ +import React, { useRef, useState } from 'react'; +import { Animated, Dimensions, StatusBar, useColorScheme } from 'react-native'; +import { pickerStyles } from './styles/picker.style'; + +const { height } = Dimensions.get('window'); +interface props { + component?: React.FC; + componentProps?: any; +} +declare global { + var openCountryModal: (value: props) => void; +} + +const CountryPickerModal: React.FC = () => { + const scheme = useColorScheme(); + const styles = pickerStyles(scheme); + const [isOpen, setIsOpen] = useState(false); + const animationValue = useState(new Animated.Value(height))[0]; + const statusBarHeight = StatusBar.currentHeight || 0; + const componentRef = useRef(); + global.openCountryModal = ({ component = null, componentProps = null }) => { + toggleAnimation(); + component + ? (componentRef.current = { component, componentProps }) + : (componentRef.current = null); + }; + + const toggleAnimation = () => { + if (isOpen) { + Animated.spring(animationValue, { + toValue: height, + friction: 8, + tension: 50, + useNativeDriver: true, + }).start(() => setIsOpen(false)); + } else { + setIsOpen(true); + Animated.spring(animationValue, { + toValue: statusBarHeight, + friction: 8, + tension: 50, + useNativeDriver: true, + }).start(); + } + }; + + const animatedStyle = { + transform: [{ translateY: animationValue }], + }; + const Component = componentRef.current?.component; + return ( + + {Component && isOpen && ( + + )} + + ); +}; + +export default CountryPickerModal; diff --git a/src/main/country-picker/Picker.d.ts b/src/main/country-picker/Picker.d.ts new file mode 100644 index 0000000..f697776 --- /dev/null +++ b/src/main/country-picker/Picker.d.ts @@ -0,0 +1,12 @@ +import type { EachCountry } from '../constants/constants.d'; + +interface PickerProps { + onSelect: (value: EachCountry) => void; +} + +interface EachOptionProps { + onSelect?: (value: EachCountry) => void; + item: EachCountry; + index: number; +} +export type { PickerProps, EachOptionProps }; diff --git a/src/main/country-picker/Picker.tsx b/src/main/country-picker/Picker.tsx new file mode 100644 index 0000000..ebc7ec4 --- /dev/null +++ b/src/main/country-picker/Picker.tsx @@ -0,0 +1,104 @@ +import { + Text, + FlatList, + TouchableOpacity, + View, + TextInput, + Image, + useColorScheme, +} from 'react-native'; +import React, {useState} from 'react'; +import constants from '../constants/constants'; +import { customBorder, pickerStyles } from './styles/picker.style'; +import assets from '../assets/assets'; +import type { EachOptionProps, PickerProps } from './Picker'; + +const EachOption: React.FC = ({onSelect, item, index}) => { + const [select, setSelect] = useState(false); + const scheme = useColorScheme(); + const styles = pickerStyles(scheme); + const onPress = () => { + setSelect(!select); + onSelect && onSelect(item); + global.openCountryModal({}); + }; + return ( + + + {item?.icon} + {' '} + {item?.countryName} + {' '}+{item?.callingCode} + + + ); +}; + +const Picker: React.FC = ({onSelect}) => { + const scheme = useColorScheme(); + const styles = pickerStyles(scheme); + const [country, setCountry] = useState(Object.values(constants)); + const handleChangeText = (text: string) => { + if (text === '') { + setCountry(Object.values(constants)); + return; + } + const filers = Object.values(constants).filter(item => + item.countryName?.toLowerCase().match(new RegExp(text.toLowerCase())), + ); + setCountry(filers); + }; + + return ( + + + global.openCountryModal({})} + children={ + + } + /> + + + index.toString()} + contentContainerStyle={styles.flatListContainer} + initialNumToRender={12} + renderItem={({item, index}: {item: any; index: number}) => { + return ( + + ); + }} + /> + + ); +}; + +export default Picker; diff --git a/src/main/country-picker/styles/picker.style.d.ts b/src/main/country-picker/styles/picker.style.d.ts new file mode 100644 index 0000000..617476c --- /dev/null +++ b/src/main/country-picker/styles/picker.style.d.ts @@ -0,0 +1,20 @@ +import { ColorSchemeName, StyleProp, TextStyle, ViewStyle } from 'react-native'; + +export declare const pickerStyles: (scheme: ColorSchemeName) => { + eachContainer: StyleProp; + eachTextContainer: StyleProp; + eachText: StyleProp; + searchInput: StyleProp; + container: StyleProp; + flatListContainer: StyleProp; + bgWhite: StyleProp; + flexRow: StyleProp; + iconButton: StyleProp; +}; + +export declare const customBorder: ( + index: number, + scheme: ColorSchemeName +) => { + border: StyleProp; +}; diff --git a/src/main/country-picker/styles/picker.style.ts b/src/main/country-picker/styles/picker.style.ts new file mode 100644 index 0000000..709c936 --- /dev/null +++ b/src/main/country-picker/styles/picker.style.ts @@ -0,0 +1,68 @@ +import { type ColorSchemeName, Dimensions, StyleSheet } from 'react-native'; +const { height } = Dimensions.get('window'); + +const pickerStyles = (scheme: ColorSchemeName) => + StyleSheet.create({ + eachContainer: { + flexDirection: 'row', + gap: 10, + justifyContent: 'space-between', + alignItems: 'center', + }, + eachTextContainer: { + color: scheme === 'dark' ? '#F8F8F8' : '#1B1D20', + fontSize: 18, + }, + eachText: { fontSize: 22, lineHeight: 0 }, + searchInput: { + flexGrow: 1, + fontSize: 16, + color: scheme !== 'dark' ? 'black' : 'white', + }, + container: { + position: 'absolute', + bottom: 0, + left: 0, + right: 0, + height: height - 64, + }, + flatListContainer: { + paddingTop: 8, + paddingBottom: 80, + }, + bgWhite: { + flex: 1, + backgroundColor: scheme === 'dark' ? 'black' : '#FAFAFB', + }, + flexRow: { + flexDirection: 'row', + alignItems: 'center', + gap: 10, + }, + iconButton: { + height: 48, + width: 48, + padding: 0, + borderRadius: 500, + alignItems: 'center', + justifyContent: 'center', + minWidth: 0, + }, + }); + +const customBorder = (index: number, scheme: ColorSchemeName) => + StyleSheet.create({ + border: { + paddingTop: index === 0 ? 0 : 16, + paddingRight: 20, + paddingBottom: 16, + paddingLeft: 20, + borderTopWidth: index === 0 ? 0 : 1, + borderTopColor: + index === 0 + ? '' + : `rgba(${scheme === 'dark' ? '255,255,255' : '0,0,0'},0.2)`, + }, + }); + +export { pickerStyles, customBorder };