diff --git a/README.md b/README.md
index 11807d9..dc9277e 100644
--- a/README.md
+++ b/README.md
@@ -100,5 +100,6 @@ All other attributes are applied to the input element. For example, you can int
| precision | 2 | Number of digits after the decimal separator |
| decimalSeparator | '.' | The decimal separator |
| thousandSeparator | ',' | The thousand separator |
+| inputType | "text" | Input field tag type. You may want to use `number` or `tel` |
diff --git a/src/index.js b/src/index.js
index aa8375b..a622b88 100644
--- a/src/index.js
+++ b/src/index.js
@@ -18,7 +18,8 @@ const CurrencyInput = React.createClass({
value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
decimalSeparator: PropTypes.string,
thousandSeparator: PropTypes.string,
- precision: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
+ precision: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
+ inputType: PropTypes.string
},
@@ -36,7 +37,8 @@ const CurrencyInput = React.createClass({
value: "0",
decimalSeparator: ".",
thousandSeparator: ",",
- precision: "2"
+ precision: "2",
+ inputType: "text"
}
},
@@ -55,6 +57,7 @@ const CurrencyInput = React.createClass({
delete customProps.decimalSeparator;
delete customProps.thousandSeparator;
delete customProps.precision;
+ delete customProps.inputType;
return {
maskedValue: mask(this.props.value, this.props.precision, this.props.decimalSeparator, this.props.thousandSeparator),
customProps: customProps
@@ -76,6 +79,7 @@ const CurrencyInput = React.createClass({
delete customProps.decimalSeparator;
delete customProps.thousandSeparator;
delete customProps.precision;
+ delete customProps.inputType;
this.setState({
maskedValue: mask(nextProps.value, nextProps.precision, nextProps.decimalSeparator, nextProps.thousandSeparator),
customProps: customProps
@@ -112,7 +116,7 @@ const CurrencyInput = React.createClass({
render() {
return (
+
);
this.inputComponent = ReactTestUtils.findRenderedDOMComponentWithTag(
@@ -57,6 +56,9 @@ describe('react-currency-input', function(){
expect(this.renderedComponent.getMaskedValue()).to.equal('123.456,789')
});
+ it(' should be of type "tel"', function() {
+ expect(this.inputComponent.getAttribute('type')).to.equal('tel')
+ });
});