1

I want to detect when my dropdown menu clicked or opened in jetpack compose and perform an operation on that click.

This is the code that I'm Currently using.

Spinner(
    modifier = modifier
        .fillMaxWidth()
        .heightIn(min = 40.dp)
        .border(1.dp, alto)
        .background(if (enabled) white else gray.copy(alpha = 0.7f))
        .onGloballyPositioned { layoutCoordinates ->
            rowSize = layoutCoordinates.size.toSize()
        },
    dropDownModifier = dropdownModifier
        .width(with(LocalDensity.current) { rowSize.width.toDp() })
        .wrapContentHeight(),
    enabled = enabled,
    items = displayItems,
    selectedItem = selected,
    onItemSelected = onSelectionChange,
    selectedItemFactory = selectedItemFactory,
    dropdownItemFactory = dropdownItemFactory,
)

Omar Redani
  • 131
  • 5
  • 1
    what is spinner in your case? seems that it is a custom function, there's no it in Jetpack Compose by default. show the implementation under the hood please – Sergei Mikhailovskii Nov 15 '22 at 19:41
  • 1
    You comment solve my issue thank you very much, the spinner was a custom function that holds DropdownMenu. – Omar Redani Nov 15 '22 at 20:31

0 Answers0