From 751ed6c9ec9b0d9f8e4b8c425faed28cd1e529c8 Mon Sep 17 00:00:00 2001 From: Francesco Cioria Date: Sun, 10 Dec 2017 12:12:17 +0100 Subject: [PATCH 1/2] always run "autosize" a frame after componentDidMount --- src/TextareaAutosize.tsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/TextareaAutosize.tsx b/src/TextareaAutosize.tsx index e9e4eaf..5173a20 100644 --- a/src/TextareaAutosize.tsx +++ b/src/TextareaAutosize.tsx @@ -63,13 +63,15 @@ export default class TextareaAutosize extends React.Component autosize(this.textarea)); - } else { - autosize(this.textarea); } + /* + the defer is needed to: + - force "autosize" to activate the scrollbar when this.props.maxRows is passed + - support StyledComponents (see #71) + */ + setTimeout(() => autosize(this.textarea)); + if (onResize) { this.textarea.addEventListener(RESIZED, onResize as any); } From 68c424fe513ed26ef602d215ace48a4020cdfdb5 Mon Sep 17 00:00:00 2001 From: Francesco Cioria Date: Sun, 10 Dec 2017 12:17:29 +0100 Subject: [PATCH 2/2] add examples for maxRows and maxHeight --- examples/Examples.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/examples/Examples.md b/examples/Examples.md index d7abefa..99f4638 100644 --- a/examples/Examples.md +++ b/examples/Examples.md @@ -17,6 +17,24 @@ /> ``` +#### Maximum height + +using `maxRows` +```js + +``` + +using `maxHeight` +```js + +``` + #### Prefilled ```js