Skip to content

Commit

Permalink
Merge pull request #2703 from alitaheri/fix-2699
Browse files Browse the repository at this point in the history
[TextField] Remove ref prop on text field
  • Loading branch information
alitaheri committed Dec 29, 2015
2 parents e3dee6f + 98ab4d5 commit af99fef
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/TextField/TextField.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ const TextField = React.createClass({
onEnterKeyDown: React.PropTypes.func,
onFocus: React.PropTypes.func,
onKeyDown: React.PropTypes.func,
ref: React.PropTypes.string,
rows: React.PropTypes.number,
rowsMax: React.PropTypes.number,

Expand Down Expand Up @@ -302,7 +301,7 @@ const TextField = React.createClass({

inputProps = {
id: inputId,
ref: this._getRef(),
ref: 'input',
onBlur: this._handleInputBlur,
onFocus: this._handleInputFocus,
disabled: this.props.disabled,
Expand Down Expand Up @@ -408,7 +407,7 @@ const TextField = React.createClass({
}
else if (this.isMounted()) {
if (this.props.multiLine) {
this.refs[this._getRef()].setValue(newValue);
this.refs.input.setValue(newValue);
}
else {
this._getInputNode().value = newValue;
Expand All @@ -418,13 +417,9 @@ const TextField = React.createClass({
}
},

_getRef() {
return this.props.ref ? this.props.ref : 'input';
},

_getInputNode() {
return (this.props.children || this.props.multiLine) ?
this.refs[this._getRef()].getInputNode() : ReactDOM.findDOMNode(this.refs[this._getRef()]);
this.refs.input.getInputNode() : ReactDOM.findDOMNode(this.refs.input);
},

_handleInputBlur(e) {
Expand Down

0 comments on commit af99fef

Please sign in to comment.