Dumb question of the day: Do I have to do somethin...
# compose
n
Dumb question of the day: Do I have to do something special to see the preview of my composable in the documentation? I mean this:
Copy code
/**
 * My Component
 *
 * @sample com.example.tempcompose.SimplePreview
 */
@Composable
fun MyComposable() { ... }

@Preview
@Composable
fun SimplePreview() {
    MyComposable()
}
When I hit Cmd+Space I can see the sample code, but not the preview…
v
the only requirement is that you need to build it in order to see the Preview. It’s known to be a bit flaky though so could be one of those situations.
n
I see… I build and rebuild the project a few times but this feature never worked for me… Is there any setting to enable that or something like that?
b
I’ve noticed that if the first element in my composable is a Scaffold it doesn’t work
n
It does not work for me at all 😕 This
MyComposable
function has just one
Text
in it 😞
g
Can you share what’s inside MyComposable exactly?
n
@Gabriel Feo does it matter? It’s only a
Text
with some modifiers…
g
Maybe not, but since we couldn’t help you with the other snippet
m
Also make sure if your composable has parameters that they have defaults, that was an issue I had.
n
@Gabriel Feo @Madhava here is the full code https://gist.github.com/nglauber/a4db90c27a4e3f81b39d130a6c363c73 As I told you, it is just a
Text
with no parameters.
a
which compose and AS version you use? try updating
See if you can see previews from other samples
n
Last time I tried was dev-14 on Android 4.2 Canary 4