Hi, how would I use compose for a `DialogFragment`...
# compose
r
Hi, how would I use compose for a
DialogFragment
?
t
In my case I just created a AlertDialog and set the view as the compose view. Not sure if it’s the perfect approach but worked fine.
🙌 1
r
so you created an xml file which contained the composeView element?
t
No, you can create the compose view Programatically
Copy code
val dialogView = ComposeView(requireContext()).apply {
setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed)
            setContent {
// Your Compose stuff
}
}
t
In my case I had to keep the “compatibility” to call a composable “dialog content” from a DialogFragment, not sure about Rak case