Gathering detailed insights and metrics for rn-country-picker-modal
Gathering detailed insights and metrics for rn-country-picker-modal
npm install rn-country-picker-modal
Typescript
Module System
Node Version
NPM Version
TypeScript (82.64%)
JavaScript (17.36%)
Love this project? Help keep it running — sponsor us today! 🚀
Total Downloads
19,718
Last Day
1
Last Week
6
Last Month
15
Last Year
221
1,083 Stars
360 Commits
814 Forks
19 Watching
11 Branches
64 Contributors
Latest Version
1.0.2
Package Id
rn-country-picker-modal@1.0.2
Size
496.45 kB
NPM Version
6.9.0
Node Version
10.16.0
Publised On
04 Jul 2019
Cumulative downloads
Total Downloads
Last day
-66.7%
1
Compared to previous day
Last week
-14.3%
6
Compared to previous week
Last month
114.3%
15
Compared to previous month
Last year
-96.1%
221
Compared to previous year
8
18
1$ yarn add react-native-country-picker-modal
1import DeviceInfo from 'react-native-device-info' 2 3import React, { 4 AppRegistry, 5 Component, 6 StyleSheet, 7 Text, 8 View, 9 StatusBarIOS, 10 PixelRatio 11} from 'react-native' 12import CountryPicker, { 13 getAllCountries 14} from 'react-native-country-picker-modal' 15 16const NORTH_AMERICA = ['CA', 'MX', 'US'] 17 18class Example extends Component { 19 constructor(props) { 20 StatusBarIOS.setHidden(true) 21 super(props) 22 let userLocaleCountryCode = DeviceInfo.getDeviceCountry() 23 const userCountryData = getAllCountries() 24 .filter(country => NORTH_AMERICA.includes(country.cca2)) 25 .filter(country => country.cca2 === userLocaleCountryCode) 26 .pop() 27 let callingCode = null 28 let cca2 = userLocaleCountryCode 29 if (!cca2 || !userCountryData) { 30 cca2 = 'US' 31 callingCode = '1' 32 } else { 33 callingCode = userCountryData.callingCode 34 } 35 this.state = { 36 cca2, 37 callingCode 38 } 39 } 40 render() { 41 return ( 42 <View style={styles.container}> 43 <Text style={styles.welcome}>Welcome to Country Picker !</Text> 44 <CountryPicker 45 countryList={NORTH_AMERICA} 46 onChange={value => { 47 this.setState({ cca2: value.cca2, callingCode: value.callingCode }) 48 }} 49 cca2={this.state.cca2} 50 translation="eng" 51 /> 52 <Text style={styles.instructions}>press on the flag</Text> 53 {this.state.country && ( 54 <Text style={styles.data}> 55 {JSON.stringify(this.state.country, null, 2)} 56 </Text> 57 )} 58 </View> 59 ) 60 } 61} 62 63const styles = StyleSheet.create({ 64 container: { 65 flex: 1, 66 justifyContent: 'center', 67 alignItems: 'center' 68 }, 69 welcome: { 70 fontSize: 20, 71 textAlign: 'center', 72 margin: 10 73 }, 74 instructions: { 75 fontSize: 12, 76 textAlign: 'center', 77 color: '#888', 78 marginBottom: 5 79 }, 80 data: { 81 padding: 15, 82 marginTop: 10, 83 backgroundColor: '#ddd', 84 borderColor: '#888', 85 borderWidth: 1 / PixelRatio.get(), 86 color: '#777' 87 } 88}) 89 90AppRegistry.registerComponent('example', () => Example)
Key | Type | Default | Description |
---|---|---|---|
cca2 | string | *required | code ISO 3166-1 alpha-2 (ie. FR, US, etc.) |
translation | string | 'eng' | The language display for the name of the country (deu, fra, hrv, ita, jpn, nld, por, rus, spa, svk, fin, zho, cym) |
onChange | function | *required | The handler when a country is selected |
onClose | function | *required | The handler when the close button is clicked |
countryList | array | See cca2.json | List of custom CCA2 countries to render in the list. Use getAllCountries to filter what you need if you want to pass in a custom list |
excludeCountries | array | [] | List of custom CCA2 countries you don't want to render |
closeable | bool | false | If true, the CountryPicker will have a close button |
filterable | bool | false | If true, the CountryPicker will have search bar |
filterPlaceholder | string | 'Filter' | The search bar placeholder |
autoFocusFilter | bool | true | Whether or not the search bar should be autofocused |
styles | object | {} | Override any style specified in the component (see source code) |
disabled | bool | false | Whether or not the Country Picker onPress is disabled |
transparent | bool | false | If true, the CountryPicker will render the modal over a transparent background |
animationType | string | 'none' | The handler that controls how the modal animates |
closeButtonImage | React.element | default close button Image | Custom close button Image |
flagType | string | 'emoji' on iOS, 'flat' on Android | If set, overwrites the default OS based flag type. |
hideAlphabetFilter | bool | false | If set to true, prevents the alphabet filter rendering |
renderFilter | Function | undefined | If 'filterable={true}' and renderFilter function is provided, render custom filter component.* |
*
1renderFilter = ({value, onChange, onClose}) => ( 2 <CustomFilterComponent 3 value={value} 4 onChange={onChange} 5 onClose={onClose} 6 /> 7)
YES
YES : It used the world-countries package and image is stored into json and base64.
Feel free to contact me or create an issue
made with ♥
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 11/18 approved changesets -- score normalized to 6
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
27 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More