Hello! What is the purpose of `@Preview` in the sa...
# compose
z
Hello! What is the purpose of
@Preview
in the sample code? AS will only display the preview in the right panel when
androidx.compose.ui.tooling.preview.Preview
is imported in
androidMain
, but
org.jetbrains.compose.ui.tooling.preview.Preview
here cannot. AS does not show any preview for it.
v
Right. The annotation should not be available in commonMain in the first place.
w
Compose Previews are available in common and desktop code in Fleet.
☝️ 2
☝🏻 1
👍🏻 1
z
@Wout Werkman Are there any plans to support it in IDEA and AS?
e
You can get them to work in AS as well. I don't remember the exact steps offhand but you have to define the preview annotation with the correct package in common code with an "optional actual" annotation, add a dependency on some artifacts, and use the CMP IDE plugin.
☝️ 1
w
It's worth noting that in this case you will have to add a desktop target
z
Hello!
androidx.compose.ui.tooling.preview.Preview
cannot load resources in
composeResources
of
commonMain
. Is this a bug?
e
@Wout Werkman sorry to bother - do you have a tracker for this bug? Very keen to follow it 😸
plus1 1
w
The preview that is shown here is from Android studio, since I don't work on those previews, I don't know their issues by heart. However, we had the same issue in Fleet for common previews (if you didn't have a desktop target), and this has been resolved since 1.37.