Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How would this work with Compose? #11

Open
itsandreramon opened this issue May 27, 2021 · 0 comments
Open

How would this work with Compose? #11

itsandreramon opened this issue May 27, 2021 · 0 comments

Comments

@itsandreramon
Copy link

itsandreramon commented May 27, 2021

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 {
                ...
            }
        }
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant