Andarist / Andarist/react-textarea-autosize

Proposal: Expose hook version to use with other libraries

未关闭
#331 0 条评论 7 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
TypeScript
星标
2.4k
派生
247
PR 合并指标
30 天内没有已合并 PR

描述

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!

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。