How would this work with Compose?
itsandreramon opened this issue · 0 comments
itsandreramon commented
Since I am having a hybrid application at the moment, I need to use Material Motion with Fragments. (Motion isn't out yet for Compose anyways I think) I followed the exact same steps as in the Codebase, but I get the following error:
java.lang.IllegalStateException: ViewTreeLifecycleOwner not found from android.view.ViewOverlay
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
sharedElementEnterTransition = MaterialContainerTransform().apply {
drawingViewId = R.id.nav_host_fragment
duration = resources.getInteger(R.integer.tempory_motion_duration_large).toLong()
scrimColor = Color.TRANSPARENT
setAllContainerColors(requireContext().themeColor(R.attr.colorSurface))
}
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
return inflater.inflate(
R.layout.fragment_add_visit, container, false
).apply {
findViewById<ComposeView>(R.id.compose_view).setContent {
MyTheme {
...
}
}
}
}