New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-native-country-codes-picker

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-country-codes-picker

This lib. provide country iso picker with search functionality

  • 1.1.5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
13K
decreased by-17.02%
Maintainers
1
Weekly downloads
 
Created
Source

react-native-country-codes-picker

This lib. provide multi lang. country picker with search functionality. Fully crossplatform and supported on React-native and expo. Didn't find your country ? Just add the required countries or locales and make a PR.

Coming soon :)

  1. Custom list item rendering.
  2. Custom search input rendering.
  3. Custom styling.
  4. Picker types (modal, input). If you need input with search.
  5. Docs update/improve for the best user experience,

If you have something interesting ! Just write to us :)

Installation

npm i react-native-country-codes-picker

Example

ezgif com-gif-maker (5)

Basic usage

import {CountryPicker} from "react-native-country-codes-picker/components/CountryPicker";

export default function App() {
  const [show, setShow] = useState(false);
  const [countryCode, setCountryCode] = useState('');

  return (
    <View style={styles.container}>
      <TouchableOpacity
        onPress={() => setShow(true)}
        style={{
            width: '80%',
            height: 60,
            backgroundColor: 'black',
            padding: 10,
        }}
      >
        <Text style={{
            color: 'white',
            fontSize: 20
        }}>
            {countryCode}
        </Text>
      </TouchableOpacity>

      // For showing picker just put show state to show prop
      <CountryPicker
        show={show}
        // when picker button press you will get the country object with dial code
        pickerButtonOnPress={(item) => {
          setCountryCode(item.dial_code);
          setShow(false);
        }}
      />
    </View>
  );
}

Props

Below are the props you can pass to the React Component.

PropTypeDefaultExampleDescription
showbooleanThis prop using for displaying the modal. Put your show state here.
pickerButtonOnPressfunction(country) => setCode(country.dial_code)Put your function/functions here for getting country data from picker.
inputPlaceholderstringinputPlaceholder={'Your placeholder'}If you need a custom placeholder for your input you may need this prop.
searchMessagestringsearchMessage={'Some search message here'}If you want to customize search message just use this prop.
langstring'en'lang={'pl'}If you need to change the lang. just put one of supported lang. Or if you didn't find required lang just add them and make a PR :)

Keywords

FAQs

Package last updated on 25 Jul 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc