darkmoon_uk
01/28/2021, 4:18 AM@Compose
-ing views that are dependent on bundled resources at runtime; so these fail during preview.
Is there a way I can check whether I'm running in @Preview
mode in the composition, so that I can just put colored block instead of the asset?darkmoon_uk
01/28/2021, 5:06 AMAmbient
flag for this.jim
01/28/2021, 8:24 AMjim
01/28/2021, 8:25 AMdarkmoon_uk
01/28/2021, 12:15 PMdarkmoon_uk
01/28/2021, 12:16 PMMark Murphy
01/28/2021, 1:54 PM@Preview
would use the default value.
IOW, the rule of what to show is a function of the inputs, not a function of some "are we in preview" quasi-state.jim
01/28/2021, 5:39 PMReason for asking is that the IDE doesn't appear to be able to use raw Android file resources during Compose previews.I'm actually ok with Chris' answer: "resource issues". The current resource API leaves a lot to be desired, especially in terms of MPP (eg. Compose for Desktop), and I think it's reasonable for widgets to be able to have resources associated with the widget, and to the extent that is not supported, it should be treated as a bug and Chris is working around that bug. This won't make the 1.0 cut, but after 1.0, I think our team will need to do some serious thinking about how resources should be managed in Compose applications. Thanks for the feedback!