Grigory Panko
09/20/2024, 9:22 AMBottomSheetDialogFragment
interaction: expanded DropdownMenu
(both material2 and material3) loses its correct position after recomposition (if I understand correctly). Code and video are also in thread. Is the Compose and BottomSheetDialogFragment
interaction even supported and I'm doing something wrong?Grigory Panko
09/20/2024, 9:22 AMGrigory Panko
09/20/2024, 9:24 AMclass MyPopupFragment : BottomSheetDialogFragment() {
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
) = ComposeView(inflater.context).apply {
setContent {
var isExpanded by remember { mutableStateOf(false) }
var item by remember { mutableStateOf("") }
Box {
Button(
onClick = { isExpanded = true }
) {
Text(item)
}
DropdownMenu(
expanded = isExpanded,
onDismissRequest = { isExpanded = false },
) {
for (text in listOf("123", "456", "789", "101112")) {
DropdownMenuItem(
content = {
Text(text = text)
},
onClick = { item = text },
)
}
}
}
}
}
}