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

Don't expect Modifier parameters on Preview functions #377

Closed
ZacSweers opened this issue Jul 29, 2024 · 1 comment · Fixed by #412
Closed

Don't expect Modifier parameters on Preview functions #377

ZacSweers opened this issue Jul 29, 2024 · 1 comment · Fixed by #412
Labels
bug Something isn't working

Comments

@ZacSweers
Copy link
Collaborator

No description provided.

@ZacSweers ZacSweers added the bug Something isn't working label Jul 29, 2024
@yukilabo
Copy link

yukilabo commented Aug 5, 2024

In our project, we are experiencing the following problem. Does this Issue point out something similar?

// These are annotated with @Preview.
@DeviceWidthPreviews
@ThemePreviews
annotation class ComponentPreviews

// "TestPreview"  is a preview function, but Lint says "There is no modifier".
@ComponentPreviews
@Composable
private fun TestPreview() {
    Text(text = "Hello, World!")
}

I think this is because isPreview only checks if the function's annotation has @Preview attached to it.

github-merge-queue bot pushed a commit that referenced this issue Oct 1, 2024
* Allow test-only previews to be public

* Recurse preview annotations to check for inherited Previews

Resolves #377

* changelog

* Fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants