Skip to content

Commit c2d91ab

Browse files
[Textarea] Refactor the implementation
1 parent dea2617 commit c2d91ab

File tree

6 files changed

+216
-339
lines changed

6 files changed

+216
-339
lines changed

packages/material-ui/src/InputBase/InputBase.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ export const styles = theme => {
121121
/* Styles applied to the `input` element if `multiline={true}`. */
122122
inputMultiline: {
123123
height: 'auto',
124-
minHeight: '1.1875em', // Reset (19px), match the native input line-height
125124
resize: 'none',
126125
padding: 0,
127126
},
@@ -308,6 +307,7 @@ class InputBase extends React.Component {
308307
renderPrefix,
309308
rows,
310309
rowsMax,
310+
rowsMin,
311311
startAdornment,
312312
type,
313313
value,
@@ -370,14 +370,13 @@ class InputBase extends React.Component {
370370
ref: null,
371371
};
372372
} else if (multiline) {
373-
if (rows && !rowsMax) {
373+
if (rows && !rowsMax && !rowsMin) {
374374
InputComponent = 'textarea';
375375
} else {
376376
inputProps = {
377377
rowsMax,
378-
textareaRef: this.handleRefInput,
378+
rowsMin,
379379
...inputProps,
380-
ref: null,
381380
};
382381
InputComponent = Textarea;
383382
}
@@ -568,6 +567,10 @@ InputBase.propTypes = {
568567
* Maximum number of rows to display when multiline option is set to true.
569568
*/
570569
rowsMax: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
570+
/**
571+
* Minimum number of rows to display when multiline option is set to true.
572+
*/
573+
rowsMin: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
571574
/**
572575
* Start `InputAdornment` for this component.
573576
*/

0 commit comments

Comments
 (0)