2

In Jetpack Compose I am using BasicTextField and I want to add my own horizontalScroll for it. When I apply it, it seems to have built in minimum width, so even if content fits, user is still able to scroll.

Scrolling behaviour when horizontalScroll is added

I don't have this issue if I remove horizontal scroll and use singleLine = true mode. Then BasicTextField becomes scrollable only when entered value doesn't fit.

Is there any way to add some sort of "wrap content" flag for horizontal scroll?

The implementation is pretty standart, I add horizontal scroll to it like this:

var scrollState by remember { mutableStateOf(ScrollState(0)) }
BasicTextField(
    modifier = Modifier
        .horizontalScroll(state = scrollState, reverseScrolling = true),
singleLine = true,
...
Marius
  • 51
  • 3

0 Answers0