Skip to content

Commit 1dc3999

Browse files
committed
chore: update version to 1.22.6-beta-1 in package.json and package-lock.json; improve textarea height adjustment logic
1 parent e39ee9e commit 1dc3999

3 files changed

Lines changed: 11 additions & 10 deletions

File tree

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "1.22.6-beta-0",
3+
"version": "1.22.6-beta-1",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Shared/Components/Textarea/Textarea.component.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,21 +82,22 @@ const Textarea = ({
8282
}, [])
8383

8484
const reInitHeight = () => {
85-
const currentHeight = parseInt(textareaRef.current.style.height, 10)
86-
let nextHeight = textareaRef.current.scrollHeight || 0
87-
88-
if (nextHeight < currentHeight || currentHeight > AUTO_EXPANSION_MAX_HEIGHT) {
85+
const textarea = textareaRef.current
86+
if (!textarea) {
8987
return
9088
}
9189

92-
if (nextHeight < MIN_HEIGHT) {
93-
nextHeight = MIN_HEIGHT
94-
}
90+
textarea.style.height = 'auto'
91+
let nextHeight = textarea.scrollHeight
9592

9693
if (nextHeight > AUTO_EXPANSION_MAX_HEIGHT) {
9794
nextHeight = AUTO_EXPANSION_MAX_HEIGHT
95+
textarea.style.overflowY = 'auto'
96+
} else {
97+
textarea.style.overflowY = 'hidden'
9898
}
9999

100+
nextHeight = Math.max(MIN_HEIGHT, nextHeight)
100101
updateRefsHeight(nextHeight)
101102
}
102103

0 commit comments

Comments
 (0)