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 to preview Composable with BindEffect? #86

Open
timurgilfanov opened this issue Aug 4, 2023 · 0 comments
Open

How to preview Composable with BindEffect? #86

timurgilfanov opened this issue Aug 4, 2023 · 0 comments

Comments

@timurgilfanov
Copy link

@Preview @Composable fun MainScreenPreview() { BindEffect(permissionsController) }

When run preview task for Android exception has been thrown:
java.lang.ClassCastException: androidx.compose.ui.tooling.PreviewActivity cannot be cast to androidx.fragment.app.FragmentActivity at dev.icerock.moko.permissions.compose.BindEffect_androidKt$BindEffect$1.invokeSuspend(BindEffect.android.kt:24)

Reason of exception is cast context to FragmentActivity in BindEffect.

I don't know is there the way to use FragmentActivity to preview Composable. Now my solution is to add parameter to skip binding. It's bad for code readability. May be someone propose better solution?

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