1.0.8 • Published 10 months ago

rn-country-picker v1.0.8

Weekly downloads
29
License
MIT
Repository
github
Last release
10 months ago

rn-country-picker

Country picker for react native support both platform IOs and android

Important Note

While selecting the USA It showed the wrong flag icon because both countries have the same country code so we added a new prop that is the countryId field.

  1. For USA countryId is 231
  2. For Canada, countryId is 38
  3. For Anguilla, countryId is 7
  4. For Antarctica, countryId is 8

Features

  1. Lightweight country picker npm.
  2. Cross-platform compatibility android and ios both.
  3. Search country using country code or country code.
  4. Support multiple language search and list items.
  5. Dynamically change dropdown, search, and back button images.
  6. Customizable search bar style and text colors.
  7. Change animation(Slide, fade, none).

Installation

npm i rn-country-picker

Usage

import React, { useState } from "react";
import { Platform, StyleSheet, Text, View } from "react-native";
import CountryPicker from "./src/countryPicker/CountryPicker";

const App = () => {
  const [countryCode, setCountryCode] = useState<string>("92");

  const selectedValue = (value) => {
    setCountryCode(value?.callingCode);
  };

  return (
    <View style={styles.container}>
      <Text style={styles.titleText}>React Native Country Picker</Text>

      <CountryPicker
        animationType={"slide"}
        language="en"
        countryCode={countryCode}
        selectedValue={selectedValue}
      />
    </View>
  );
};
export default App;

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: "center",
    alignItems: "center",
    backgroundColor: "#F5FCFF",
  },
  titleText: {
    color: "#000",
    fontSize: 25,
    marginBottom: 25,
    fontWeight: "bold",
  },

});

Properties

PropDefaultTypeDescriptionRequired/Optional
countryId-stringDefault and selected country IdRequired
countryCode-stringDefault and selected country codeRequired
searchBarPlaceHolder-stringChange search bar placeholderOptional
searchBarStyle-objectCustomize search bar text input styleOptional
pickerContainerStyle-objectCustomize picker styleRequired
searchBarContainerStyle.-objectCustomize search bar styleOptional
searchInputStyle-objectCustomize search bar Text Input styleOptional
searchBarPlaceholderTextColor-objectCustomize search bar placeholder colorOptional
countryNameTextStyle-objectCustomize country name text style(List View)Optional
selectedCountryTextStyle-objectCustomize selected label text styleOptional
dropDownIconStyle-objectChange dropdown arrow styleOptional
countryFlagStyle-objectCustomize flag styleOptional
searchIcon-png/jpgAdd custom search IconOptional
dropDownIcon-png/jpgAdd custom drop down iconOptional
selectedValue-functioncallback function received value from list selectionRequired
animationType-string slide,none,fadeChange Modal AnimationOptional
hideCountryCode-boolhide country code from component only show flagOptional
hideCountryFlag-boolhide country flag from componentOptional
disable-boolDisable pickerOptional
languageenstringChange the language of listrequired
1.0.8

10 months ago

1.0.7

10 months ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.2

1 year ago

1.0.3

1 year ago

1.0.1

3 years ago

1.0.0

3 years ago

0.0.13

4 years ago

0.0.12

4 years ago

0.0.11

5 years ago

0.0.10

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago