1.1.2 • Published 3 years ago

react-native-region-country-picker v1.1.2

Weekly downloads
24
License
MIT
Repository
github
Last release
3 years ago

react-native-region-country-picker

Various country picker for iOS and Android

Demo

Getting started

$ npm install react-native-region-country-picker --save OR $ yarn add react-native-region-country-picker

Example

import CountryPicker from "react-native-region-country-picker";

let countryPickerRef = undefined;

// use countryPickerRef
countryPickerRef.open();
countryPickerRef.close();

<CountryPicker
  countryPickerRef={(ref: any) => {
    countryPickerRef = ref;
  }}
  enable={true}
  darkMode={false}
  countryCode={"US"}
  containerConfig={{
    showFlag: true,
    showCallingCode: true,
    showCountryName: true,
    showCountryCode: true,
  }}
  modalConfig={{
    showFlag: true,
    showCallingCode: true,
    showCountryName: true,
    showCountryCode: true,
  }}
  onSelectCountry={(data: any) => {
    console.log("DATA", data);
  }}
  onInit={(data: any) => {
    console.log("DATA", data);
  }}
  onOpen={() => {
    console.log("Open");
  }}
  onClose={() => {
    console.log("Close");
  }}
  containerStyle={{
    container: {},
    flagStyle: {},
    callingCodeStyle: {},
    countryCodeStyle: {},
    countryNameStyle: {},
  }}
  modalStyle={{
    container: {},
    searchStyle: {},
    tileStyle: {},
    itemStyle: {
      itemContainer: {},
      flagStyle: {},
      countryCodeStyle: {},
      countryNameStyle: {},
      callingNameStyle: {},
    },
  }}
  title={"Country"}
  searchPlaceholder={"Search"}
  showCloseButton={true}
  showModalTitle={true}
/>;

Options

PropsDefaultOptions/Info
enable (Boolean)trueShow component that choose the country.
countryPickerRef (Function)nullGet the open() and close() modal methods.
darkMode (Boolean)trueDark mode for country modal.
countryCode (String)USCountry code displayed is selected at start.
modalConfig (Object)USConfig for component that choose the country. Note: See more details below.
containerConfig (Object)USConfig for component that choose the country. Note: See more details below.
onSelectCountry (Function)nullCalled when the user chooses a country and returns information for the selected country.
onInit (Function)nullCalled when the component set default country and returns information for the selected country.
onOpen (Function)nullCalled when the open modal.
onClose (Function)nullCalled when the close modal.
title (String)"Country"The title of the modal select country.
showCloseButton (Boolean)trueShow the close button of the modal select country.
showModalTitle (Boolean)trueShow the title of the modal select country.
containerStyle (Object)nullStyle for component that choose the country. Note: See more details below.
modalStyle (Object)nullStyle for modal select country. Note: See more details below.
renderChildren (Component)nullThe child component replaces the component element of the library

containerStyle

PropsDefaultOptions/Info
container (Object)styleStyle for component container.
flagStyle (Object)styleStyle for the icon country.
callingCodeStyle (Object)styleStyle for country code.
countryNameStyle (Object)styleStyle for country name.
countryCodeStyle (Object)styleStyle for country code.

modalConfig && containerConfig

PropsDefaultOptions/Info
showFlag (Boolean)trueShow/hide Flag.
showCallingCode (Boolean)trueShow/hide Calling Code.
showCountryName (Boolean)trueShow/hide Country Name.
showCountryCode (Boolean)trueShow/hide Country Code.

modalStyle

PropsDefaultOptions/Info
container (Object)styleStyle for modal container
searchStyle (Object)styleStyle for modal search input
tileStyle (Object)styleStyle for modal title
itemStyle (Object)styleStyle for item select country Note: See more details below.

itemStyle

PropsDefaultOptions/Info
itemContainer (Object)styleStyle for item country container
flagStyle (Object)styleStyle for the icon country.
callingCodeStyle (Object)styleStyle for country code.
countryNameStyle (Object)styleStyle for country name.
countryCodeStyle (Object)styleStyle for country code.

Thank you for your interest!