From 268f2d6f064a702949390e9c90e8bbc8ec9431af Mon Sep 17 00:00:00 2001 From: Marina Bychkova <90869368+Marrinka@users.noreply.github.com> Date: Sun, 16 Jul 2023 17:58:55 +0300 Subject: [PATCH] Update TextAreaControl.tsx fix: input height --- src/components/TextInput/TextAreaControl/TextAreaControl.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/TextInput/TextAreaControl/TextAreaControl.tsx b/src/components/TextInput/TextAreaControl/TextAreaControl.tsx index 0d784eafb1..649bb6fb8b 100644 --- a/src/components/TextInput/TextAreaControl/TextAreaControl.tsx +++ b/src/components/TextInput/TextAreaControl/TextAreaControl.tsx @@ -50,15 +50,15 @@ export function TextAreaControl(props: TextAreaControlProps) { const borderWidth = parseInt(controlStyles.getPropertyValue('border-top-width'), 10); const paddingTop = parseInt(controlStyles.getPropertyValue('padding-top'), 10); + control.style.height = 'auto'; + const lines = Math.floor(control.scrollHeight / lineHeight); if (maxRows && maxRows < Math.max(lines, numberOfLines)) { - control.style.height = 'auto'; control.style.height = `${ maxRows * lineHeight + 2 * paddingTop + 2 * borderWidth }px`; } else { - control.style.height = 'auto'; control.style.height = `${control.scrollHeight + 2 * borderWidth}px`; } }