Skip to content

Commit

Permalink
Refactor #265
Browse files Browse the repository at this point in the history
  • Loading branch information
mertsincan committed Jan 3, 2018
1 parent f50bc59 commit 17b2043
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/components/inputtext/InputText.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ export class InputText extends Component {

static defaultProps = {
onInput: null,
onKeyPress: null,
keyfilter: null
};

static propTypes = {
onInput: PropTypes.func,
onKeyPress: PropTypes.func,
keyfilter: PropTypes.any
};

Expand All @@ -22,6 +24,10 @@ export class InputText extends Component {
}

onKeyPress(event) {
if(this.props.onKeyPress) {
this.props.onKeyPress(event);
}

if(this.props.keyfilter) {
KeyFilter.onKeyPress(event,this.props.keyfilter)
}
Expand Down Expand Up @@ -61,6 +67,7 @@ export class InputText extends Component {

let inputProps = Object.assign({}, this.props);
delete inputProps.onInput;
delete inputProps.onKeyPress;

return <input ref={(el) => this.inputEl = el} {...inputProps} className={className} onInput={this.onInput} onKeyPress={this.onKeyPress}/>;
}
Expand Down

0 comments on commit 17b2043

Please sign in to comment.