-
Notifications
You must be signed in to change notification settings - Fork 605
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
[Coil] Image component does not apply request builder transformations if the content scale is not ContentScale.Fit #394
Comments
What transformations are you using? Or are you referring to using Can you paste in some example code? Are you setting an explicit size? |
Hey @chrisbanes I've created a repository just in case you need to check it out. The code is similar to this snippet: Column {
val imageUrl =
"https://play-lh.googleusercontent.com/S9lyB4MKAddMAHgSk7Kwjy1FG6yk6x7Nct5jciQxLy6LpRGDijCP7S34Z8W4wsF8RA"
Box(
Modifier
.height(40.dp)
.fillMaxWidth()) {
CoilImage(
modifier = Modifier
.background(Color.Green),
data = imageUrl,
contentDescription = "",
requestBuilder = {
transformations(
RoundedCornersTransformation(1000f)
)
},
contentScale = ContentScale.Crop
)
}
Box(
Modifier
.height(40.dp)
.fillMaxWidth()) {
Image(
modifier = Modifier
.background(Color.Red),
painter = rememberCoilPainter(
request = imageUrl,
requestBuilder = {
transformations(
RoundedCornersTransformation(1000f)
)
},
),
contentDescription = "",
contentScale = ContentScale.Crop
)
}
} Check out the difference between the deprecated component and the new one: Maybe the issue is related to the component height, looks like the second image tries to apply the transformation but something wrong happens. What I don't get is why the first one works with the deprecated component and the second one doesn't. 🤔 |
I think you're missing a |
@chrisbanes I tested it on the repository I shared with you and configuring |
@chrisbanes where can I find the latest snapshot published? Maybe your PR #391 fixed this issue. |
Just tried on top of tree: Box(
Modifier
.height(40.dp)
.fillMaxWidth()
) {
Image(
modifier = Modifier
.background(Color.Red)
.fillMaxSize(),
painter = rememberCoilPainter(
request = imageUrl,
requestBuilder = {
transformations(
RoundedCornersTransformation(1000f)
)
},
),
contentDescription = "",
contentScale = ContentScale.Crop
)
} |
I'm just about to release |
https://google.github.io/accompanist/using-snapshot-version/ |
Describe the bug
After updating from accompanist-coil 0.7.1 to 0.8.0 and later to 0.9.0 and migrate from Coil I've noticed the new
Image
component does not apply transformations if thecontentScale
parameter is notContentScale.Fit
.To Reproduce
Steps to reproduce the behavior:
CoilImage
to show any image and use, for exampleContentScale.Crop
configuration.CoilImage
to the newImage
component.Expected behavior
The image shown to the user should be the same and the configured transformations should be applied. However, you'll notice the new component doesn't apply the transformation unless the
contentScale
param isContentScale.Fit
.Environment:
The text was updated successfully, but these errors were encountered: