diff --git a/packages/material-ui/src/Input/Textarea.js b/packages/material-ui/src/Input/Textarea.js index 60b26ebf59096a..8dfa1a7aebf491 100644 --- a/packages/material-ui/src/Input/Textarea.js +++ b/packages/material-ui/src/Input/Textarea.js @@ -27,7 +27,6 @@ export const styles = { background: 'transparent', }, shadow: { - resize: 'none', // Overflow also needed to here to remove the extra row // added to textareas in Firefox. overflow: 'hidden', @@ -43,6 +42,8 @@ export const styles = { * @ignore - internal component. */ class Textarea extends React.Component { + isControlled = this.props.value != null; + shadowRef = null; singlelineShadowRef = null; @@ -106,7 +107,7 @@ class Textarea extends React.Component { handleChange = event => { this.value = event.target.value; - if (typeof this.props.value === 'undefined' && this.shadowRef) { + if (!this.isControlled) { // The component is not controlled, we need to update the shallow value. this.shadowRef.value = this.value; this.syncHeightWithShadow(); @@ -119,12 +120,9 @@ class Textarea extends React.Component { syncHeightWithShadow() { const props = this.props; - if (!this.shadowRef || !this.singlelineShadowRef) { - return; - } - // The component is controlled, we need to update the shallow value. - if (typeof props.value !== 'undefined') { + if (this.isControlled) { + // The component is controlled, we need to update the shallow value. this.shadowRef.value = props.value == null ? '' : String(props.value); } @@ -169,22 +167,22 @@ class Textarea extends React.Component {