Skip to content

Commit

Permalink
Fixed #89
Browse files Browse the repository at this point in the history
  • Loading branch information
mertsincan committed Sep 17, 2017
1 parent 04f63f2 commit e986c4f
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions src/components/inputtext/InputText.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ export class InputText extends Component {
super(props);
this.onInput = this.onInput.bind(this);
this.state = {filled: false};

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

onInput(e) {
Expand All @@ -35,24 +32,21 @@ export class InputText extends Component {
}

componentDidMount() {
let _value = this.inputProps.value||this.inputProps.defaultValue,
let _value = this.props.value||this.props.defaultValue,
_filled = (_value && _value.length) ? true : false;

this.setState({filled: _filled});
}

componentWillReceiveProps(nextProps) {
if(nextProps.hasOwnProperty('value')) {
this.inputProps.value = nextProps.value;
}
}

render() {
var className = classNames('ui-inputtext ui-state-default ui-corner-all ui-widget', this.props.className, {
'ui-state-disabled': this.props.disabled,
'ui-state-filled': this.state.filled
});

return <input {...this.inputProps} className={className} onInput={this.onInput}/>;
let inputProps = Object.assign({}, this.props);
delete inputProps.onInput;

return <input {...inputProps} className={className} onInput={this.onInput}/>;
}
}

0 comments on commit e986c4f

Please sign in to comment.