candlefinance / faster-image

Fast image loading for React Native backed by performant native libraries.
https://candle.fi/discord
MIT License
594 stars 28 forks source link

resizeMode and borderRadius inconsistencies on Android #9

Closed nickvgn closed 6 months ago

nickvgn commented 8 months ago

Hey. Thanks for promptly responding to the previous report. Found a couple more issues on android.

  1. resizeMode not reflected and defaults to "contain"

    Screenshot 2024-03-16 at 8 14 16 AM
  2. borderRadius value doesn't match the React Native values (this is only on android as well). I have added a border radius of 10 on both the image an the view wrapping it. Added a border line in red to emphasise.

    Screenshot 2024-03-16 at 8 17 12 AM
gtokman commented 8 months ago

@nickvgn thanks for filing this, I'll see if I can get it fixed later this week!

arnekolja commented 8 months ago

Setting overflow: 'hidden' in styles worked for me.

arnekolja commented 8 months ago

+1 for resize mode not working. Makes this one useless for me for now, sadly :-(

gtokman commented 8 months ago

@nickvgn resizeMode is fixed in the latest version!

jamesholcomb commented 8 months ago

In the repo example, you demonstrate circular images....if the Platform is android

style.image is borderRadius: (size - 16) / 2

and the RCTView prop is borderRadius: size * 2

is there a reason that conventional radius calculations of CSS can't be used consistently? it's cumbersome to remember to come up with and use different calculations, especially based on Platform.

nickvgn commented 8 months ago

thank you!

gtokman commented 8 months ago

In the repo example, you demonstrate circular images....if the Platform is android

style.image is borderRadius: (size - 16) / 2

and the RCTView prop is borderRadius: size * 2

is there a reason that conventional radius calculations of CSS can't be used consistently? it's cumbersome to remember to come up with and use different calculations, especially based on Platform.

It's because Android has some complexity when round corners. I'm keeping this issue open & will make it consistent next PR.

efstathiosntonas commented 7 months ago

i think the simple solution would be to apply overflow:hidden on the image styles or the container styles (or both)

gtokman commented 6 months ago

Fixed in latest pr! @jamesholcomb @nickvgn

jamesholcomb commented 6 months ago

A bit confused on how this fixes the issue I mentioned above (from March 30)?