rn-phone-input-field
Version:
A React Native phone number input component built from scratch, featuring a text input for number entry, a custom dropdown for selecting country codes, and validation logic using regex or country-specific rules. It supports formatting, localization, and s
15 lines (14 loc) • 967 B
TypeScript
import type { CountryCode, EachCountry } from '../constants/constants.d';
export type ParsedPhoneValue = {
country?: EachCountry;
nationalNumber: string;
};
export declare const normalizeDigits: (value: string) => string;
export declare const normalizeCallingCode: (callingCode: string) => string;
export declare const normalizePhoneRegex: (regex: string) => string;
export declare const getCountryByCode: (code: CountryCode | string | undefined) => EachCountry;
export declare const toSelectedCountryPayload: (country: EachCountry) => Pick<EachCountry, 'countryCode' | 'callingCode'>;
export declare const parsePhoneValue: (value: string, defaultCountry?: CountryCode) => ParsedPhoneValue;
export declare const getMaxNationalNumberLength: (country: EachCountry) => number;
export declare const sanitizePhoneInputValue: (value: string, country: EachCountry) => string;
export declare const isValidForCountry: (country: EachCountry, value: string) => boolean;