Andarist / Andarist/react-textarea-autosize

Proposal: Expose hook version to use with other libraries

オープン
#331 コメント 0 件 リアクション 7 件 担当者 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 を短くまとめたダイジェスト。