Andarist / Andarist/react-textarea-autosize

Incorrect initial height when animating from max-width: 0

Open
#215 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
2.4k
Forks
247
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.