Andarist / Andarist/react-textarea-autosize

Incorrect initial height when animating from max-width: 0

Aperta
#215 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
TypeScript
Stelle
2.4k
Fork
247
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

**Do you want to request a feature or report a bug?**
Bug

**What is the current behavior?**
The strange is behaviour is observed under the following conditions:
- A view that contains a `TextArea` is animated in starting with `max-width: 0` (I used `react-transition-group`)
- `TextArea` is `width: 100%` (or `flex: 1` if `display: flex` is used on parent)

The behaviour is that the `TextArea` is initiated with the height with so many rows as there are characters in the `defaultValue`. So, if I initiate `TextArea` with value `abc`, the height will be 3 rows, and if with `abcde` value - 5 rows.

**If the current behavior is a bug, please provide the steps to reproduce it**
I managed to reproduce this behaviour which can be seen with slow animation [here](https://codesandbox.io/embed/nn30ppzrzl).

**What is the expected behavior?**
I would expect the `TextArea` to be initiated with the height that it should have if there was no animation, i.e. animation should not affect the height calculation.

**Which versions, and which browser / OS are affected by this issue? Did this work in previous versions?**
Chrome on Mac OS and codesandbox are the ones I've tried.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.