@@ -80,12 +80,12 @@ class BaseTextInput extends Component {
80
80
return ;
81
81
}
82
82
83
- if ( this . props . autoGrow ) {
83
+ if ( this . props . autoGrow && this . props . shouldWaitWidthCalculation ) {
84
84
if ( inputValue !== this . state . hiddenInputValue ) {
85
85
this . setState ( { hiddenInputValue : inputValue , selection : this . props . selection } ) ;
86
86
}
87
87
88
- if ( prevState . textInputWidth === this . state . textInputWidth && this . props . shouldWaitWidthCalculation ) {
88
+ if ( prevState . textInputWidth === this . state . textInputWidth ) {
89
89
return ;
90
90
}
91
91
}
@@ -159,7 +159,7 @@ class BaseTextInput extends Component {
159
159
if ( this . props . onInputChange ) {
160
160
this . props . onInputChange ( value ) ;
161
161
}
162
- if ( ! this . props . autoGrow ) {
162
+ if ( ! this . props . autoGrow || ! this . props . shouldWaitWidthCalculation ) {
163
163
this . setState ( { value} ) ;
164
164
}
165
165
Str . result ( this . props . onChangeText , value ) ;
@@ -234,6 +234,8 @@ class BaseTextInput extends Component {
234
234
] , ( finalStyles , s ) => ( { ...finalStyles , ...s } ) , { } ) ;
235
235
const maxHeight = StyleSheet . flatten ( this . props . containerStyles ) . maxHeight ;
236
236
const isMultiline = this . props . multiline || this . props . autoGrowHeight ;
237
+ const defaultInputValue = this . state . value || this . props . placeholder ;
238
+ const defaultHiddenInputValue = this . state . hiddenInputValue || this . props . placeholder ;
237
239
238
240
return (
239
241
< >
@@ -393,7 +395,7 @@ class BaseTextInput extends Component {
393
395
style = { [ ...this . props . inputStyle , this . props . autoGrowHeight ? { maxWidth : this . state . width } : { } , styles . hiddenElementOutsideOfWindow , styles . visibilityHidden ] }
394
396
onLayout = { e => this . setState ( { textInputWidth : e . nativeEvent . layout . width + 2 , textInputHeight : e . nativeEvent . layout . height } ) }
395
397
>
396
- { this . props . autoGrowHeight ? this . state . value : this . state . hiddenInputValue || this . props . placeholder }
398
+ { this . props . autoGrowHeight || ! this . props . shouldWaitWidthCalculation ? defaultInputValue : defaultHiddenInputValue }
397
399
</ Text >
398
400
) }
399
401
</ >
0 commit comments