Skip to content

Commit ad2cf4d

Browse files
nikhilpakhloometa-codesync[bot]
authored andcommitted
fix: correct Android logical border radius mapping (#57271)
Summary: Fixes incorrect Android mapping for `borderEndStartRadius` and `borderStartEndRadius`. Fixes #57202 ## Changelog: [Android][Fixed] - Correct logical border radius mapping for `borderEndStartRadius` and `borderStartEndRadius`. Pull Request resolved: #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
1 parent 57ce6bc commit ad2cf4d

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/BorderRadiusStyle.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,11 @@ internal data class BorderRadiusStyle(
161161
CornerRadii(it, width, height)
162162
} ?: zeroRadii,
163163
topRight =
164-
(endStart ?: topEnd ?: topRight ?: uniform)?.let {
164+
(startEnd ?: topEnd ?: topRight ?: uniform)?.let {
165165
CornerRadii(it, width, height)
166166
} ?: zeroRadii,
167167
bottomLeft =
168-
(startEnd ?: bottomStart ?: bottomLeft ?: uniform)?.let {
168+
(endStart ?: bottomStart ?: bottomLeft ?: uniform)?.let {
169169
CornerRadii(it, width, height)
170170
} ?: zeroRadii,
171171
bottomRight =
@@ -179,7 +179,7 @@ internal data class BorderRadiusStyle(
179179
if (I18nUtil.instance.doLeftAndRightSwapInRTL(context)) {
180180
ensureNoOverlap(
181181
topLeft =
182-
(endStart ?: topEnd ?: topRight ?: uniform)?.let {
182+
(startEnd ?: topEnd ?: topRight ?: uniform)?.let {
183183
CornerRadii(it, width, height)
184184
} ?: zeroRadii,
185185
topRight =
@@ -191,7 +191,7 @@ internal data class BorderRadiusStyle(
191191
CornerRadii(it, width, height)
192192
} ?: zeroRadii,
193193
bottomRight =
194-
(startEnd ?: bottomStart ?: bottomLeft ?: uniform)?.let {
194+
(endStart ?: bottomStart ?: bottomLeft ?: uniform)?.let {
195195
CornerRadii(it, width, height)
196196
} ?: zeroRadii,
197197
width = width,
@@ -200,7 +200,7 @@ internal data class BorderRadiusStyle(
200200
} else {
201201
ensureNoOverlap(
202202
topLeft =
203-
(endStart ?: topEnd ?: topLeft ?: uniform)?.let {
203+
(startEnd ?: topEnd ?: topLeft ?: uniform)?.let {
204204
CornerRadii(it, width, height)
205205
} ?: zeroRadii,
206206
topRight =
@@ -212,7 +212,7 @@ internal data class BorderRadiusStyle(
212212
CornerRadii(it, width, height)
213213
} ?: zeroRadii,
214214
bottomRight =
215-
(startEnd ?: bottomEnd ?: bottomRight ?: uniform)?.let {
215+
(endStart ?: bottomEnd ?: bottomRight ?: uniform)?.let {
216216
CornerRadii(it, width, height)
217217
} ?: zeroRadii,
218218
width = width,

packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/BorderRadiusStyleTest.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ class BorderRadiusStyleTest {
4242
BorderRadiusProp.BORDER_RADIUS,
4343
BorderRadiusProp.BORDER_TOP_RIGHT_RADIUS,
4444
BorderRadiusProp.BORDER_TOP_END_RADIUS,
45-
BorderRadiusProp.BORDER_END_START_RADIUS,
45+
BorderRadiusProp.BORDER_START_END_RADIUS,
4646
),
4747
ComputedBorderRadiusProp.COMPUTED_BORDER_BOTTOM_LEFT_RADIUS to
4848
arrayOf(
4949
BorderRadiusProp.BORDER_RADIUS,
5050
BorderRadiusProp.BORDER_BOTTOM_LEFT_RADIUS,
5151
BorderRadiusProp.BORDER_BOTTOM_START_RADIUS,
52-
BorderRadiusProp.BORDER_START_END_RADIUS,
52+
BorderRadiusProp.BORDER_END_START_RADIUS,
5353
),
5454
ComputedBorderRadiusProp.COMPUTED_BORDER_BOTTOM_RIGHT_RADIUS to
5555
arrayOf(
@@ -88,7 +88,7 @@ class BorderRadiusStyleTest {
8888
BorderRadiusProp.BORDER_RADIUS,
8989
BorderRadiusProp.BORDER_TOP_RIGHT_RADIUS,
9090
BorderRadiusProp.BORDER_TOP_END_RADIUS,
91-
BorderRadiusProp.BORDER_END_START_RADIUS,
91+
BorderRadiusProp.BORDER_START_END_RADIUS,
9292
),
9393
ComputedBorderRadiusProp.COMPUTED_BORDER_TOP_RIGHT_RADIUS to
9494
arrayOf(
@@ -109,7 +109,7 @@ class BorderRadiusStyleTest {
109109
BorderRadiusProp.BORDER_RADIUS,
110110
BorderRadiusProp.BORDER_BOTTOM_LEFT_RADIUS,
111111
BorderRadiusProp.BORDER_BOTTOM_START_RADIUS,
112-
BorderRadiusProp.BORDER_START_END_RADIUS,
112+
BorderRadiusProp.BORDER_END_START_RADIUS,
113113
),
114114
)
115115

@@ -136,7 +136,7 @@ class BorderRadiusStyleTest {
136136
BorderRadiusProp.BORDER_RADIUS,
137137
BorderRadiusProp.BORDER_TOP_LEFT_RADIUS,
138138
BorderRadiusProp.BORDER_TOP_END_RADIUS,
139-
BorderRadiusProp.BORDER_END_START_RADIUS,
139+
BorderRadiusProp.BORDER_START_END_RADIUS,
140140
),
141141
ComputedBorderRadiusProp.COMPUTED_BORDER_TOP_RIGHT_RADIUS to
142142
arrayOf(
@@ -157,7 +157,7 @@ class BorderRadiusStyleTest {
157157
BorderRadiusProp.BORDER_RADIUS,
158158
BorderRadiusProp.BORDER_BOTTOM_RIGHT_RADIUS,
159159
BorderRadiusProp.BORDER_BOTTOM_END_RADIUS,
160-
BorderRadiusProp.BORDER_START_END_RADIUS,
160+
BorderRadiusProp.BORDER_END_START_RADIUS,
161161
),
162162
)
163163

0 commit comments

Comments
 (0)