1.0.9 ā€¢ Published 3 months ago

react-native-dropdown-country-picker v1.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago
NPM VERSIONNPM WEEKLY DOWNLOADSGITHUB STARYOUTUBE VIEWSNPM LIFETIME DOWNLOADS

šŸŸ¢ React Native Dropdown Country Picker Similar as HTML Select List. It's not a modal.

  • Equivalent to React Native Stock Component
  • Use the styles of your choice
  • Search the countries seamlessly
  • Option to add customizable input mobile field next to the Picker
  • Zero dependencies

Compatibility

iOSAndroidWebExpo
āœ…āœ…āœ…āœ…

šŸ”Œ Installation

$ npm install react-native-dropdown-country-picker

OR

$ yarn add react-native-dropdown-country-picker

šŸ˜Ž Displaying the country picker

import CountryCodeDropdownPicker from 'react-native-dropdown-country-picker'

const App = () => {
  const [selected, setSelected] = React.useState('+91');
  const [country, setCountry] = React.useState('');
  const [phone, setPhone] = React.useState('');

  return(
    <CountryCodeDropdownPicker 
        selected={selected} 
        setSelected={setSelected}
        setCountryDetails={setCountry} 
        phone={phone} 
        setPhone={setPhone} 
        countryCodeTextStyles={{fontSize: 13}}
      />
  )

};

For Live Demo (Expo Snack)

ā­ Props for the component

NameTypeDescriptionDefault
selectedstate varThe default selected country dial code stored in state variableN/A
setSelectedFunctionsetState function to set the selected state variableN/A
setCountryDetailsFunctionsetState function to set additional country details in respective state variable (Optional)N/A
phonestate varstate variable if you want to display phone number field (Optional)N/A
setPhoneFuntionsetState function to set the phone state variable (Optional)N/A
countryCodeContainerStylesstyle Objectstyle object to style the country code container (Optional)N/A
countryCodeTextStylesstyle objectstyle object to style the text inside country code container (Optional)N/A
phoneStylesstyle objectstyle object to style the text input of phone field (Optional)N/A
searchIconstringURL of the icon if you want to replace the search icon (Optional)N/A
closeIconstringURL of the icon if you want to replace the close icon (Optional)N/A
searchStylesstyle objectstyle object to style the search field (Optional)N/A
searchTextStylesstyle objectstyle object to style the search text input field (Optional)N/A
dropdownStylesstyle objectstyle object to style the dropdown container (Optional)N/A
dropdownTextStylesstyle objectstyle object to style the text inside dropdown container (Optional)N/A

ā–¶ļø Watch Tutorial Video -->

Watch video