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-phone

v1.1.4

Published

A customizable and feature-rich phone input component for React Native applications

Readme

React Native Phone Documentation

Table of Contents

  1. Introduction
  2. Installation
  3. Components
  4. Usage
  5. Styling
  6. Validation
  7. Advanced Features
  8. API Reference
  9. Examples
  10. Troubleshooting

Introduction

React Native Phone is a comprehensive phone input solution for React Native applications. It provides a highly customizable phone number input component with international format support and country selection capabilities.

Key Features

  • International phone number formatting
  • Country selection with search
  • Custom styling support
  • Input validation
  • Dark mode support
  • TypeScript support
  • Performance optimized

Now you can buy me coffee

Demo

Video Demo

https://github.com/user-attachments/assets/f0ad4130-2e80-4438-8302-046566a76ab8

https://github.com/user-attachments/assets/db9ac983-9e61-4ded-b4ba-5ab1d5c5f613

The videos above demonstrate:

  • Phone number input with country selection
  • Real-time formatting
  • Country search functionality
  • Error handling
  • Disabled state behavior

The package works seamlessly on both iOS and Android platforms. As shown in the videos above, it features:

  • Country selection with flag display
  • Country-specific phone number formatting
  • Automatic formatting
  • Platform-specific keyboard
  • Clean and modern interface

Installation

Prerequisites

  • React Native >= 0.60.0
  • React >= 16.8.0

Install via npm

npm install react-native-phone

Install via yarn

yarn add react-native-phone

Basic Usage

import React, { useState } from 'react';
import { PhoneInput } from 'react-native-phone';

const PhoneInputExample = () => {
  const [phoneNumber, setPhoneNumber] = useState('');

  const handlePhoneChange = (value, country) => {
    setPhoneNumber(value);
  };

  return (
    <PhoneInput
      value={phoneNumber}
      onChange={handlePhoneChange}
      defaultCountry="TR"
      includeDialCode={true}
      disabled={false}
    />
  );
};

export default PhoneInputExample;

Components

The package consists of several key components:

1. PhoneInput

The main component that integrates all functionality.

import React, { useState } from 'react';
import { PhoneInput } from 'react-native-phone';

const PhoneInputExample = () => {
  const [phoneNumber, setPhoneNumber] = useState('');

  const handlePhoneChange = (value, country) => {
    setPhoneNumber(value);
  };

  return (
    <PhoneInput
      value={phoneNumber}
      onChange={handlePhoneChange}
      defaultCountry="US"
      includeDialCode={true}
    />
  );
};

image.png

2. CountryPickerModal

A modal component for country selection.

// Automatically integrated with PhoneInput
// Customizable through modalConfig
<PhoneInput
  modalConfig={{
    searchPlaceholder: "Search country",
    closeButtonText: "Close"
  }}
/>

3. CountryListItem

Individual country item component in the selection list.

// Customizable through countryListConfig
<PhoneInput
  countryListConfig={{
    showSeparator: true,
    nameStyle: { fontSize: 16 }
  }}
/>

Usage

Basic Usage

import React, { useState } from 'react';
import { PhoneInput } from 'react-native-phone';

const PhoneInputExample = () => {
  const [phoneNumber, setPhoneNumber] = useState('');

  const handlePhoneChange = (value, country) => {
    setPhoneNumber(value);
  };

  return (
    <PhoneInput
      value={phoneNumber}
      onChange={handlePhoneChange}
      defaultCountry="TR"
      includeDialCode={true}
      disabled={false}
    />
  );
};

Props Configuration

Required Props

  • value: Current phone number value
  • onChange: Callback function for value changes

Optional Props

  • defaultCountry: Default selected country (ISO 2 code)
  • includeDialCode: Include country dial code in value
  • label: Input label text
  • error: Error message
  • isError: Error state flag
  • disabled: When set to true, the input becomes read-only and country picker becomes disabled (default: false)

Styling

Basic Styling

<PhoneInput
  styles={{
    containerStyle: {
      borderRadius: 12,
      height: 56,
      width: "100%",
    },
    labelStyle: {
      fontSize: 18,
      fontWeight: 'bold',
    },
    inputStyle: {
      fontSize: 16,
      flex: 1,
    },
  }}
/>

Disabled State Styling

<PhoneInput
  disabled={true}
  styles={{
    containerStyle: {
      opacity: 0.7,
    },
  }}
/>