Can I detect taps outside of a component? I want t...
# compose
d
Can I detect taps outside of a component? I want to have a dropdown collapse itself on tap outside of it, without needed to require every parent to listen for tap events and tell it to close
z
You can use 'DropDown' composable for this usecase
d
Are you talking about DropDownMenu? If so, that's what I'm wrapping. I'm finding it quite finicky
l
DropDownMenu
already should dismiss when you tap outside. Are you setting
expanded
to false in
onDismissRequest
?
d
I was asking because I've needed to do this other places and assumed I'd need to do it for DropDownMenu as well
I actually haven't managed to get DropDownMenu to display anything to the screen yet @Louis Pullen-Freilich [G]
Nevermind, the issue was the DropDownMenu doesn't show up in the preview
l
Ah yeah, DropDownMenu is a popup window, and I think popup windows and dialogs don't yet show up in the preview