k

    Kshitij Patil

    1 year ago
    I had prepared a
    AutoCompleteTextField
    few days ago but with the latest compose (alpha09) it seems like it's a bad idea to put a TextField inside a
    LazyColumn
    as one of its
    item
    , especially when its other items are decided based on what we type in the TextField, as I found my current implementation just gets stuck in an infinite loop of recomposition, freezing the textfield. Any best practices, guidelines to follow in this regard? What should we keep inside a LazyColumn and what we shouldn't?
    Dominaezzz

    Dominaezzz

    1 year ago
    Why is the
    TextField
    inside the
    LazyColumn
    ?
    k

    Kshitij Patil

    1 year ago
    I was planning to show suggestions below it, so I thought I could use LazyColumn items for suggestion and use single
    item
    for TextField, as we use it for headers right now
    Dominaezzz

    Dominaezzz

    1 year ago
    Why not
    Column { TextField(....); LazyColumn { ... } }
    is what I'm getting at.
    Or even better a
    DropdownMenu
    rsktash

    rsktash

    1 year ago
    DropdownMenu is not good choice. Suggestions will be shown while we are typing based on the query. When drop-down shown input field loose focus automatically
    Dominaezzz

    Dominaezzz

    1 year ago
    That is configurable
    rsktash

    rsktash

    1 year ago
    How can we configure?
    Dominaezzz

    Dominaezzz

    1 year ago
    We own the state of the composable. So we can keep in shown when we want.https://developer.android.com/reference/kotlin/androidx/compose/material/package-summary#dropdownmenu
    expanded = true
    rsktash

    rsktash

    1 year ago
    I’m not asking about visibility state. How can we prevent focus change of input field when dropdown shown ?
    Dominaezzz

    Dominaezzz

    1 year ago
    Ah I see. No idea, haven't used it much.
    k

    Kshitij Patil

    1 year ago
    I'm trying to implement a validator for AutoCompleteTextField (only items from a List are allowed) and I'm finding it really difficult. I hope it was available out of the box
    rsktash

    rsktash

    1 year ago
    @Kshitij Patil Can you share the code?
    Adam Powell

    Adam Powell

    1 year ago
    The issue in the OP of this thread sounds like a bug, please file it with an isolated repro if you have a few minutes. A text field inside of a LazyColumn should be alright.
    k

    Kshitij Patil

    1 year ago
    Now it sounds fishy to me as well because I remember it used to work in
    alpha07
    , I'll try to create a repro when I get time and @rsktash you can also have a look at.