npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

rn-country-picker

v1.0.1

Published

React native country picker

Downloads

588

Readme

rn-country-picker

Country picker with Country Code and Flag for react native support both platform IOs and android

Features

  1. Light weight 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 { StyleSheet, Text, View } from "react-native";
import CountryPicker from "rn-country-picker";

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

	const selectedValue = (value: string) => {
		setCountryCode(value);
	};

	return (
		<View style={styles.container}>
			<Text style={styles.titleText}>React Native Country Picker</Text>
			<CountryPicker
				disable={false}
				animationType={"slide"}
				language="en"
				containerStyle={styles.pickerStyle}
				pickerTitleStyle={styles.pickerTitleStyle}
				dropDownImage={require("./res/ic_drop_down.png")}
				selectedCountryTextStyle={styles.selectedCountryTextStyle}
				countryNameTextStyle={styles.countryNameTextStyle}
				pickerTitle={"Country Picker"}
				searchBarPlaceHolder={"Search......"}
				hideCountryFlag={false}
				hideCountryCode={false}
				searchBarStyle={styles.searchBarStyle}
				backButtonImage={require("./res/ic_back_black.png")}
				searchButtonImage={require("./res/ic_search.png")}
				countryCode={"1"}
				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",
	},
	pickerTitleStyle: {
		justifyContent: "center",
		flexDirection: "row",
		alignSelf: "center",
		fontWeight: "bold",
	},
	pickerStyle: {
		height: 54,
		width: 150,
		marginVertical: 10,
		borderColor: "#303030",
		alignItems: "center",
		marginHorizontal: 10,
		padding: 10,
		backgroundColor: "white",
		borderRadius: 5,
		borderWidth: 2,
		fontSize: 16,
		color: "#000",
	},
	selectedCountryTextStyle: {
		paddingLeft: 5,
		color: "#000",
		textAlign: "right",
	},

	countryNameTextStyle: {
		paddingLeft: 10,
		color: "#000",
		textAlign: "right",
	},

	searchBarStyle: {
		flex: 1,
	},
});

Properties

| Prop | Default | Type | Description | Required/Optional | | ------------------------ | ------- | ------------------------ | -------------------------------------------------------------- | ----------------- | | countryCode | - | string | Default and selected country code | Required | | pickerTitle | - | string | Change picker title | Required | | pickerTitleStyle | - | string | Customize picker title style | Required | | searchBarPlaceHolder | - | string | Change search bar placeholder | Optional | | searchBarStyle | - | object | Customize search bar text input style | Optional | | searchBarContainerStyle | - | object | Customize search bar container style | Optional | | containerStyle | - | object | Customize picker style | Required | | countryNameTextStyle | - | object | Customize country name text style(List View) | Optional | | selectedCountryTextStyle | - | object | Customize selected label text style | Optional | | dropDownImageStyle | - | object | Change dropdown arrow style | Optional | | countryFlagStyle | - | object | Customize flag style | Optional | | searchButtonImage | - | png/jpg | Add custom search image | Optional | | backButtonImage | - | png/jpg | Add custom back button image | Optional | | dropDownImage | - | png/jpg | Add custom drop down image | Optional | | selectedValue | - | function | callback function received value from list selection | Required | | animationType | - | string [slide,none,fade] | Change Modal Animation | Optional | | hideCountryCode | - | bool | hide country code from component only show flag | Optional | | hideCountryFlag | - | bool | hide country flag from component and List only show code | Optional | | disable | - | bool | Disable picker if you show default value and no need to change | Optional | | language | en | string | Change the language of list | Optional |