question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

doesn't support @Composables with default params

See original GitHub issue

Hopefully this is enough of a stacktrace with beta12:

error: com.airbnb.android.showkase.processor.exceptions.ShowkaseProcessorException: Make sure that the @Composable functions that you annotate with the Preview annotation only have a single parameter that is annotated with @PreviewParameter.
  	at com.airbnb.android.showkase.processor.logging.ShowkaseValidator.validateComponentElement$showkase_processor(ShowkaseValidator.kt:59)
Supported source version 'RELEASE_8' from annotation processor 'org.jetbrains.kotlin.kapt3.base.ProcessorWrapper' less than -source '11'

  	at com.airbnb.android.showkase.processor.ShowkaseProcessor.processPreviewAnnotation(ShowkaseProcessor.kt:101)
  	at com.airbnb.android.showkase.processor.ShowkaseProcessor.processComponentAnnotation(ShowkaseProcessor.kt:75)
com.airbnb.android.showkase.processor.exceptions.ShowkaseProcessorException: Make sure that the @Composable functions that you annotate with the Preview annotation only have a single parameter that is annotated with @PreviewParameter.

  	at com.airbnb.android.showkase.processor.ShowkaseProcessor.process(ShowkaseProcessor.kt:57)
  	at com.airbnb.android.showkase.processor.BaseProcessor.internalProcess(BaseProcessor.kt:96)
  	at com.airbnb.android.showkase.processor.BaseProcessor.process(BaseProcessor.kt:64)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:16

github_iconTop GitHub Comments

1reaction
vinaygabacommented, Mar 1, 2022

@kenyee The stopgap solution would be to just wrap these methods inside a function that doesn’t accept parameters. Definitely not ideal but unblocks you…

fun ModalGripperPreview() {
    ModalGripper()
}

As I think more about it, I think it should be straightforward to add this functionality (support for functions with default params). Will keep you posted!

0reactions
kenyeecommented, Mar 31, 2022

thanks Vinay! That looked like a decent amount of changes 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Composable functions with non-default parameters are not ...
As the issue defines here Composable functions with non-default parameters are not supported. This means that there should be a default ...
Read more >
Support default values in @Composable abstract functions ...
Adding default values to a @Composable function in an interface/abstract class results in 'Abstract Composable functions cannot have parameters ...
Read more >
Locally scoped data with CompositionLocal | Jetpack Compose
Not providing a default value can cause problems and frustration when creating tests or previewing a composable that uses that CompositionLocal will always ......
Read more >
First steps in Jetpack Compose, Part 1 - ProAndroidDev
Composable functions with non-default parameters are not supported in Preview unless they are annotated with @PreviewParameter.
Read more >
Composable Functions - Medium
Notice that the composable doesn't return anything (it returns `Unit`), ... Notice that the parameters provided to the functions entirely control the UI....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found