2.1.8 • Published 2 years ago

rn-country-dropdown-picker v2.1.8

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

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 customizationWithout Customization (out of the box)
npm.ionpm.io

Installation

  1. npm i react-native-flags install peer dependencies
  2. npm i rn-country-dropdown-picker

Import Component

import CountryPicker from 'rn-country-dropdown-picker';

Usage

This component can be used as it is without any customization, just import and use

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

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({{...}});
PropsTypeDescriptionOptional
InputFieldStyleView StyleDefines the first color in the linear gradient of a chart's backgroundyes
ContainerStyleView StyleDefines the View style of the components containeryes
DropdownCountryTextStyleText StyleDefines the style of the country names in the dropdownyes
DropdownContainerStyleView StyleDefines the style of the whole dropdown containeryes
DropdownRowStyleView StyleDefines the style of the individual view row in the dropdown ( icon + country name )yes
countryNameStyleText StyleDefines the style of the selected country nameyes
flagSizeNumberFlag size according to react-native-flags (Allowed values: 16, 24, 32, 48 or 64)yes
PlaceholderStringPlace holder for inputyes
selectedItem(e: { country:string, code: string}) => voida function that sets the selected country and codemandatory

More information

This library is built on top of the following open-source projects:

2.1.2

2 years ago

2.1.1

2 years ago

2.1.4

2 years ago

2.1.3

2 years ago

2.1.6

2 years ago

2.1.5

2 years ago

2.1.8

2 years ago

2.1.7

2 years ago

2.1.0

3 years ago

2.0.0

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago