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

Feature request: support for device parameter and others of Compose @Preview #388

Open
bingningO opened this issue May 30, 2024 · 1 comment

Comments

@bingningO
Copy link

bingningO commented May 30, 2024

seems Showkase not take screenshots depending on the configuration of @Preview parameter, such as device, widthDp, heightDp.

currently I see if having a @Preview function set as

@Preview(device = Devices.PHONE)
@Preview(device = Devices.TABLET)
@Composable
internal fun PreviewBookCreditContent() {
      ...
}

the generated ShowKaseBrowserComponent looks like below

public val PreviewBookCreditContentDefaultGroupPreviewBookCreditContent: ShowkaseBrowserComponent =
    ShowkaseBrowserComponent(
        group = "Default Group",
        componentName = "PreviewBookCreditContent",
        componentKDoc = "",
        componentKey =
            """...credit_PreviewBookCreditContent_null_DefaultGroup_PreviewBookCreditContent_0_null""",
        isDefaultStyle = false,
        component = @Composable { PreviewBookCreditContent() }
    )

not read device parameter, also not take screenshots depending on its configuration.


p.s.

also if ShowKase adds support for new compose @Preview annotations such as @PreviewScreenSizes, @PreviewFontScale, would be much more helpful.

@vinaygaba
Copy link
Collaborator

In the context of Showkase, it doesn't quite make sense to parse the device property because the Showkase browser runs on a physical device. It already supports widthDp and heightDp - https://github.com/airbnb/Showkase?tab=readme-ov-file#showkasecomposable-currently-supports-the-following-properties

Thanks for flagging @PreviewScreenSizes and @PreviewFontScale. I'll figure out how to best integrate them.

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

2 participants