Skip to content

Commit eda4e4c

Browse files
9jaboyiamdustan
authored andcommitted
Use onBeforeInput so Chrome for Android works. Fix #19 (#47)
1 parent f690087 commit eda4e4c

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ var MaskedInput = React.createClass({
162162

163163
e.preventDefault()
164164
this._updateMaskSelection()
165-
if (this.mask.input(e.key)) {
165+
if (this.mask.input((e.key || e.data))) {
166166
e.target.value = this.mask.getValue()
167167
this._updateInputSelection()
168168
if (this.props.onChange) {
@@ -208,7 +208,7 @@ var MaskedInput = React.createClass({
208208
maxLength={patternLength}
209209
onChange={this._onChange}
210210
onKeyDown={this._onKeyDown}
211-
onKeyPress={this._onKeyPress}
211+
onBeforeInput={this._onKeyPress}
212212
onPaste={this._onPaste}
213213
placeholder={placeholder || this.mask.emptyValue}
214214
size={size || patternLength}

0 commit comments

Comments
 (0)