Android 12 Developer Preview is here! Try it out, and give us your feedback!

DisposeOnViewTreeLifecycleDestroyed

object DisposeOnViewTreeLifecycleDestroyed : ViewCompositionStrategy
kotlin.Any
   ↳ androidx.compose.ui.platform.ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed

ViewCompositionStrategy that disposes the composition when the ViewTreeLifecycleOwner of the next window the view is attached to is destroyed. This strategy is appropriate for Compose UI views that share a 1-1 relationship with their closest ViewTreeLifecycleOwner, such as a Fragment view.

Summary

Public methods
() -> Unit

Install this strategy for view and return a function that will uninstall it later.

Public methods

installFor

fun installFor(view: AbstractComposeView): () -> Unit

Install this strategy for view and return a function that will uninstall it later. This function should not be called directly; it is called by AbstractComposeView.setViewCompositionStrategy after uninstalling the previous strategy.