UNPKG

react-native-country-selector

Version:

A simple react native country picker. It provides name of country, dial code, currency, country code,flag and more.

40 lines (30 loc) 998 B
This is a new [**React Native**](https://reactnative.dev) project, bootstrapped using [`@react-native-community/cli`](https://github.com/react-native-community/cli). # Installation ```bash yarn add react-native-country-selector ``` or ```bash npm install react-native-country-selector ``` # Usage ```JavaScript import CountryPicker from 'react-native-country-selector' <CountryPicker visible={showPicker} onClose={() => setShowPicker(false)} onCountrySelected={(data) => { console.log(JSON.stringify(data)) }} /> /* OUTPUT {"name":"Australia","phone_code":"+61","code":"AU","currency":{"code":"AUD","name":"Dollar","symbol":"$"}, "id":14,"flag":13} */ ``` # Props ```visible``` : ```true``` or ```false``` values Show or hide picker. <br> ```onClose``` : ```function``` to perform hiding/closing the country selector. <br> ```onCountrySelected```: ```function``` . Perform an operation after selecting the country of your choice. Get the data and manipulate it :)