https://kotlinlang.org logo
#compose
Title
# compose
d

dewildte

12/15/2021, 7:01 PM
I am using a
BottomSheetDialogFragment
and it’s layout has a
ComposeView
in it. When trying to show the sheet I get this:
java.lang.IllegalStateException: ViewTreeLifecycleOwner not found
after the framework calls:
androidx.compose.ui.platform.WindowRecomposer_androidKt.createLifecycleAwareViewTreeRecomposer(WindowRecomposer.android.kt:244)
Anybody run into this before?
a

Adam Powell

12/15/2021, 7:04 PM
Make sure you're using the latest versions of the fragment and androidx.activity libraries
(at least latest stable; betas/alphas are up to you)
i

Ian Lake

12/15/2021, 7:06 PM
FWIW, it was Fragment 1.3.1 that set the appropriate ViewTree owners for dialogs: https://developer.android.com/jetpack/androidx/releases/fragment#1.3.1
d

dewildte

12/15/2021, 7:07 PM
Ok, thanks, I am adding `
Copy code
implementation "androidx.fragment:fragment-ktx:1.4.0"
and see what happens.
Yeah that works!
🎉 2
@Ian Lake Any idea how to get a smooth opening animation? Like a slide up from the bottom?
i

Ian Lake

12/15/2021, 7:54 PM
I'd file a bug against Material Design Components (https://github.com/material-components/material-components-android) if you aren't seeing a smooth opening animation as they are the owners for
BottomSheetDialogFragment
a

Adam Powell

12/15/2021, 7:55 PM
also make sure you're doing any performance analysis on a release build run through r8
d

dewildte

12/16/2021, 2:45 PM
Will do, thanks so much guys! I am very grateful.
👍 1
4 Views