Socket
Socket
Sign inDemoInstall

rn-country-dropdown-picker

Package Overview
Dependencies
5
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    rn-country-dropdown-picker

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


Version published
Weekly downloads
411
decreased by-18.61%
Maintainers
1
Install size
502 kB
Created
Weekly downloads
 

Readme

Source

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)

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:

  • react-native-Flags (https://github.com/frostney/react-native-flags)

Keywords

FAQs

Last updated on 01 Jan 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc