Michał Jurczyk

    Michał Jurczyk

    2 years ago
    Hey 👋 Does Compose support drag and drop? I have a
    LazyColumn
    of cards and want to drag'n'drop items onto the cards from a picker. In native UI I used to do it with
    setOnDragListener
    listening to
    ACTION_DROP
    and
    clipData
    🤔
    I was thinking about using an invisible
    AndroidView
    composable in each card, with all the listeners, but wanted to make sure I am not missing something obvious before I started hacking 😅
    Michał Jurczyk

    Michał Jurczyk

    2 years ago
    Yeah, but this seems to be mostly for local drags, with no interactions between the dragged
    Composable
    and the one below 🤔 And there is no drop callback, only the
    onStop
    on the dragged
    Composable
    , with offset as param. I guess I could do some calculation based on the offset, but no idea where to take it from there, especially in LazyColumn 🤔
    Zach Klippenstein (he/him) [MOD]

    Zach Klippenstein (he/him) [MOD]

    2 years ago
    Would be good to have system drag/drop support from the clipboard API too, although i wonder if that’s a feature anyone actually uses.
    Michał Jurczyk

    Michał Jurczyk

    2 years ago
    Good point, this is one of these features that feel most useful for press demos 😅
    Anyway, thanks a lot for the tip ☺️ I will try diving a bit deeper into it and if I can not get it to work, the AndroidView placeholder it is for now.
    Zach Klippenstein (he/him) [MOD]

    Zach Klippenstein (he/him) [MOD]

    2 years ago
    Couldn’t hurt to file an issue for drag/drop support while you’re at it. Issue tracker link is in the channel description.