Does the preview tool actually work for others? It...
# compose-desktop
d
Does the preview tool actually work for others? It stopped working for me the instant I split things into multiple Composable methods/files.
m
It does not for me - after Rendering... is gone nothing is shown in the preview winodw
o
cc: @alexey.tsvetkov
Please report an issue with reproducer
d
Thanks. I honestly didn't realize it was expected to be working :S
just to double-check, i'm not doing anything obviously wrong here, right?
compose plugin is installed and up to date, function is marked as
@Preview
, and there's no preview gutter icon nor tab. this is the latest stable version of IntelliJ Ultimate and compose 1.0.0
a
In your particular example, it doesn’t work due to the function’s receiver parameter, no?
d
You appear to be right...maybe I have a fundamental misunderstanding of things, then. How do we pass information to a
@Composable
function without being able to use a receiver parameter or arguments, since those disable previewing?
Or are you just SOL if your composable needs params?
a
You can create a
@Preview
that passes the necessary params to the “real”
@Composable
Copy code
@Composable
fun MyAwesomeComposable(text: String) {
    Text(text)
}

@Preview
@Composable
fun MyAwesomeComposablePreview() {
    MyAwesomeComposable("Hello there")
}
1
c
I do the same as the above and it seems to work fine
d
oh, that's a clever workaround
c
I don't think its so much a workaround, its the intended use for @Preview
k
Interesting! Thanks.
m
Actually I was checking with some recent RC and it did not work but now with 1.0 it does!