npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

react-native-country-phone-input

v1.0.3

Published

A customizable React Native component for selecting a country and entering a phone number. It provides a country picker with flags, country codes, and a phone input field.

Readme

react-native-country-phone-input

A customizable React Native component for country-based phone number input. This package provides a user-friendly interface for selecting countries and entering phone numbers with automatic country code handling. It includes features like country flag selection, search, and phone number formatting.

Features

  • Country Picker: Allows users to select their country from a list with flags.
  • Phone Number Input: Supports phone number entry with automatic country code formatting.
  • Search: Built-in search functionality to filter countries by name.
  • Customizable Styles: Highly customizable styles for various parts of the component.
  • Modal Animation: Smooth animations for showing and hiding the country picker modal.

Demo

Check out the demo videos to see how the react-native-country-phone-input component works:

For iOS:

iOS Demo Video

Or visit the demo on YouTube: Watch the iOS demo

For Android:

Android Demo Video

Or visit the demo on YouTube: Watch the Android demo


Installation

To install the package, run the following command in your project directory:

npm install react-native-country-phone-input

or

yarn add react-native-country-phone-input

Ensure you have the required dependencies:

  • react-native-vector-icons: Make sure this is installed for icon support.

Usage

Here's an example of how to use the react-native-country-phone-input component:

import React from "react";
import { View, StyleSheet } from "react-native";
import CountryPickerPhoneInput from "react-native-country-phone-input";

const App = () => {
  return (
    <View style={styles.container}>
      <CountryPickerPhoneInput
        onCountrySelect={(country) => {
          console.log(country);
        }}
        onPhoneNumberChange={(phone) => {
          console.log(phone);
        }}
        onFormattedPhoneNumberChange={(phone) => {
          console.log("onFormattedPhoneNumberChange", phone);
        }}
        containerStyle={{ borderColor: "#aaa" }}
        flagContainerStyle={{ backgroundColor: "#aaa" }}
        countryCodeStyle={{ color: "#aaa" }}
        phoneInputStyle={{ color: "#aaa" }}
        chevronColor={"#FFF"}
        chevronSize={22}
        closeIconSize={20}
        closeIconColor="#FFF"
        searchContainerStyle={{ borderColor: "#aaa", borderRadius: 50 }}
        placeholderTextColor="#aaa"
        searchIconColor="#aaa"
        searchInputStyle={{ color: "#aaa" }}
        countryItemStyle={{ backgroundColor: "#FFF" }}
        countryItemFlagStyle={{}}
        countryItemNameStyle={{ color: "#000" }}
        countryItemCodeStyle={{ color: "#000" }}
      />
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: "center",
    alignItems: "center",
  },
});

export default App;

Props

Here are the available props for the CountryPickerPhoneInput component:

| Prop | Type | Description | | ------------------------------ | ---------------------------------- | ---------------------------------------------------------------------------- | | defaultCountryCode | string | Default country code (e.g., 'US', 'PK'). Default is 'PK'. | | customCountries | Array<Country> | Custom list of countries (default uses countries.json). | | onCountrySelect | (country: Country) => void | Callback function that is triggered when a country is selected. | | onPhoneNumberChange | (phone: string) => void | Callback function that is triggered when the phone number changes. | | onFormattedPhoneNumberChange | (formattedPhone: string) => void | Callback function that is triggered when the formatted phone number changes. | | containerStyle | ViewStyle | Custom style for the container. | | flagContainerStyle | ViewStyle | Custom style for the flag container. | | countryCodeStyle | TextStyle | Custom style for the country code text. | | phoneInputStyle | TextStyle | Custom style for the phone input text. | | placeholder | string | Placeholder text for the phone input field. | | chevronColor | string | Color for the chevron icon. | | chevronSize | number | Size of the chevron icon. | | closeButtonStyle | ViewStyle | Custom style for the close button. | | closeIconColor | string | Color for the close icon. | | closeIconSize | number | Size of the close icon. | | searchContainerStyle | ViewStyle | Custom style for the search container. | | searchIconStyle | ViewStyle | Custom style for the search icon. | | searchIconColor | string | Color for the search icon. | | searchIconSize | number | Size of the search icon. | | searchInputStyle | TextStyle | Custom style for the search input field. | | countryItemStyle | ViewStyle | Custom style for each country item. | | countryItemFlagStyle | TextStyle | Custom style for the country flag in the list. | | countryItemNameStyle | TextStyle | Custom style for the country name in the list. | | countryItemCodeStyle | TextStyle | Custom style for the country code in the list. |

Country Data Format

The default country data is provided from a countries.json file. Each country object should have the following format:

{
  "name": "Pakistan",
  "code": "PK",
  "iso": "PK",
  "flag": "🇵🇰"
}

You can pass a custom list of countries using the customCountries prop.

License

This package is licensed under the MIT License.