Andarist / Andarist/react-textarea-autosize

Proposal: Expose hook version to use with other libraries

Đang mở
#331 0 bình luận 7 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
TypeScript
Star
2.4k
Fork
247
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Hey! Thanks for this awesome library 🙏 I've been using it in different projects with success 👏
In a recent project I was using `react-mde` as a markdown editor. It uses a `` under the hood. But I wanted it to auto-expand. I tried some different css solutions without any luck.

Then I thought, maybe it would be possible to expose the logic in this library as a hook. I gave it a go, and it works like a charm!

I created an api like this:

```tsx
const textareaRef = useRef<HTMLTextareaElement>(null);
useTextareaAutosize(textareaRef, { minRows: 8 });

return <ReactMDE {...} refs={{ textarea: textareaRef }} />;
```

I totally agree if you think this is out of scope of this project. But if you like the idea I would love to give it a go and provide a PR!

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.