From 17b204328939242b16e6230f172c7d0fd30f373e Mon Sep 17 00:00:00 2001 From: mertsincan Date: Wed, 3 Jan 2018 09:53:36 +0300 Subject: [PATCH] Refactor #265 --- src/components/inputtext/InputText.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/components/inputtext/InputText.js b/src/components/inputtext/InputText.js index 328f69e9af..2614b65a1e 100644 --- a/src/components/inputtext/InputText.js +++ b/src/components/inputtext/InputText.js @@ -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 }; @@ -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) } @@ -61,6 +67,7 @@ export class InputText extends Component { let inputProps = Object.assign({}, this.props); delete inputProps.onInput; + delete inputProps.onKeyPress; return this.inputEl = el} {...inputProps} className={className} onInput={this.onInput} onKeyPress={this.onKeyPress}/>; }