https://kotlinlang.org logo
#compose
Title
# compose
f

Fudge

10/23/2019, 10:09 PM
I don't seem to be getting a live preview? 😕
c

Cody Engel

10/23/2019, 10:10 PM
Did you re-run?
I also noticed that Preview doesn’t display if you have split view setup in the IDE, it seems to only work if you only have one tab open
f

Fudge

10/23/2019, 10:10 PM
do you mean re-build? I didn't try running the app.
c

Cody Engel

10/23/2019, 10:11 PM
The IDE should prompt you to rebuild anytime you change something for Compose
f

Fudge

10/23/2019, 10:12 PM
Not getting it!
r

romainguy

10/23/2019, 10:13 PM
Rebuilding should be all you need
f

Fudge

10/23/2019, 10:13 PM
There's something wrong with my install, then.
c

Cody Engel

10/23/2019, 10:14 PM
What version of Android Studio are you running?
f

Fudge

10/23/2019, 10:14 PM
4.0 canary 1
c

Cody Engel

10/23/2019, 10:18 PM
@Fudge can you check out
PostCardTop
? That preview seems to work for me, adding
@Preview
is not working for me in JetnewsApp.kt
f

Fudge

10/23/2019, 10:19 PM
you're totally right
c

Cody Engel

10/23/2019, 10:20 PM
@romainguy — adding Preview to certain Composables seems to be broken at least in the sample project
👆 1
j

jim

10/24/2019, 12:15 AM
The
@Preview
annotation can only be applied to composable functions with zero parameters. Otherwise, the IDE doesn't know what values to pass in for those parameters.
c

Cody Engel

10/24/2019, 4:22 AM
@jim — the IDE will provide a warning, the screenshot above has
@Preview
on a zero parameter function.
l

Luca Nicoletti

10/24/2019, 7:38 AM
@jim what if functions with parameter have default values?
f

Fudge

10/24/2019, 7:39 AM
That’s not really related considering the function had no parameters in this case.
l

Luca Nicoletti

10/24/2019, 7:40 AM
@Fudge sorry, just curiosity 😛
2 Views