https://kotlinlang.org logo
s

Se7eN

09/18/2020, 11:54 AM
Does
ScrollableColumn
not support nested scrolling? I have a
LazyRowFor
and a
LazyColumnFor
inside a
ScrollableColumn
and it messed up vertical scrolling. Fling scroll doesn't work.
Copy code
ScrollableColumn {
    Text(...)
    LazyRowFor(...)
    LazyColumnFor(...)
}
y

Yann Badoual

09/18/2020, 11:58 AM
Why not use directly:
Copy code
LazyColumn {
    Text(...)
    LazyRowFor(...)
    // Additional content
}
? (I tried using LazyColumn stand-alone, without nested scrolling, and with very simple items, fling wasn't working and it was super laggy)
s

Se7eN

09/18/2020, 12:03 PM
It's not stable so I'm using
LazyColumnFor
rn. But I'll try with
LazyColumn
. Is there a sample for
LazyColumn
? Looks like it doesn't take a composable argument
y

Yann Badoual

09/18/2020, 12:10 PM
It does,
LazyColumnFor
and
LazyColumn
use the same composable under the hood
LazyFor
. I'm not sure what are the differences between the two, except that one is wrapping a list of items (LazyColumnFor) while the other has a more similar api with
Column
s

Se7eN

09/18/2020, 12:15 PM
It doesn't... Maybe they changed it in alpha03?
y

Yann Badoual

09/18/2020, 12:15 PM
content
is what you're looking for
s

Se7eN

09/18/2020, 12:15 PM
Here's the error because content isn't composable
🤔 1
y

Yann Badoual

09/18/2020, 12:17 PM
They changed it, now you have to wrap items inside an
item
call
💯 1
s

Se7eN

09/18/2020, 12:17 PM
LazyColumnFor's content is composable
y

Yann Badoual

09/18/2020, 12:17 PM
`
Copy code
LazyColumn {
   item {
      // I'm a composable
   }
}
s

Se7eN

09/18/2020, 12:17 PM
Got it
y

Yann Badoual

09/18/2020, 12:18 PM
There's also
items
and
itemsIndexed
s

Se7eN

09/18/2020, 12:18 PM
Thanks!
y

Yann Badoual

09/18/2020, 12:19 PM
Tell me if it's better, I'm curious
s

Se7eN

09/18/2020, 12:21 PM
Lags and fling doesn't work just like
ScrollableColumn
😞 1
a

Andrey Kulikov

09/18/2020, 12:44 PM
could you please share the final code you have? yes, it is tricky to have two components scrollable in the same direction nested, but if you use
LazyColumn
dsl instead the fling should work fine
s

Se7eN

09/18/2020, 12:47 PM
Copy code
LazyColumn {
   item {
      Button(...)
      LazyRowFor(...)
      LazyColumnFor(...)
   }
}
I can make a sample project if you want
y

Yann Badoual

09/18/2020, 12:49 PM
you shouldn't need the LazyColumnFor anymore (I think)
s

Se7eN

09/18/2020, 12:50 PM
So...a loop?
a

Andrey Kulikov

09/18/2020, 12:51 PM
Copy code
LazyColumn {
   item {
      Button(...)
   }
   item {
      LazyRowFor(...)
   }
   items(yourList) {
       ... item of the list
   }
}
could you please try something like this?
s

Se7eN

09/18/2020, 12:51 PM
Sure wait
Yeah the fling works great now
Although it's kinda lagging a little more than
LazyColumnFor
but that's expected right now I guess?
d

dambakk

09/18/2020, 5:20 PM
I had a
ScrollableColumn
with a
LazyColumnFor
inside and fling didn’t work. Replacing the lazy column with a
forEach
did the trick, fling now works perfectly 👌
1