Last active
March 29, 2023 13:44
-
-
Save k0siara/bb527d5a29f530d707a29cd1203b68b0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun DialogFragment.dialogFragmentComposeView( | |
content: @Composable () -> Unit | |
): ComposeView { | |
return ComposeView(requireContext()).apply { | |
layoutParams = ViewGroup.LayoutParams( | |
ViewGroup.LayoutParams.MATCH_PARENT, | |
ViewGroup.LayoutParams.MATCH_PARENT | |
) | |
// Another interesting flaw. If you use other strategies in DialogFragment you may get crashes 🫠 | |
setViewCompositionStrategy(strategy = ViewCompositionStrategy.DisposeOnDetachedFromWindow) | |
setContent { | |
CustomComposeTheme( | |
darkTheme = false | |
) { | |
content() | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment