You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
It seems that the defaults set on an ImageLoader aren't applied or used when in a Compose Preview
Explicitly setting the defaults on the specific ImageRequest.Builder however, does work as expected
To Reproduce
Not working:
@OptIn(ExperimentalCoilApi::class)
@Preview
@Composable
private fun CoilDefaultsPreviewTest() {
val context = LocalContext.current
val drawable = ColorDrawable(android.graphics.Color.CYAN)
val previewImageLoader = remember {
ImageLoader.Builder(context)
.placeholder(drawable)
.error(drawable)
.fallback(drawable)
.build()
}
CompositionLocalProvider(LocalImageLoader provides previewImageLoader) {
Box {
Image(
painter = rememberImagePainter(
data = "data",
),
contentDescription = null,
modifier = Modifier.size(200.dp)
)
}
}
}
Describe the bug
It seems that the defaults set on an
ImageLoader
aren't applied or used when in a Compose PreviewExplicitly setting the defaults on the specific
ImageRequest.Builder
however, does work as expectedTo Reproduce
Not working:
Working:
Logs/Screenshots

Not Working Preview:
Working Preview:

Version
Coil 1.4.0
The text was updated successfully, but these errors were encountered: