mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2025-02-17 00:21:20 -05:00
Finish updating react-telephone-input
This commit is contained in:
parent
ad81dba61b
commit
41780fb7cb
2 changed files with 10 additions and 11 deletions
|
@ -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",
|
||||
|
|
|
@ -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
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue