Hi Friends, I can't find any example usage of `laz...
# kilua
s
Hi Friends, I can't find any example usage of
lazyRow
in https://github.com/rjaros/kilua/tree/main/examples/playground Where can I find its usage? I can't seem to get it to do what I want.
r
lazy-layouts
module in Kilua is a direct port of https://gitlab.com/opensavvy/ui/compose-lazy-html You can check the documentation of the original library
❤️ 1
lazyRow
should work just like
lazyColumn
, doesn't it?
I've checked and it does work the same way. An example:
Copy code
div {
    border(1.px, style = BorderStyle.Solid, color = Color.Red)
    height(50.px)
    width(600.px)
    overflow(Overflow.Auto)
    lazyRow {
        items(200) {
            div {
                width(30.px)
                height(30.px)
                border(1.px, BorderStyle.Solid, Color.Black)
                +"$it"
            }
        }
    }
}
There is an example of
lazyColumn
in the playground app.
s
Thanks for the reference and the verification! Sorry I got stuck in some work, hence wasn't able to do it myself.
Although, I'm still confused as to what the
setup
callback does in this component? The DSL callback allows us to add items, but what does setup do?
r
But I've just noticed lazyRow/Column components are a bit broken when it comes to
setup()
function - it should be composable and it's not. Will have to fix that in the next release.
s
Ah yess! I was going to talk about this only 😆
Thank you for detecting it You're always one step ahead 😂 🙌
r
If you mentioned the
setup
in the morning, it would already be fixed 😉
s
Apologies 😛 I was just making do with
hPanel
as a workaround It's okay, I can wait for a while, replacing hPanel with lazyRow should be a task of a few seconds once it's fixed
r
In theory, this should work after fixing the
setup()
function
Copy code
div {
    border(1.px, style = BorderStyle.Solid, color = Color.Red)
    height(100.px)
    width(600.px)
    overflowY(Overflow.Hidden)
    overflowX(Overflow.Auto)
    lazyRow({
        height(100.px)
        columnGap(1.px)
        alignItems(AlignItems.Center)
    }) {
        items(200) {
            div {
                width(30.px)
                height(30.px)
                border(1.px, BorderStyle.Solid, Color.Black)
                +"$it"
            }
        }
    }
}
In theory, because it doesn't work. Setting column gap somehow breaks visibility detector. I'll have to investigate more.