react-native-country-picker-modal
Advanced tools
Comparing version 0.1.5 to 0.1.6
{ | ||
"name": "react-native-country-picker-modal", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "Country picker", | ||
@@ -23,10 +23,2 @@ "main": "src/CountryPicker.js", | ||
"homepage": "https://github.com/xcarpentier/react-native-country-picker-modal#readme", | ||
"devDependencies": { | ||
"cz-conventional-changelog": "1.1.6" | ||
}, | ||
"config": { | ||
"commitizen": { | ||
"path": "./node_modules/cz-conventional-changelog" | ||
} | ||
}, | ||
"dependencies": { | ||
@@ -33,0 +25,0 @@ "lodash": "4.12.0", |
@@ -5,4 +5,2 @@ [**Support me with a Follow**](https://github.com/xcarpentier/followers) | ||
[![npm version](http://img.shields.io/npm/dm/react-native-country-picker-modal.svg?style=flat-square)](https://npmjs.org/package/react-native-country-picker-modal "View this project on npm") | ||
The best Country Picker for React Native. | ||
@@ -31,3 +29,3 @@ | ||
```jsx | ||
```javascript | ||
'use strict'; | ||
@@ -34,0 +32,0 @@ import React, { |
@@ -1,3 +0,1 @@ | ||
'use strict'; | ||
/** | ||
@@ -10,16 +8,10 @@ * react-native-country-picker | ||
import React, { Component } from 'react'; | ||
import { | ||
StyleSheet, | ||
View, | ||
PixelRatio, | ||
Image, | ||
TouchableOpacity, | ||
Modal, | ||
Text, | ||
ListView | ||
import { StyleSheet, View, PixelRatio, Image, TouchableOpacity, Modal, | ||
Text, ListView, | ||
} from 'react-native'; | ||
import countries from 'world-countries'; | ||
import _ from 'lodash'; | ||
import CountryFlags from './countryFlags'; | ||
import {getWidthPercent, getHeightPercent, getPercent} from './ratio'; | ||
import { getWidthPercent, getHeightPercent, getPercent } from './ratio'; | ||
import CloseButton from './CloseButton'; | ||
@@ -31,9 +23,2 @@ | ||
super(props); | ||
const ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2}); | ||
this.state = { | ||
cca2: props.cca2, | ||
currentCountry: this.getCountry(props.cca2), | ||
modalVisible: false, | ||
countries: ds.cloneWithRows(this.orderCountryList()) | ||
}; | ||
this.letters = _ | ||
@@ -46,2 +31,8 @@ .range('A'.charCodeAt(0), 'Z'.charCodeAt(0) + 1) | ||
this.listHeight = countries.length * this.itemHeight; | ||
this.state = { | ||
modalVisible: false, | ||
cca2: props.cca2, | ||
currentCountry: this.getCountry(props.cca2), | ||
}; | ||
} | ||
@@ -55,2 +46,9 @@ | ||
componentWillReceiveProps(nextProps) { | ||
this.setState({ | ||
cca2: nextProps.cca2, | ||
currentCountry: this.getCountry(nextProps.cca2), | ||
}); | ||
} | ||
getCountryName(country) { | ||
@@ -158,2 +156,5 @@ const translation = this.props.translation || 'eng'; | ||
render() { | ||
const ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2}); | ||
const dataSource = ds.cloneWithRows(this.orderCountryList()); | ||
return ( | ||
@@ -180,3 +181,3 @@ <View> | ||
ref={scrollView => { this._scrollView = scrollView; }} | ||
dataSource={this.state.countries} | ||
dataSource={dataSource} | ||
renderRow={country => this.renderCountry(country)} | ||
@@ -264,8 +265,9 @@ initialListSize={20} | ||
onChange: React.PropTypes.func.isRequired, | ||
closeable: React.PropTypes.bool | ||
closeable: React.PropTypes.bool, | ||
}; | ||
CountryPicker.defaultProps = { | ||
translation: 'eng' | ||
translation: 'eng', | ||
}; | ||
module.exports = CountryPicker; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
0
394910
1924
131