react-intl-tel-input
Version:
Telephone input component. Rewrite intl-tel-input in React.js.
37 lines (33 loc) • 1.03 kB
JavaScript
import React, { Component, PropTypes } from 'react';
class TelInput extends Component {
static propTypes = {
className: PropTypes.string,
disabled: PropTypes.bool,
readonly: PropTypes.bool,
fieldName: PropTypes.string,
fieldId: PropTypes.string,
value: PropTypes.string,
placeholder: PropTypes.string,
handleInputChange: PropTypes.func,
handleKeyPress: PropTypes.func,
handleOnBlur: PropTypes.func,
autoFocus: PropTypes.bool,
};
render() {
return (
<input type="tel" autoComplete="off"
className={this.props.className}
disabled={this.props.disabled ? 'disabled' : false}
readOnly={this.props.readonly ? 'readonly' : false}
name={this.props.fieldName}
id={this.props.fieldId}
value={this.props.value}
placeholder={this.props.placeholder}
onChange={this.props.handleInputChange}
onBlur={this.props.handleOnBlur}
autoFocus={this.props.autoFocus}
/>
);
}
}
export default TelInput;