Skip to content

Commit

Permalink
Reverts ComposeView ViewCompositionStrategy to default.
Browse files Browse the repository at this point in the history
This was the first attempt to fix dead `ComposeView` instances in shuffled `Dialog` windows, but it breaks other things. Still seems like the right thing to do, but maybe that ship has sailed. If the need comes up again, consider adding a `ViewEnvironment` property to allow customizing it (yuck).
  • Loading branch information
rjrjr committed Aug 1, 2024
1 parent c7cd119 commit 7845a5e
Showing 1 changed file with 0 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.remember
import androidx.compose.ui.platform.ComposeView
import androidx.compose.ui.platform.LocalLifecycleOwner
import androidx.compose.ui.platform.ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed
import androidx.compose.ui.viewinterop.AndroidView
import androidx.lifecycle.setViewTreeLifecycleOwner
import com.squareup.workflow1.ui.Screen
Expand Down Expand Up @@ -126,7 +125,6 @@ public fun <ScreenT : Screen> ScreenComposableFactory<ScreenT>.asViewFactory():
container: ViewGroup?
): ScreenViewHolder<ScreenT> {
val view = ComposeView(context)
view.setViewCompositionStrategy(DisposeOnViewTreeLifecycleDestroyed)
return ScreenViewHolder(initialEnvironment, view) { newRendering, environment ->

// Update the state whenever a new rendering is emitted.
Expand Down

0 comments on commit 7845a5e

Please sign in to comment.