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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@digieggs/rn-country-code-picker

v1.4.4

Published

A searchable dropdown component to select a country code for your phone number input.

Downloads

192

Readme

React Native Country Code Picker

You can read our article about this package: https://medium.com/digieggs/complete-guide-to-using-country-code-picker-in-your-react-native-projects-daedc55cc4c4

License: MIT npm npm

A searchable dropdown component to select a country code for your phone number input.

For Managed Workflow users using Expo

This component is not supported in the managed workflow for expo for the time being.

Getting started

npm install @digieggs/rn-country-code-picker

or

yarn add @digieggs/rn-country-code-picker

Also you need to manually install react-native-svg and react-native-localize libraries for the icons in the component

npm install react-native-svg react-native-localize

or

yarn add react-native-svg react-native-localize

For [email protected] or above

As [email protected] or above supports autolinking, so there is no need to run linking process. Read more about autolinking here.

iOS

CocoaPods on iOS needs this extra step

npx pod-install

Android

No additional step is required.

Usage

First of all, import the component.

import { CallingCodePicker } from '@digieggs/rn-country-code-picker';

Then use it like this.

const [selectedCallingCode, setSelectedCallingCode] = useState('');

return <CallingCodePicker onValueChange={callingCode => setSelectedCallingCode(callingCode)} />;

Props


Reference

Props

initialCountryCode

the ISO 3166-1 alpha-2 code (FR, US, CA) of the country that you would like to show initially. If you don't pass a value to this, the country code based on your device locale will be used.

| Type | Required | | ------ | -------- | | string | no |


onValueChange

Callback for when a country is selected.

  • callingCode: the calling code of the selected country

| Type | Required | | -------- | -------- | | function | Yes |


togglerContainerStyle

Style to apply to the toggler container.

| Type | Required | | --------- | -------- | | StyleProp | No |


togglerLabelStyle

Style to apply to the picker toggler label.

| Type | Required | | --------- | -------- | | StyleProp | No |


listContainerStyle

Style to apply to the list container.

| Type | Required | | --------- | -------- | | StyleProp | No |


searchInputStyle

Style to apply to the search input.

| Type | Required | | --------- | -------- | | StyleProp | No |


listStyle

Style to apply to the FlatList component.

| Type | Required | | --------- | -------- | | StyleProp | No |


pickerItemLabelStyle

Style to apply to each of the item labels.

| Type | Required | | --------- | -------- | | StyleProp | No |


pickerItemContainerStyle

Style to apply to each of the item container.

| Type | Required | | --------- | -------- | | StyleProp | No |


style

Style to apply to container.

| Type | Required | | --------- | -------- | | StyleProp | No |


isFlagVisible

Visibility of flag component.

| Type | Required | | ------- | -------- | | boolean | No |


Credits

  • https://www.countryflags.io/ (for the flags)
  • https://restcountries.eu/ (fetched the info in the countries.json from this api)