Finish updating react-telephone-input

This commit is contained in:
Ray Schamp 2018-03-30 12:10:03 -04:00
parent ad81dba61b
commit 41780fb7cb
2 changed files with 10 additions and 11 deletions

View file

@ -45,7 +45,6 @@
"classnames": "2.2.5",
"cookie": "0.2.2",
"copy-webpack-plugin": "0.2.0",
"country-telephone-data": "0.5.5",
"create-react-class": "15.6.2",
"css-loader": "0.23.1",
"eslint": "4.7.1",

View file

@ -12,7 +12,6 @@ const inputHOC = require('./input-hoc.jsx');
const intl = require('../../lib/intl.jsx');
const validationHOCFactory = require('./validations.jsx').validationHOCFactory;
require('./row.scss');
require('./phone-input.scss');
@ -20,7 +19,8 @@ class PhoneInput extends React.Component {
constructor (props) {
super(props);
bindAll(this, [
'handleChange'
'handleChange',
'handleBlur'
]);
this.state = {value: props.value};
}
@ -30,19 +30,18 @@ class PhoneInput extends React.Component {
this.props.onSetValue(nextProps.value);
}
}
handleChange (telNumber) {
if (this.updateOnChange) {
this.onSetValue(telNumber);
handleChange (number) {
if (this.props.updateOnChange) {
this.props.onSetValue(number);
}
}
handleBlur (telNumber) {
if (this.updateOnBlur) {
this.onSetValue(telNumber);
handleBlur (number) {
if (this.props.updateOnBlur) {
this.props.onSetValue(number);
}
}
render () {
return (
<Row
{...this.props}
@ -54,7 +53,6 @@ class PhoneInput extends React.Component {
className="form-control"
defaultCountry={this.props.defaultCountry}
flagsImagePath="/images/flags.png"
id={this.props.id}
label={null}
onBlur={this.handleBlur}
onChange={this.handleChange}
@ -80,6 +78,8 @@ PhoneInput.propTypes = {
name: PropTypes.string,
onChange: PropTypes.func,
onSetValue: PropTypes.func,
updateOnBlur: PropTypes.bool,
updateOnChange: PropTypes.bool,
value: PropTypes.string
};