For #26587 - Fix broken previews using Fenix Image composable

This commit is contained in:
Noah Bond 2022-08-22 10:49:10 -07:00 committed by mergify[bot]
parent 7a3a52e475
commit 45f998ee95
1 changed files with 22 additions and 18 deletions

View File

@ -46,25 +46,29 @@ fun Image(
alignment: Alignment = Alignment.Center,
contentScale: ContentScale = ContentScale.Fit,
) {
ImageLoader(
url = url,
client = components.core.client,
private = private,
targetSize = targetSize
) {
WithImage { painter ->
androidx.compose.foundation.Image(
painter = painter,
modifier = modifier,
contentDescription = contentDescription,
alignment = alignment,
contentScale = contentScale
)
if (inComposePreview) {
DefaultImagePlaceholder(modifier = modifier)
} else {
ImageLoader(
url = url,
client = components.core.client,
private = private,
targetSize = targetSize
) {
WithImage { painter ->
androidx.compose.foundation.Image(
painter = painter,
modifier = modifier,
contentDescription = contentDescription,
alignment = alignment,
contentScale = contentScale
)
}
WithDefaultPlaceholder(modifier, contentDescription)
WithDefaultFallback(modifier, contentDescription)
}
WithDefaultPlaceholder(modifier, contentDescription)
WithDefaultFallback(modifier, contentDescription)
}
}