breaks my Compose preview. Is there a way to programmatically check I’m in Compose preview?
Note: I’m not using this directly in the composable, so didn’t get any kind of compile time error/warning (though you do get this when using directly)
a
ascii
11/14/2023, 6:16 AM
Is there a way to programmatically check I’m in Compose preview?
LocalInspectionMode.current
m
Mark
11/14/2023, 6:17 AM
Thanks, but I’m not in a composable context either. This code is executed as part of some class initialization
a
ascii
11/14/2023, 6:19 AM
Can you not use that class in Preview? Or change its init based on it?
No idea what the underlying issue is.
m
Mark
11/14/2023, 6:23 AM
If you just paste that code into a Preview you get “unknown character category” message and the category is highlighted in red, and the preview breaks. I don’t know if it’s just that the compose preview parser is using some pre 34 API level