From 9e5670a3d31903ebbb8e6547bccce63c056b88aa Mon Sep 17 00:00:00 2001 From: Mert Sincan Date: Fri, 20 Dec 2024 00:53:02 +0000 Subject: [PATCH] Fixed #7517 - The InputTextarea component with the autoResize property shrinks within the TabView when renderActiveOnly={false} is set. --- components/lib/inputtextarea/InputTextarea.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/components/lib/inputtextarea/InputTextarea.js b/components/lib/inputtextarea/InputTextarea.js index f0b502f6a6..9ba69f9cae 100644 --- a/components/lib/inputtextarea/InputTextarea.js +++ b/components/lib/inputtextarea/InputTextarea.js @@ -89,7 +89,7 @@ export const InputTextarea = React.memo( const resize = (initial) => { const inputEl = elementRef.current; - if (inputEl && DomHandler.isVisible(inputEl)) { + if (inputEl && isVisible(inputEl)) { if (!cachedScrollHeight.current) { cachedScrollHeight.current = inputEl.scrollHeight; inputEl.style.overflow = 'hidden'; @@ -111,6 +111,16 @@ export const InputTextarea = React.memo( } }; + const isVisible = () => { + if (DomHandler.isVisible(elementRef.current)) { + const rect = elementRef.current.getBoundingClientRect(); + + return rect.width > 0 && rect.height > 0; + } + + return false; + }; + React.useEffect(() => { ObjectUtils.combinedRefs(elementRef, ref); }, [elementRef, ref]);