mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
fix: correct Android logical border radius mapping (#57271)
Summary: Fixes incorrect Android mapping for `borderEndStartRadius` and `borderStartEndRadius`. Fixes https://github.com/react/react-native/issues/57202 ## Changelog: [Android][Fixed] - Correct logical border radius mapping for `borderEndStartRadius` and `borderStartEndRadius`. Pull Request resolved: https://github.com/react/react-native/pull/57271 Test Plan: - Reviewed the logical corner mapping implementation in `BorderRadiusStyle.kt`. - Verified that `borderEndStartRadius` and `borderStartEndRadius` were mapped to opposite corners. - Swapped the mappings so Android behavior matches iOS and CSS logical corner expectations. Updated `BorderRadiusStyleTest.kt` priority expectations to match the corrected (CSS-spec-compliant) corner mapping and ran the ReactAndroid unit tests: buck2 test fbsource//xplat/js/react-native-github/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager:uimanager_BorderRadiusStyleTestAndroid Before updating the test expectations: Pass 2, Fail 3 (`testCorrectPriorityLTR`, `testCorrectPriorityRTL`, `testCorrectPriorityRTLNoSwap`). After: Pass 5, Fail 0. `arc f`/`arc lint`: no issues. Reviewed By: jorge-cab, christophpurrer Differential Revision: D109014253 Pulled By: fabriziocucci fbshipit-source-id: 247e99700a858d693a10871f13b562a392d7b07b
This commit is contained in:
1 parent
57ce6bc585
commit
ad2cf4d1d7
2 files changed
+12
-12
No files matched your search
+6
-6
@@ -161,11 +161,11 @@ internal data class BorderRadiusStyle(
|
||||
CornerRadii(it, width, height)
|
||||
} ?: zeroRadii,
|
||||
topRight =
|
||||
(endStart ?: topEnd ?: topRight ?: uniform)?.let {
|
||||
(startEnd ?: topEnd ?: topRight ?: uniform)?.let {
|
||||
CornerRadii(it, width, height)
|
||||
} ?: zeroRadii,
|
||||
bottomLeft =
|
||||
(startEnd ?: bottomStart ?: bottomLeft ?: uniform)?.let {
|
||||
(endStart ?: bottomStart ?: bottomLeft ?: uniform)?.let {
|
||||
CornerRadii(it, width, height)
|
||||
} ?: zeroRadii,
|
||||
bottomRight =
|
||||
@@ -179,7 +179,7 @@ internal data class BorderRadiusStyle(
|
||||
if (I18nUtil.instance.doLeftAndRightSwapInRTL(context)) {
|
||||
ensureNoOverlap(
|
||||
topLeft =
|
||||
(endStart ?: topEnd ?: topRight ?: uniform)?.let {
|
||||
(startEnd ?: topEnd ?: topRight ?: uniform)?.let {
|
||||
CornerRadii(it, width, height)
|
||||
} ?: zeroRadii,
|
||||
topRight =
|
||||
@@ -191,7 +191,7 @@ internal data class BorderRadiusStyle(
|
||||
CornerRadii(it, width, height)
|
||||
} ?: zeroRadii,
|
||||
bottomRight =
|
||||
(startEnd ?: bottomStart ?: bottomLeft ?: uniform)?.let {
|
||||
(endStart ?: bottomStart ?: bottomLeft ?: uniform)?.let {
|
||||
CornerRadii(it, width, height)
|
||||
} ?: zeroRadii,
|
||||
width = width,
|
||||
@@ -200,7 +200,7 @@ internal data class BorderRadiusStyle(
|
||||
} else {
|
||||
ensureNoOverlap(
|
||||
topLeft =
|
||||
(endStart ?: topEnd ?: topLeft ?: uniform)?.let {
|
||||
(startEnd ?: topEnd ?: topLeft ?: uniform)?.let {
|
||||
CornerRadii(it, width, height)
|
||||
} ?: zeroRadii,
|
||||
topRight =
|
||||
@@ -212,7 +212,7 @@ internal data class BorderRadiusStyle(
|
||||
CornerRadii(it, width, height)
|
||||
} ?: zeroRadii,
|
||||
bottomRight =
|
||||
(startEnd ?: bottomEnd ?: bottomRight ?: uniform)?.let {
|
||||
(endStart ?: bottomEnd ?: bottomRight ?: uniform)?.let {
|
||||
CornerRadii(it, width, height)
|
||||
} ?: zeroRadii,
|
||||
width = width,
|
||||
|
||||
+6
-6
@@ -42,14 +42,14 @@ class BorderRadiusStyleTest {
|
||||
BorderRadiusProp.BORDER_RADIUS,
|
||||
BorderRadiusProp.BORDER_TOP_RIGHT_RADIUS,
|
||||
BorderRadiusProp.BORDER_TOP_END_RADIUS,
|
||||
BorderRadiusProp.BORDER_END_START_RADIUS,
|
||||
BorderRadiusProp.BORDER_START_END_RADIUS,
|
||||
),
|
||||
ComputedBorderRadiusProp.COMPUTED_BORDER_BOTTOM_LEFT_RADIUS to
|
||||
arrayOf(
|
||||
BorderRadiusProp.BORDER_RADIUS,
|
||||
BorderRadiusProp.BORDER_BOTTOM_LEFT_RADIUS,
|
||||
BorderRadiusProp.BORDER_BOTTOM_START_RADIUS,
|
||||
BorderRadiusProp.BORDER_START_END_RADIUS,
|
||||
BorderRadiusProp.BORDER_END_START_RADIUS,
|
||||
),
|
||||
ComputedBorderRadiusProp.COMPUTED_BORDER_BOTTOM_RIGHT_RADIUS to
|
||||
arrayOf(
|
||||
@@ -88,7 +88,7 @@ class BorderRadiusStyleTest {
|
||||
BorderRadiusProp.BORDER_RADIUS,
|
||||
BorderRadiusProp.BORDER_TOP_RIGHT_RADIUS,
|
||||
BorderRadiusProp.BORDER_TOP_END_RADIUS,
|
||||
BorderRadiusProp.BORDER_END_START_RADIUS,
|
||||
BorderRadiusProp.BORDER_START_END_RADIUS,
|
||||
),
|
||||
ComputedBorderRadiusProp.COMPUTED_BORDER_TOP_RIGHT_RADIUS to
|
||||
arrayOf(
|
||||
@@ -109,7 +109,7 @@ class BorderRadiusStyleTest {
|
||||
BorderRadiusProp.BORDER_RADIUS,
|
||||
BorderRadiusProp.BORDER_BOTTOM_LEFT_RADIUS,
|
||||
BorderRadiusProp.BORDER_BOTTOM_START_RADIUS,
|
||||
BorderRadiusProp.BORDER_START_END_RADIUS,
|
||||
BorderRadiusProp.BORDER_END_START_RADIUS,
|
||||
),
|
||||
)
|
||||
|
||||
@@ -136,7 +136,7 @@ class BorderRadiusStyleTest {
|
||||
BorderRadiusProp.BORDER_RADIUS,
|
||||
BorderRadiusProp.BORDER_TOP_LEFT_RADIUS,
|
||||
BorderRadiusProp.BORDER_TOP_END_RADIUS,
|
||||
BorderRadiusProp.BORDER_END_START_RADIUS,
|
||||
BorderRadiusProp.BORDER_START_END_RADIUS,
|
||||
),
|
||||
ComputedBorderRadiusProp.COMPUTED_BORDER_TOP_RIGHT_RADIUS to
|
||||
arrayOf(
|
||||
@@ -157,7 +157,7 @@ class BorderRadiusStyleTest {
|
||||
BorderRadiusProp.BORDER_RADIUS,
|
||||
BorderRadiusProp.BORDER_BOTTOM_RIGHT_RADIUS,
|
||||
BorderRadiusProp.BORDER_BOTTOM_END_RADIUS,
|
||||
BorderRadiusProp.BORDER_START_END_RADIUS,
|
||||
BorderRadiusProp.BORDER_END_START_RADIUS,
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
Reference in new issue
Block a user