@@ -88,7 +88,9 @@ export type IATTextViewRef = React.ForwardedRef<IATTextViewBase>;
8888
8989const VariableTextInputView = forwardRef (
9090 ( props : IProps , ref : IATTextViewRef ) => {
91- const [ currentHeight , setCurrentHeight ] = useState ( undefined ) ;
91+ const [ currentHeight , setCurrentHeight ] = useState < number | undefined > (
92+ undefined
93+ ) ;
9294 const nativeRef = useRef ( null ) ;
9395 const _onChange = ( e : NativeSyntheticEvent < TextInputChangeEventData > ) => {
9496 props . onChangeText && props . onChangeText ( e . nativeEvent . text ) ;
@@ -164,10 +166,12 @@ const VariableTextInputView = forwardRef(
164166 const styles = StyleSheet . flatten ( style ) ;
165167 if ( styles . height === undefined && styles . flex !== 1 ) {
166168 const contentSizeHeight = event . nativeEvent . contentSize . height ;
167- if ( ! ! styles . maxHeight && contentSizeHeight > styles . maxHeight ) {
169+ if ( ! ! styles . maxHeight && contentSizeHeight >= styles . maxHeight ) {
170+ setCurrentHeight ( parseFloat ( `${ styles . maxHeight } ` ) ) ;
168171 return ;
169172 }
170- if ( ! ! styles . minHeight && contentSizeHeight < styles . minHeight ) {
173+ if ( ! ! styles . minHeight && contentSizeHeight <= styles . minHeight ) {
174+ setCurrentHeight ( parseFloat ( `${ styles . minHeight } ` ) ) ;
171175 return ;
172176 }
173177 setCurrentHeight ( event . nativeEvent . contentSize . height ) ;
@@ -179,9 +183,11 @@ const VariableTextInputView = forwardRef(
179183 if ( styles . height === undefined && styles . flex !== 1 ) {
180184 const contentSizeHeight = event . nativeEvent . contentSize . height ;
181185 if ( ! ! styles . maxHeight && contentSizeHeight > styles . maxHeight ) {
186+ setCurrentHeight ( parseFloat ( `${ styles . maxHeight } ` ) ) ;
182187 return ;
183188 }
184189 if ( ! ! styles . minHeight && contentSizeHeight < styles . minHeight ) {
190+ setCurrentHeight ( parseFloat ( `${ styles . minHeight } ` ) ) ;
185191 return ;
186192 }
187193 setCurrentHeight ( event . nativeEvent . contentSize . height ) ;
0 commit comments