darkmoon_uk
08/06/2021, 3:19 PMcommon
source set i.e. define a @Preview
from within some materialCommon
(Desktop + Android) source set. When we develop a Multiplatform Project for Desktop + Mobile this is (very happily) where we can define most of our Compose components, so not being able to define @Preview
here as well, sadly makes the Preview feature useless in this scenario. I played with different `expect`/`actual` definitions for the Preview
annotation, but couldn't make anything that improved the experience.spierce7
08/06/2021, 5:21 PMColton Idle
08/06/2021, 9:19 PMAlbert Chang
08/07/2021, 5:11 AMIn general, we think that having one annotation might be the end goal but, for now, two it's fine.
The reason for that is that currently, the Android annotation includes configuration values that are Android specific so it is not reusable. For the next version of the annotation, we decided that we probably want to split it in two to make the @Preview completely platform agnostic if possible.
Regarding the previewing of all Composables, this is something we've discussed at length internally. It is possible but, at least for Android, not desirable. Previews relied on state setup or Composition locals that are not available.