Skip to content

Fix Android bottom logical border radii in RTL without swapping - #58979

Closed
ddx533534 wants to merge 1 commit into
react:mainfrom
ddx533534:fix/android-rtl-bottom-border-radius
Closed

ddx533534 wants to merge 1 commit into
react:mainfrom
ddx533534:fix/android-rtl-bottom-border-radius

Conversation

@ddx533534

Copy link
Copy Markdown
Contributor

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.

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:

    & '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:

    ./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.

@meta-cla

meta-cla Bot commented Oct 10, 2026

Copy link
Copy Markdown

Hi @ddx533534!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@meta-cla

meta-cla Bot commented Oct 10, 2026

Copy link
Copy Markdown

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 10, 2026
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Oct 10, 2026
@ddx533534

Copy link
Copy Markdown
Contributor Author

Hi @cortinico , could you take a look at this Android RTL border-radius fix? I noticed you reviewed the related bottom-end RTL fix in #51229. This PR addresses the bottom logical corner mapping when physical left/right swapping is disabled and adds a regression test for both swap settings. The Test All workflow is still awaiting maintainer approval.

@meta-codesync

meta-codesync Bot commented Oct 20, 2026

Copy link
Copy Markdown

@cortinico has imported this pull request. If you are a Meta employee, you can view this in D126298086.

@meta-codesync meta-codesync Bot closed this in 202d939 Oct 20, 2026
@react-native-bot

Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @ddx533534 in 202d939

When will my fix make it into a release? | How to file a pick request?

@react-native-bot react-native-bot added the Merged This PR has been merged. label Oct 20, 2026
@meta-codesync

meta-codesync Bot commented Oct 20, 2026

Copy link
Copy Markdown

@cortinico merged this pull request in 202d939.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants