Skip to content

Commit

Permalink
Merge pull request #3673 from nathanmarks/textfield-portal-render-bug
Browse files Browse the repository at this point in the history
[TextField] Add shouldComponentUpdate function
  • Loading branch information
alitaheri committed Mar 13, 2016
2 parents ae1342a + 47dd595 commit 2cfe672
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/TextField/TextField.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import ReactDOM from 'react-dom';
import keycode from 'keycode';
import shallowEqual from '../utils/shallow-equal';
import ColorManipulator from '../utils/color-manipulator';
import Transitions from '../styles/transitions';
import deprecated from '../utils/deprecatedPropType';
Expand Down Expand Up @@ -356,6 +357,14 @@ const TextField = React.createClass({
if (newState) this.setState(newState);
},

shouldComponentUpdate(nextProps, nextState, nextContext) {
return (
!shallowEqual(this.props, nextProps) ||
!shallowEqual(this.state, nextState) ||
!shallowEqual(this.context, nextContext)
);
},

blur() {
if (this.input) this._getInputNode().blur();
},
Expand Down

0 comments on commit 2cfe672

Please sign in to comment.