# rn-country-dropdown-picker

> A fully customizable react native component that displays the flag and name of the selected country from a dropdwon list.

Latest version **2.1.8** (published 2022-01-01) · ISC license · 0 weekly downloads

## Install

```sh
npm install rn-country-dropdown-picker
pnpm add rn-country-dropdown-picker
yarn add rn-country-dropdown-picker
bun add rn-country-dropdown-picker
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.8 |
| Published | 2022-01-01 |
| First published | 2021-04-23 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 502 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Adeniyi Babatunde |
| Maintainers | faccon |
| Keywords | dropdown, country-picker, countypicker, country-dropdown, country-selection, searchable-country, picker, dropdown, react, reactnative, react-native, react native, android, ios, javascript, typescript |

## Links

- npm: https://www.npmjs.com/package/rn-country-dropdown-picker
- Repository: https://github.com/faccon/rn-country-dropdown-picker
- Homepage: https://github.com/faccon/rn-country-dropdown-picker#readme
- Issues: https://github.com/faccon/rn-country-dropdown-picker/issues
- npm.io page: https://npm.io/package/rn-country-dropdown-picker

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 2.1.8 (latest) — 2022-01-01
- 2.1.7 — 2022-01-01
- 2.1.6 — 2022-01-01
- 2.1.5 — 2022-01-01
- 2.1.4 — 2022-01-01
- 2.1.3 — 2022-01-01
- 2.1.2 — 2022-01-01
- 2.1.1 — 2021-12-27
- 2.1.0 — 2021-05-02
- 2.0.0 — 2021-05-02
- 1.0.6 — 2021-04-25
- 1.0.5 — 2021-04-24
- 1.0.4 — 2021-04-23
- 1.0.3 — 2021-04-23
- 1.0.2 — 2021-04-23
- … 2 more at https://npm.io/package/rn-country-dropdown-picker/versions

## README

# rn-country-dropdown-picker

A fully customizable react native component that displays the flag and name of the selected country from a dropdwon list.

|                          with customization                              |                         Without Customization (out of the box)                                    |
| -------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------ | 
|![](https://github.com/faccon/rn-country-dropdown-picker/blob/master/src/docs/rn-country-dropdown-picker.gif)|![](https://github.com/faccon/rn-country-dropdown-picker/blob/master/src/docs/rn-country-dropdown-picker2.gif)|


## Installation

1. `npm i react-native-flags` install peer dependencies
2. `npm i rn-country-dropdown-picker`



### Import Component
```javascript
import CountryPicker from 'rn-country-dropdown-picker';

```

## Usage

This component can be used as it is without any customization, just import and use

```jsx

import React from 'react';
import {View, Text} from 'react-native';
import CountryPicker from 'rn-country-dropdown-picker';

export default function App() {

  function handleSelection(e) {
    console.log(e);
  }

  return (
    <View style={{flex: 1, backgroundColor: 'white'}}>
      <CountryPicker selectedItem={handleSelection} />
    </View>
  );
}



```

## Usage with customizations

```jsx

import React from "react";
import { Dimensions, StyleSheet, View } from "react-native";
import CountryPicker from "rn-country-dropdown-picker";

export default function App() {

  function handleSelection(e) {
    console.log(e);
  }

  return (
    <View style={styles.container}>
     <CountryPicker
        InputFieldStyle={styles.ContainerStyle}
        DropdownContainerStyle={styles.myDropdownContainerStyle}
        DropdownRowStyle={styles.myDropdownRowStyle}
        Placeholder="choose country ..."
        DropdownCountryTextStyle={styles.myDropdownCountryTextStyle}
        countryNameStyle={styles.mycountryNameStyle}
        flagSize={24}
        selectedItem={handleSelection}
      />

    </View>
  );
}

const styles = StyleSheet.create({{...}});


```

| Props                         | Type               | Description                                                                 	          |  Optional      |
| ----------------------------- | ------------------ | -------------------------------------------------------------------------------------- | -------------- |
| InputFieldStyle		            | View Style	       | Defines the first color in the linear gradient of a chart's background   	            |      yes       |
| ContainerStyle                | View Style         | Defines the View style of the components container    				                          |      yes       |
| DropdownCountryTextStyle      | Text Style         | Defines the style of the country names in the dropdown    			                        |      yes       |
| DropdownContainerStyle	      | View Style         | Defines the style of the whole dropdown container        			                        |      yes       |
| DropdownRowStyle		          | View Style         | Defines the style of the individual view row in the dropdown ( icon + country name )   |      yes       |
| countryNameStyle	          	| Text Style         | Defines the style of the selected country name  					                              |      yes       |
| flagSize			                | Number             | Flag size according to react-native-flags  (Allowed values: 16, 24, 32, 48 or 64)      |      yes       |
| Placeholder                   | String             | Place holder for input                                                                 |      yes       |
| selectedItem	                | (e: { country:string, code: string}) => void | a function that sets the selected country and  code                                    |    mandatory   |

## More information

This library is built on top of the following open-source projects:

- react-native-Flags (https://github.com/frostney/react-native-flags)

---
_Source: https://npm.io/package/rn-country-dropdown-picker · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
