Skip to content

Commit

Permalink
fix(component) dynamic text area will now contain content exactly
Browse files Browse the repository at this point in the history
Signed-off-by: Mason Hu <[email protected]>
  • Loading branch information
mas-who committed Dec 8, 2023
1 parent 225aa1e commit 29ff659
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/AutoExpandingTextArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const AutoExpandingTextArea: FC<Props> = (props) => {
if (textArea) {
textArea.style.height = "0px";
const scrollHeight = textArea.scrollHeight;
textArea.style.height = `${scrollHeight + 1}px`;
textArea.style.height = `${scrollHeight}px`;
}
}
}, [value]);
Expand All @@ -26,6 +26,7 @@ const AutoExpandingTextArea: FC<Props> = (props) => {
<Textarea
{...(textAreaProps as TextareaProps)}
rows={dynamicHeight ? undefined : rows}
className="auto-expanding-textarea"
/>
</div>
);
Expand Down
5 changes: 5 additions & 0 deletions src/sass/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -265,3 +265,8 @@ $border-thin: 1px solid $color-mid-light !default;
.no-border-top {
border-top: none !important;
}

.auto-expanding-textarea {
overflow: hidden;
resize: none;
}

0 comments on commit 29ff659

Please sign in to comment.