React Native · Components
CountrySelect
Country picker: with flags, the country's name in the user's language and search.
Import
CountrySelect
componentCountry picker: with flags, the country's name in the user's language and search. Same API as CountrySelect on web; takes all props of Select. The value is the ISO 3166-1 alpha-2 code ("TR"). Search looks at the name, the code and the dialing code (+49); on a phone it opens from the bottom.
Examples
CountryFlag
componentCountry flag (a flag emoji; drawn by iOS and Android). Decorative; screen readers do not read it.
Examples
PhoneInput
componentPhone input with a country code: a flag + dialing code picker on the left, the number grouped in the country's format on the right. Same API as PhoneInput on web; the value is E.164 (+905321234567).
- A leading
0is dropped even if typed (0532…→+90532…). - Typing or pasting
+49 …or0049 …changes the country. - If the length does not fit the country's rule the field becomes invalid (on blur).
- The phone keyboard opens; iOS/Android autofill works.
- Binds inside a
Formwithname.
Examples
countryFlag
functionFlag emoji: countryFlag("TR") → "🇹🇷".
registerCountryNames
functionRegisters a language's country names for environments without Intl.DisplayNames (React Native's Hermes). @yasinsensoy/native registers Turkish and English itself; for another language pass { TR: "Turquía", … }.
countryName
functionThe country's name in the locale language; the code itself without a translation.
getCountries
functionAll countries, sorted by name in the locale language.
Examples
dialCodeOf
functionDialing code of a country ("TR" → "90"); undefined when unknown.
countryFromDialCode
functionFinds the country from the dialing code at the start of an international number (longest match). preferred is the country to prefer among those sharing a code (e.g. +1 US/Canada).
phonePlaceholder
functionNational number placeholder of a country ("(532) 123 45 67").
formatNationalNumber
functionGroups a national number with the country's pattern: "5321234567" → "(532) 123 45 67".
nationalDigits
functionReduces a national number typed by the user to digits; the leading 0 is dropped.
parsePhone
functionParses a phone number. When it starts with + or 00, the country comes from the dialing code; otherwise it counts as a national number of defaultCountry.
Examples
isValidNational
functionDoes the national number's length follow the country's rule?
isValidPhone
functionIs the number valid (a length check; it does not verify the number is in use)? Works with a schema on the server: z.string().refine((v) => isValidPhone(v), "Invalid number").
formatPhone
functionTurns an E.164 number into a readable form: "+905321234567" → "+90 (532) 123 45 67".
CountryFlagProps
interfaceProps of CountryFlag.
| Name | Type | Default | Description |
|---|---|---|---|
code | CountryCode | ISO 3166-1 alpha-2 code ("TR"). | |
size? | number | 18 | Size (pt). |
CountrySelectProps
interfaceProps of CountrySelect.
Extends: Omit<SingleSelectProps, "items" | "loadItems" | "multiple">
| Name | Type | Default | Description |
|---|---|---|---|
countries? | readonly CountryCode[] | Only these countries are listed (e.g. ["TR", "DE", "NL"]). | |
priority? | readonly CountryCode[] | Countries shown in a separate group at the top of the list (e.g. ["TR"]). | |
locale? | string | {@link UIProvider} `locale | Language of the country names. |
showDialCode? | boolean | false | Dialing code below the name (+90). |
PhoneInputProps
interfaceProps of PhoneInput.
Extends: FieldProps
| Name | Type | Default | Description |
|---|---|---|---|
ref? | Ref<TextInputRef> | Ref of the underlying text input. | |
value? | string | Number in controlled use (E.164, e.g. "+905321234567"). | |
defaultValue? | string | Initial number in uncontrolled use (E.164 or national). | |
onValueChange? | (value: string, phone: ParsedPhone) => void | When the number changes, with the E.164 value and the parse result. | |
defaultCountry? | CountryCode | "TR" | Country selected while the number is empty. |
onCountryChange? | (country: CountryCode) => void | When the country changes. | |
countries? | readonly CountryCode[] | Only these countries can be selected. | |
priority? | readonly CountryCode[] | [defaultCountry] | Countries shown at the top of the list. |
locale? | string | {@link UIProvider} `locale | Language of the country names. |
validate? | boolean | true | A number that does not fit the country's length rule makes the field invalid ("Geçerli bir telefon numarası gir"; on blur). |
placeholder? | string | Placeholder. Defaults to the country's example number. | |
variant? | FieldVariant | "outline" | Field appearance. |
onBlur? | (event: TextInputFocusEvent) => void | On blur. | |
style? | StyleProp<ViewStyle> | Container style. |
CountryCode
typeISO 3166-1 alpha-2 country code ("TR", "DE"…).
Country
interfaceInfo of a country.
| Name | Type | Description |
|---|---|---|
code | CountryCode | ISO 3166-1 alpha-2 code ("TR"). |
name | string | Name in the selected language ("Türkiye"). |
dialCode | string | International dialing code without + ("90"). |
flag | string | Flag emoji ("🇹🇷"). |
ParsedPhone
interfaceResult of parsePhone.
| Name | Type | Description |
|---|---|---|
country | CountryCode | Country code. |
dialCode | string | Calling code ("90"). |
national | string | National number, digits only ("5321234567"). |
e164 | string | E.164 form ("+905321234567"); "" when the number is empty. |
valid | boolean | Does the length follow the country's rule? |