@@ -89,7 +89,7 @@ const TextareaAutosize = React.forwardRef(function TextareaAutosize(
89
89
}
90
90
91
91
hiddenTextarea . style . width = computedStyle . width ;
92
- hiddenTextarea . value = textarea . value || props . placeholder || 'x' ;
92
+ hiddenTextarea . value = textarea . value || 'x' ;
93
93
if ( hiddenTextarea . value . slice ( - 1 ) === '\n' ) {
94
94
// Certain fonts which overflow the line height will cause the textarea
95
95
// to report a different scrollHeight depending on whether the last line
@@ -126,7 +126,7 @@ const TextareaAutosize = React.forwardRef(function TextareaAutosize(
126
126
const overflowing = Math . abs ( outerHeight - innerHeight ) <= 1 ;
127
127
128
128
return { outerHeightStyle, overflowing } ;
129
- } , [ maxRows , minRows , props . placeholder ] ) ;
129
+ } , [ maxRows , minRows ] ) ;
130
130
131
131
const didHeightChange = useEventCallback ( ( ) => {
132
132
const textarea = textareaRef . current ;
@@ -155,6 +155,9 @@ const TextareaAutosize = React.forwardRef(function TextareaAutosize(
155
155
textarea . style . height = `${ outerHeightStyle } px` ;
156
156
}
157
157
textarea . style . overflow = textareaStyles . overflowing ? 'hidden' : '' ;
158
+ if ( ! textarea . value ) {
159
+ textarea . style . whiteSpace = 'nowrap' ;
160
+ }
158
161
} , [ calculateTextareaStyles ] ) ;
159
162
160
163
const frameRef = React . useRef ( - 1 ) ;
0 commit comments