Skip to content

Cover percentage border radii on Android ScrollViews - #58745

Closed
Abbondanzo wants to merge 2 commits into
react:mainfrom
Abbondanzo:export-D122278945
Closed

Abbondanzo wants to merge 2 commits into
react:mainfrom
Abbondanzo:export-D122278945

Conversation

@Abbondanzo

Copy link
Copy Markdown
Contributor

Summary:
Add property-updater regression coverage for vertical and horizontal Android ScrollViews. Exercise every supported radius index, point values, percentages, negative values, null resets, and the deprecated Float overload.

Changelog: [Internal]

Differential Revision: D122278945

sbaiahmed1 and others added 2 commits September 28, 2026 19:33
…extInput, and ScrollView (react#57869)

Summary:
Follow-up to react#57795, which fixed the percentage-`borderRadius` crash for `<Image>` (react#53977). The same latent bug existed in every remaining Android view manager whose `borderRadius` `ReactPropGroup` setter was still typed as `Float`:

- `ReactTextViewManager` (`<Text>`)
- `PreparedLayoutTextViewManager` (internal, prepared-layout `<Text>`)
- `ReactTextInputManager` (`<TextInput>`)
- `ReactScrollViewManager` (`<ScrollView>`)
- `ReactHorizontalScrollViewManager` (`<ScrollView horizontal>`)
- `ReactNestedScrollViewManager` (internal, nested-scroll variant)

Percentage border radii arrive from JS as strings (`'50%'`), so the reflection-based property updater throws:

```
com.facebook.react.bridge.JSApplicationIllegalArgumentException:
  Error while updating property 'borderRadius' of a view managed by: RCTText
Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Double
```

Each setter now accepts a `Dynamic` parsed with `LengthPercentage.setFromDynamic`, completing the migration `ReactViewManager` received in 0.75 and `ReactImageManager` in react#57795. The `Float` overloads on the four public managers are kept as deprecated pass-throughs for source/binary compatibility (public API dump updated); the two internal managers are migrated outright. Rendering needs no changes since all six managers already delegate to `BackgroundStyleApplicator`, which resolves percentages.

## Changelog:

[ANDROID] [FIXED] - Fix crash when setting a percentage borderRadius on Text, TextInput, and ScrollView

Pull Request resolved: react#57869

Test Plan:
**Unit tests** — new Robolectric regression tests mirroring the one merged in react#57795:

- `ReactTextViewPropertyTest.testBorderRadius` (new file)
- `ReactTextInputPropertyTest.testBorderRadius`

Both verified red before the fix (failing with `JSApplicationIllegalArgumentException: Error while updating property 'borderRadius' of a view managed by: RCTText`) and green after (`:packages:react-native:ReactAndroid:testDebugUnitTest`, 25/25 passing).

**Manual QA** — rn-tester on an Android emulator (API 35), rendering the snippet below with `borderRadius: '50%'` on `<Text>` and `'20%'` on `<TextInput>`, `<ScrollView>`, and `<ScrollView horizontal>`:

```jsx
<Text style={{borderWidth: 2, borderColor: 'green', borderRadius: '50%', padding: 20}}>Text 50%</Text>
<TextInput style={{borderWidth: 2, borderColor: 'blue', borderRadius: '20%', padding: 12}} defaultValue="TextInput 20%" />
<ScrollView style={{borderWidth: 2, borderColor: 'purple', borderRadius: '20%', height: 80}}>...</ScrollView>
<ScrollView horizontal style={{borderWidth: 2, borderColor: 'purple', borderRadius: '20%', height: 80}}>...</ScrollView>
```

On main this screen crashes with the exception above; with this change all four render rounded corners.

### Screenshots

| Before (main) — surface fails to mount, exception above in logcat | After (this PR) — all four components render their percentage radii |
| --- | --- |
| <img src="https://github.com/sbaiahmed1/react-native/releases/download/pr-57869-assets/before-blank-surface-v2.png" width="320" /> | <img src="https://github.com/sbaiahmed1/react-native/releases/download/pr-57869-assets/after-percentage-radii.png" width="320" /> |

Differential Revision: D122262619

Pulled By: Abbondanzo
Summary:
Add property-updater regression coverage for vertical and horizontal Android ScrollViews. Exercise every supported radius index, point values, percentages, negative values, null resets, and the deprecated Float overload.

Changelog: [Internal]

Differential Revision: D122278945
@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 Sep 29, 2026
@meta-codesync

meta-codesync Bot commented Sep 29, 2026

Copy link
Copy Markdown

@Abbondanzo has exported this pull request. If you are a Meta employee, you can view the originating Diff in D122278945.

@meta-codesync meta-codesync Bot closed this in 3bc61ec Sep 30, 2026
@meta-codesync meta-codesync Bot added the Merged This PR has been merged. label Sep 30, 2026
@meta-codesync

meta-codesync Bot commented Sep 30, 2026

Copy link
Copy Markdown

This pull request has been merged in 3bc61ec.

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. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants