-
-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Preview Fails to Render #71
Comments
Thanks for the report! This is tricky as the I don't think there's much we can do about issue 3. There is a coupled relationship between |
For now, I'm going to fix the crash by no-op'ing the main |
Thanks for the quick fix. Now at least the preview does not crash anymore 👍
It would be nice if we could configure the tint color on |
The Preview in Android Studio for Jetpack Compose fails to render when using the
.haze(...)
Modifier:This could be solved by wrapping the haze modifier in a
if (!LocalInspectionMode.current) { ... }
but it's not the most elegant solution to repeat this over and over again on caller side.Version: 0.4.1
Artifact: dev.chrisbanes.haze:haze-jetpack-compose
--
In general the Preview support could be improved.
We are facing the following issues challenges:
Preview does not work at all
(see exception above)
Background for Preview of hazeChild
When applying the
haze
Modifier only if!LocalInspectionMode.current
, then thehazeChild
has a transparent background in the preview, since the background/tint color is configured onhaze
Modifier side. Adding a background for Preview purposes, could be solved by usingif (!LocalInspectionMode.current) { hazeChild(...) } else { background(backgroundColor) }
. Which is not optimal since we need to duplicate the background color.Preview across components/files
Sometimes we do have the
haze
Modifier in one file (e.g. the screen with a lazy column) and thehazeChild
in another (e.g. the bottom navigation which is embedded in multiple screens). With this setup it is also difficult to provide a proper preview with a background for thehazeChild
component. Currently we are passing theHazeState
as a parameter to this component, provide a dummy state in the Preview and switch to a solid background if we are in inspection mode.The text was updated successfully, but these errors were encountered: