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

Showkase navigation breaks when preview contains a BackHandler #267

Merged
merged 6 commits into from
Oct 30, 2022

Conversation

vinaygaba
Copy link
Collaborator

@vinaygaba vinaygaba commented Sep 25, 2022

Fixes #247

Description of the issue

If you have BackHandler which does nothing inside @Preview it breaks navigation for Showkase browser

Snippet to reproduce:

@Composable
fun ContentScreen(
    viewModel: ContentViewModel = androidx.lifecycle.viewmodel.compose.viewModel(),
) {
    Content(onBack = viewModel::onBack)
}

@Composable
fun Content(onBack: () -> Unit) {
    BackHandler(onBack = onBack)
}

@Preview
@Composable
fun ContentPreview() {
    Content(
        onBack = {},
    )
}

If you open ContentPreview from Showkase browser, it will not be possible to navigate back

@airbnb/showkase-maintainers

@vinaygaba vinaygaba marked this pull request as ready for review September 25, 2022 21:03
@vinaygaba vinaygaba merged commit 3ecf55d into master Oct 30, 2022
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

Successfully merging this pull request may close these issues.

Showkase browser doesn't work with empty @Preview BackHandler
2 participants