Skip to content

Commit

Permalink
Fix border-radius percentage formula typo (#44529)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #44529

The percentage formula was incorrect. We actually want to consider the shorter side as 100%. If we set a radius > minimum side there are no changes reflected. This is correct on iOS.

D56943825's summary also highlights the reasoning.

Changelog:
[Android][Fixed] Border-Radius percentages are now correctly resolved.

Reviewed By: NickGerleman

Differential Revision: D57214561

fbshipit-source-id: 45125b80289506a6dd51d24451e2b0222cd227c0
  • Loading branch information
jorge-cab authored and facebook-github-bot committed May 13, 2024
1 parent 651c1d2 commit 082e29e
Showing 1 changed file with 1 addition and 1 deletion.
Expand Up @@ -63,7 +63,7 @@ public class LengthPercentage(

public fun resolve(width: Float, height: Float): Float {
if (unit == LengthPercentageType.PERCENT) {
return (value / 100) * Math.max(width, height)
return (value / 100) * Math.min(width, height)
}

return value
Expand Down

0 comments on commit 082e29e

Please sign in to comment.