Migrate from react-native-country-picker-modal
CountryPicker is a form field like the others: it shows the chosen country and opens a searchable list, a bottom sheet on phones and a dropdown on the web. Flags are emoji, so nothing is downloaded, and names follow the device language through Intl. The value is the ISO code; getCountry gives the name, flag and dialing code.
- import CountryPicker from 'react-native-country-picker-modal';
+ import { CountryPicker } from '@elik56a/react-native-pickers';
- <CountryPicker
- countryCode={code}
- withFilter
- withCallingCode
- onSelect={(country) => setCode(country.cca2)}
- />
+ <CountryPicker label="Country" showDialCode value={code} onChange={setCode} />
| react-native-country-picker-modal | React Native Pickers |
|---|---|
countryCode | value |
onSelect(country) | onChange(code, option); getCountry(code) for the details |
countryCodes | countries |
excludeCountries | exclude |
preferredCountries | preferred (kept on top under their own header, with search too) |
region / subregion | countries with that region's codes |
withFilter | search is built in |
withCallingCode | showDialCode |
withFlag / withEmoji | always on: emoji flags, nothing to download |
translation | locale, any language Intl knows |
withAlphaFilter | search instead; it also matches native names, ISO codes and +44 |
placeholder | placeholder |
visible / onOpen / onClose | onOpen / onClose; renderTrigger for your own button |
withCallingCodeButton for a phone input | PhoneField |
withCurrency / withCurrencyButton | no equivalent |
| — | multiple, clearable, iOS, Material and web designs |
See all migration guides for other libraries, and Comparison for when another library is the better choice.