TextArea can't auto-size based on content
Opened this issue · 1 comments
When you have a BTF:
Box(
Modifier.heightIn(min = minTextAreaHeight, max = maxTextAreaHeight),
contentAlignment = Alignment.TopStart,
) {
BasicTextField(state = myState, modifier = Modifier.fillMaxWidth())
}
It will size itself based on the number of text lines in the state, and the heightIn
modifier. When empty, it matches the min; when there are too many lines to fit in the max it'll stop growing and start scrolling.
However, the same does not happen with TextArea
:
Box(
Modifier.heightIn(min = minTextAreaHeight, max = maxTextAreaHeight),
contentAlignment = Alignment.TopStart,
) {
TextArea(state = myState, modifier = Modifier.fillMaxWidth())
}
The TextArea
will always stretch until max, regardless of its text contents.
It may be worth simplifying how the TextArea scrollable layout is handled, by decoupling it from ScrollableContainer, and/or fix the ScrollableContainer implementation. The main issue is that doing a 2D scrollable container adds a lot of complexity and requires a number of compromises, and it's even unclear if 2D scrolling in Compose for Desktop is working at all anyway. We should likely deprecate/remove the 2D version and focus on one axis only until proper support at a higher level than draggable2D
is available in Compose.