From 082e29ed4ecc40ed9dfeae6b1b94d5a33efddef0 Mon Sep 17 00:00:00 2001 From: Jorge Cabiedes Acosta Date: Mon, 13 May 2024 11:10:40 -0700 Subject: [PATCH] Fix border-radius percentage formula typo (#44529) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/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 --- .../main/java/com/facebook/react/uimanager/LengthPercentage.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/LengthPercentage.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/LengthPercentage.kt index 2616b65c50f..5001656ad34 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/LengthPercentage.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/LengthPercentage.kt @@ -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