Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TextArea can't auto-size based on content #630

Open
rock3r opened this issue Oct 15, 2024 · 1 comment
Open

TextArea can't auto-size based on content #630

rock3r opened this issue Oct 15, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@rock3r
Copy link
Collaborator

rock3r commented Oct 15, 2024

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.

@rock3r rock3r added the bug Something isn't working label Oct 15, 2024
@rock3r rock3r self-assigned this Oct 15, 2024
@rock3r
Copy link
Collaborator Author

rock3r commented Oct 17, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant