Fixed
Status Update
Comments
il...@google.com <il...@google.com> #2
ap...@google.com <ap...@google.com> #4
This has been fixed by the PR above, and will be available in Fragment 1.4.0-alpha01
.
jb...@google.com <jb...@google.com> #5
Thank You for the PR!
na...@google.com <na...@google.com> #6
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.wear.protolayout:protolayout-material-core:1.1.0-rc01
androidx.wear.tiles:tiles-tooling:1.3.0-rc01
androidx.wear.tiles:tiles-tooling-preview:1.3.0-rc01
Description
Using Compose within Fragments require setting a differenthttps://developer.android.com/jetpack/compose/interop/interop-apis#composition-strategy it is still a common 'gotcha' that developers frequently run into as per feedback we've received from partners ( b/229427938 ).
ViewCompositionStrategy
(DisposeOnViewTreeLifecycleDestroyed
) so that the composition follows the fragment's view lifecycle. While we do document this behavior inTo prevent developers from making this mistake, we can improve the DevEx by either:
ComposeView
in a fragment (preferred - works for existing implementations)ComposeFragment
(less preferred - requires awareness of this new component, also can be confused with fragment-in-compose use case)