fix: auto hegiht for textarea

This commit is contained in:
2024-01-14 14:33:05 +08:00
parent 324e374884
commit 67a8140a01
3 changed files with 14 additions and 8 deletions

8
src/textarea.tsx Normal file
View File

@@ -0,0 +1,8 @@
export const autoHeight = (event: any) => {
event.target.style.height = "auto";
// max 70% of screen height
event.target.style.height = `${Math.min(
event.target.scrollHeight,
window.innerHeight * 0.7
)}px`;
};