-
-
Save andreymusth/019a74f878618999f727ac9ff00801fb to your computer and use it in GitHub Desktop.
android compose view
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
internal fun ViewGroup.setContent( | |
parent: CompositionContext, | |
content: @Composable () -> Unit | |
): Composition { | |
GlobalSnapshotManager.ensureStarted() | |
val composeView = | |
if (childCount > 0) { | |
getChildAt(0) as? AndroidComposeView | |
} else { | |
removeAllViews(); null | |
} ?: AndroidComposeView(context).also { addView(it.view, DefaultLayoutParams) } | |
return doSetContent(composeView, parent, content) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment