Found another issue with Compose and `BottomSheetD...
# compose-android
g
Found another issue with Compose and
BottomSheetDialogFragment
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?
Screen_recording_20240920_121908.webm
Copy code
class 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 },
                        )
                    }
                }
            }
        }
    }
}