Andarist / Andarist/react-textarea-autosize

Incorrect initial height when animating from max-width: 0

Offen
#215 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
TypeScript
Sterne
2.4k
Forks
247
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

**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.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.