# rntpc_react-native-country-picker-modal **Repository Path**: openharmony-sig/rntpc_react-native-country-picker-modal ## Basic Information - **Project Name**: rntpc_react-native-country-picker-modal - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: https://gitee.com/openharmony-sig/rntpc_react-native-country-picker-modal - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-10-15 - **Last Updated**: 2025-05-07 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 🚨 **重要提示 | IMPORTANT** > > **⚠️ 此代码仓已归档。新地址请访问 [rntpc_react-native-country-picker-modal](https://gitcode.com/openharmony-sig/rntpc_react-native-country-picker-modal)。| ⚠️ This repository has been archived. For the new address, please visit [rntpc_react-native-country-picker-modal](https://gitcode.com/openharmony-sig/rntpc_react-native-country-picker-modal).** > --- >

Country Picker for React Native.

| iOS | Android | Web | | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | | | | | ## Demo - 🎉[ GO TO WEB DEMO ](http://xcarpentier.github.io/react-native-country-picker-modal/) 🎉 - [snack example](https://snack.expo.io/@xcarpentier/bossy-marshmallows) ## Installation ```bash $ yarn add react-native-country-picker-modal ``` ## Basic Usage For more complete example open [App.tsx](https://github.com/xcarpentier/react-native-country-picker-modal/blob/master/App.tsx) ```tsx import React, { useState } from 'react' import { View, Text, StyleSheet, PixelRatio, Switch } from 'react-native' import CountryPicker from 'react-native-country-picker-modal' import { CountryCode, Country } from './src/types' const styles = StyleSheet.create({ // ... }) export default function App() { const [countryCode, setCountryCode] = useState('FR') const [country, setCountry] = useState(null) const [withCountryNameButton, setWithCountryNameButton] = useState( false, ) const [withFlag, setWithFlag] = useState(true) const [withEmoji, setWithEmoji] = useState(true) const [withFilter, setWithFilter] = useState(true) const [withAlphaFilter, setWithAlphaFilter] = useState(false) const [withCallingCode, setWithCallingCode] = useState(false) const onSelect = (country: Country) => { setCountryCode(country.cca2) setCountry(country) } return ( Welcome to Country Picker ! ) } ``` ## Props - `countryCode`: [CountryCode](https://github.com/xcarpentier/react-native-country-picker-modal/blob/master/src/types.ts#L252) - `region?`:[Region](https://github.com/xcarpentier/react-native-country-picker-modal/blob/master/src/types.ts#L272) - `subregion?`: [Subregion](https://github.com/xcarpentier/react-native-country-picker-modal/blob/master/src/types.ts#L282) - `countryCodes?`: [CountryCode](https://github.com/xcarpentier/react-native-country-picker-modal/blob/master/src/types.ts#L254) - `theme?`: [Theme](https://github.com/xcarpentier/react-native-country-picker-modal/blob/7611d34fa35744dbec3fbcdd9b4401494b1ba8c4/src/CountryTheme.ts#L5) - `translation?`: [TranslationLanguageCode](https://github.com/xcarpentier/react-native-country-picker-modal/blob/master/src/types.ts#L309) - `modalProps?`: [ModalProps](https://facebook.github.io/react-native/docs/modal#props) - `filterProps?`: [CountryFilterProps](https://facebook.github.io/react-native/docs/textinput#props) - `flatListProps?`: [FlatListProps](https://facebook.github.io/react-native/docs/flatlist#props) - `withAlphaFilter?`: boolean - `withCallingCode?`: boolean - `withCurrency?`: boolean - `withEmoji?`: boolean - `withCountryNameButton?`: boolean - `withCurrencyButton?`: boolean - `withCallingCodeButton?`: boolean - `withFlagButton?`: boolean - `withCloseButton?`: boolean - `withFilter?`: boolean - `withFlag?`: boolean - `withModal?`: boolean - `visible?`: boolean - `containerButtonStyle?`: `StyleProp` - `renderFlagButton?`(props: (FlagButton['props'])): ReactNode ([FlagButton props](https://github.com/xcarpentier/react-native-country-picker-modal/blob/master/src/FlagButton.tsx#L73)) - `renderCountryFilter?`(props: CountryFilter['props']): ReactNode ([CountryFilter props is TextInputProps](https://facebook.github.io/react-native/docs/textinput#props)) - `onSelect`(country: Country): void ([Country](https://github.com/xcarpentier/react-native-country-picker-modal/blob/master/src/types.ts#L263)) - `onOpen`(): void - `onClose`(): void - `closeButtonImage?`: [ImageSourcePropType](https://facebook.github.io/react-native/docs/image#props) - `closeButtonStyle?`: StyleProp - `closeButtonImageStyle?`: StyleProp - `disableNativeModal?`: boolean (you have to wrap your all app with CountryModalProvider) - `preferredCountries`: [CountryCode](https://github.com/xcarpentier/react-native-country-picker-modal/blob/master/src/types.ts#L254) preferred countries they appear first (`withAlphaFilter` must be false) ## Dark theme example

react-native-country-picker-modal-dark

A simple example to display a `CountryPicker` component with a dark theme. ```tsx import CountryPicker, { DARK_THEME } from 'react-native-country-picker-modal' const MyDarkView = () => ``` ## Dependencies - world-countries : https://www.npmjs.com/package/world-countries ## FAQ ### Is it supported and tested both on android and iOS? YES ### Is the data that is populated inside the list saved offline once I install your package? YES : It used the world-countries package and image is stored into json and base64. ## Tiers lib using this lib - [react-native-phone-verification](https://github.com/joinspontaneous/react-native-phone-verification) [> Your project?](https://github.com/xcarpentier/react-native-linkedin/issues/new) ## See also - [react-native-linkedin](https://github.com/xcarpentier/react-native-linkedin) ## Contribution - [@xcapentier](mailto:contact@xaviercarpentier.com) The main author. ## Questions Feel free to [contact me](mailto:contact@xaviercarpentier.com) or [create an issue](https://github.com/xcarpentier/react-native-country-picker/issues/new) > made with ♥ ## Licence [MIT](https://github.com/xcarpentier/react-native-country-picker-modal/blob/master/LICENSE.md) ## Hire an expert! Looking for a ReactNative freelance expert with more than 12 years experience? Contact me from my [website](https://xaviercarpentier.com)!