I have an ExposedDropDownMenu that is extremely ~l...
# compose
c
I have an ExposedDropDownMenu that is extremely laggy delayed when opening. It takes like a good 4 seconds (and yes this happens in release builds too). I have a bunch of items (it's a country picker actually). My idea was "I know lets make it Lazy" but that leads to a crash. Any ideas from anyone?
r
Not a perfect solution, but as a workaround you can just keep the dropdown closed on blank inputs. Once they start typing, the list of countries you're dealing with is already massively reduced by filtering.
c
Ooh. We don't actually support filtering. Just a plain old drop down right now
f
I haven't tried this, but what if you specify a height to the
ExposedDropDownMenu
to satisfy the lazy list requirement?
a
Use lazy list and give it a fixed width.
c
Interesting. Can I just use the default width for these things? Or is that the point (that the width changes depending on the item)?
a
There is no default width. See this thread.
‼️ 1
s
I'm curious: do you see any perf difference if you try out cascade?
c
oooh. I thought cascade was only for like action overflow, not necessarily for your "standard" drop down selector list. If it is in fact for a normal drop down, then I'd love to give it a whirl. love the smooth anims ❤️
s
It's actually not designed to be used as an exposed dropdown but I'm interested in seeing if it's perf is any different 😄.
c
will give it a try later on!
Circled back to this today and I get the same crash. If I add a height to the lazy column, then I dont crash... but then it doesn't scroll. 😄 Thoughts?
Copy code
ExposedDropdownMenu(expanded = expanded, onDismissRequest = { expanded = false }) {
    LazyColumn(Modifier.width(100.dp)){
        itemsIndexed(list) { index, selectionOption ->
            DropdownMenuItem(
                onClick = {
                    selected(index)
                    expanded = false
                }) {
                    Text(text = selectionOption)
r
Yep, same here. I wonder if the nested scrolling is doing something weird. The only other thing I can think of which probably works (but is overkill) is copying the implementation of
ExposedDropdownMenu
and replacing the use of
Column
internally with
LazyColumn
.
c
@Adam Powell sorry for the ping, but you commented on the previous thread that Albert dropped in here. Do you have any idea how to use an ExposedDropDownMenu with LazyColumn.
👀 1
259 Views