Repository navigation
Commit 202d939
Fix Android bottom logical border radii in RTL without swapping (#58979)
Summary:
On Android, `BorderRadiusStyle.resolve` maps `borderBottomStartRadius` to the bottom-left corner and `borderBottomEndRadius` to the bottom-right corner when the layout direction is RTL and `I18nManager.swapLeftAndRightInRTL(false)` is set. In RTL, these logical properties should resolve to the bottom-right and bottom-left corners respectively, regardless of whether physical left/right styles are swapped.
For example, a 100 x 100 view with `borderBottomStartRadius: 10` and `borderBottomEndRadius: 20` currently resolves to bottom-left = 10 and bottom-right = 20 in that configuration. This change resolves them to bottom-left = 20 and bottom-right = 10.
Fix the two logical fallbacks in the RTL no-swap branch. Correct the corresponding expectations in `testCorrectPriorityRTLNoSwap`, which currently encode the same incorrect mapping, and add a regression test using distinct bottom-start and bottom-end radii with physical swapping both enabled and disabled. The existing priority tests also cover physical fallbacks, fully logical overrides, and zero-valued overrides.
## Changelog:
[ANDROID] [FIXED] - Fix bottom-start and bottom-end border radii resolving to the wrong corners in RTL when left/right style swapping is disabled.
Pull Request resolved: #58979
Test Plan:
- `git diff --check`: passed before committing.
- Kotlin formatting check using the repository-pinned ktfmt 0.59.0: passed for both changed files. Exact PowerShell command:
```powershell
& 'C:/Program Files/JetBrains/RustRover 2026.2.2/jbr/bin/java.exe' -jar E:/react-native/.tools/format/node_modules/ktfmt/lib/ktfmt.jar --do-not-remove-unused-imports --dry-run --set-exit-if-changed packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/BorderRadiusStyle.kt packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/BorderRadiusStyleTest.kt
```
- Attempted the targeted Android unit tests:
```powershell
./gradlew.bat :packages:react-native:ReactAndroid:testDebugUnitTest --tests com.facebook.react.uimanager.BorderRadiusStyleTest --no-daemon
```
The tests did not execute: the wrapper could not download Gradle 9.4.1 in the restricted environment (`Permission denied: getsockopt`). A retry outside the sandbox made no download progress and was stopped. The Android SDK/NDK is not configured on this machine. The unit tests still need to run in CI or an Android development environment.
- RNTester/device validation and screenshots were not available in this environment. To validate visually, enable RTL, disable physical left/right swapping, restart the app, and render the 100 x 100 view described above. Expect the bottom-right radius to be 10 and the bottom-left radius to be 20; enabling swapping should preserve these logical corner assignments.
Reviewed By: javache
Differential Revision: D126298086
Pulled By: cortinico
fbshipit-source-id: 7a621c9338100bf53d4d32262557d5b65ccead1a1 parent a613baf commit 202d939
2 files changed
Lines changed: 21 additions & 4 deletions
File tree
- packages/react-native/ReactAndroid/src
- main/java/com/facebook/react/uimanager/style
- test/java/com/facebook/react/uimanager
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
208 | 208 | | |
209 | 209 | | |
210 | 210 | | |
211 | | - | |
| 211 | + | |
212 | 212 | | |
213 | 213 | | |
214 | 214 | | |
215 | | - | |
| 215 | + | |
216 | 216 | | |
217 | 217 | | |
218 | 218 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
152 | | - | |
| 152 | + | |
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
159 | | - | |
| 159 | + | |
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
| |||
174 | 174 | | |
175 | 175 | | |
176 | 176 | | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
177 | 194 | | |
178 | 195 | | |
179 | 196 | | |
| |||
0 commit comments