1

I'm starting using Jetpack compose and i'm facing some issues with Lazy Column.

The problem is that i want to make a list that contains another list inside every root item (such as a card that containt another list inside).

Unfortunately, when i run the following code (below the snippet that resume what i'm trying to do).

I catch the exception:

java.lang.IllegalStateException: Vertically scrollable component was measured with an infinity maximum height constraints, which is disallowed. One of the common reasons is nesting layouts like LazyColumn and Column(Modifier.verticalScroll()). If you want to add a header before the list of items please add a header as a separate item() before the main items() inside the LazyColumn scope. There are could be other reasons for this to happen: your ComposeView was added into a LinearLayout with some weight, you applied Modifier.wrapContentSize(unbounded = true) or wrote a custom layout. Please try to remove the source of infinite constraints in the hierarchy above the scrolling container.

Code:

LazyColumn(modifier = Modifier.wrapContentHeight()) {
    items(list.value) { 
        item -> LazyColumn(modifier = Modifier.wrapContentHeight()) {
            //some Text
        }
    }
}

I don't need the nested Lazy Column to be scrollable, so i'm wondering if for this purpose there is another element to use instead of LazyColumn, or i'm making some other mistake.

I've also tried to put in item{} block other layout elements, as suggested by the Exception, but with the same result.

ℛɑƒæĿᴿᴹᴿ
  • 4,983
  • 4
  • 38
  • 58
Sguit
  • 35
  • 1
  • 8

2 Answers2

0

No, unfortunately, nesting scrollable composables in the same direction is not allowed.

sjso
  • 277
  • 2
  • 11
-1

It's not supported in jetpack compose, but I think it should be supported because many use cases need that. e.g e-commerce applications,food delivery (like DoorDash)