Repository navigation
Conversation
|
can you rebase the PR against main? |
There was a problem hiding this comment.
Pull request overview
This PR modernizes RadioButton for Material Design 3 by replacing the prior platform-specific implementations with a single unified component, introducing MD3 token-based sizing/color resolution, and aligning behavior (animation, error/disabled states, a11y, and group performance) with the library’s other MD3 selection controls.
Changes:
- Unifies
RadioButtoninto a single MD3 implementation (removingRadioButton.Android,RadioButton.IOS, and theRadioButton.Itemmodeprop) and migrates selection animation toreact-native-reanimated. - Adds MD3 radio tokens +
errorsupport, applies disabled opacity consistently, and updates selection-control color resolution to use tokenized theme roles. - Improves
RadioButton.Groupcontext stability and updates tests/examples/docs accordingly (including removing platform-specific docs pages).
Reviewed changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/index.tsx | Removes exported platform-specific RadioButton prop types. |
| src/components/RadioButton/utils.ts | Updates selection-control color resolution to use RadioButton tokens and removes iOS-specific helper. |
| src/components/RadioButton/tokens.ts | Introduces MD3 radio sizing + color-role tokens. |
| src/components/RadioButton/RadioButtonItem.tsx | Removes mode, adds error, switches to useContext, and adjusts a11y/testID behavior. |
| src/components/RadioButton/RadioButtonGroup.tsx | Memoizes context value and stabilizes onValueChange with use-latest-callback. |
| src/components/RadioButton/RadioButtonAndroid.tsx | Deletes old Android-specific implementation. |
| src/components/RadioButton/RadioButtonIOS.tsx | Deletes old iOS-specific implementation. |
| src/components/RadioButton/RadioButton.tsx | Implements unified MD3 RadioButton with Reanimated dot-scale animation, tokenized sizes/colors, and updated a11y behavior. |
| src/components/RadioButton/index.ts | Removes .Android/.IOS static exports from RadioButton. |
| src/components/tests/RadioButton/utils.test.tsx | Updates tests to cover getSelectionControlColor including error/checked/unchecked cases. |
| src/components/tests/RadioButton/RadioButtonItem.test.tsx | Removes platform-mode tests and adds a11y single-node assertion. |
| src/components/tests/RadioButton/RadioButtonGroup.test.tsx | Adds test asserting stable context object across unrelated parent rerenders. |
| src/components/tests/RadioButton/RadioButton.test.tsx | Simplifies snapshots to single unified RadioButton implementation. |
| src/components/tests/RadioButton/snapshots/RadioButtonItem.test.tsx.snap | Updates snapshots for new unified control + a11y changes. |
| src/components/tests/RadioButton/snapshots/RadioButtonGroup.test.tsx.snap | Updates snapshots for new unified control rendering. |
| src/components/tests/RadioButton/snapshots/RadioButton.test.tsx.snap | Updates snapshots for unified control rendering. |
| example/src/Examples/RadioButtonItemExample.tsx | Updates example to remove mode variants and demonstrate error/disabled states. |
| example/src/Examples/RadioButtonGroupExample.tsx | Updates example usage to RadioButton (no platform statics). |
| example/src/Examples/RadioButtonExample.tsx | Updates example states, adds error demos, and adjusts disabled label styling. |
| docs/versioned_docs/version-6.x/components/RadioButton/RadioButtonItem.mdx | Removes documentation for the deleted mode prop. |
| docs/versioned_docs/version-6.x/components/RadioButton/RadioButtonIOS.mdx | Removes iOS-specific docs page. |
| docs/versioned_docs/version-6.x/components/RadioButton/RadioButtonAndroid.mdx | Removes Android-specific docs page. |
| docs/docusaurus.config.js | Removes nav entries for the deleted platform-specific docs pages. |
cb74fc8 to
c0e1c18
Compare
MikitasK
left a comment
There was a problem hiding this comment.
- updated radio-button state layer to MD3 specified 40dp size while keeping visible ring centered at 20dp
- added reusable
stateLayerSizetoken & removed previous margin-based state-layer sizing - made nested visual control inside
RadioButton.Itemnon-focusable withfocusable={false}andtabIndex={-1}keeping outer item as the only interactive radio - added regression coverage for
40dpstate layer & updated affected accessibility & component snapshots
|
@MikitasK is this ready for another review? |
JKobrynski
left a comment
There was a problem hiding this comment.
Add a ### RadioButton entry to docs/6.x/docs/guides/migration.md. The iOS variant drew a checkmark, so anyone on it gets a visibly different control. #5059 has a ### Checkbox section covering the identical removals that would work as the template, but it skips RadioButton and still lists RadioButton.Android / RadioButton.IOS as live. Worth syncing with @mikolajadamowicz on which PR carries it.
done ✅ added |
JKobrynski
left a comment
There was a problem hiding this comment.
We've got a bunch of conflicts
updated |
|
Review by Claude The press and hover state layer covers the whole 48dp touch target. The MD3 radio state layer is 40dp, and the new 40dp iOSSteps: open Radio Button, press and hold the "Error (Checked)" radio. (via Claude, verify if it makes sense) AndroidSteps: open Radio Button, press and hold the "Error (Checked)" radio. (via Claude, verify if it makes sense) WebSteps: open (via Claude, verify if it makes sense) |
satya164
left a comment
There was a problem hiding this comment.
Review by Claude
See the inline comments. (via Claude, verify if it makes sense)
nice finding 👍 |
|
/review |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Apex Sentinel: 3 new findings on e51f07f. The verdict and the full list are in the summary comment.
e51f07f to
533580d
Compare
|
/review |
Apex Sentinel · ✅ Approve · review of
|
| Where | Finding |
|---|---|
src/components/RadioButton/RadioButtonItem.tsx:203 |
🆕 RadioButton.Item row never activates on Space on web, unlike Checkbox.Item |
Not in the reviewers' prompt (3 files)
src/components/__tests__/RadioButton/__snapshots__/RadioButton.test.tsx.snap: generated or a lockfile, so its lines were left outsrc/components/__tests__/RadioButton/__snapshots__/RadioButtonGroup.test.tsx.snap: generated or a lockfile, so its lines were left outsrc/components/__tests__/RadioButton/__snapshots__/RadioButtonItem.test.tsx.snap: generated or a lockfile, so its lines were left out
2 findings below minor hidden (user_settings.min_severity).
Reviewed with this repository's own Sentinel configuration (9029fbcd5df0).
💬 Talking to Sentinel
In a finding's thread, reply with:
| Command | What it does |
|---|---|
@apex-sentinel-staging note <context> |
Adds context; Sentinel re-checks the cited code |
@apex-sentinel-staging pivot <why> |
Says the finding is wrong; Sentinel re-checks the cited code |
@apex-sentinel-staging like |
Marks the finding as useful |
@apex-sentinel-staging dislike <why> |
Marks it as not useful, so it is not raised again |
On this conversation, comment @apex-sentinel-staging review to run a full review once again.
There was a problem hiding this comment.
Apex Sentinel: 1 new finding on 533580d. The verdict and the full list are in the summary comment.
React Native Web presses on Space only for role="button". Other review fixes.
533580d to
3e94023
Compare
kachmashk
left a comment
There was a problem hiding this comment.
Most of the Radio examples are not reachable via TalkBack. Shouldn't it also be included in the PR? Radio groups and each radio item in the Example are not voiced, please check the accessibility. Only the first two rows in the RadioButtonExample are voiced.
| : [styles.container, restStyle]; | ||
|
|
||
| return ( | ||
| <TouchableRipple |
There was a problem hiding this comment.
damn, good catch! The ring now comes from useFocusRing with inward and descendant- same as Switch. It's drawn on the 40dp instead of the 48dp target. I added tests for the missing cases.
There was a problem hiding this comment.













Motivation
RadioButtonstill shipped as two platform-specific implementations (RadioButtonAndroid,RadioButtonIOS) with the iOS variant rendering a checkmark glyph rather than a Material radio. This is inconsistent with the rest of the v6 MD3 work (Checkbox, Switch, TextInput, FAB) and diverges from the M3 radio button spec.This PR unifies RadioButton into a single MD3 component that mirrors the modernized Checkbox structure (single component,
tokens.ts,errorprop,accessible={false}inner control), without pulling in Checkbox's reanimated/focus-ring machinery (out of scope — radio ships with none today).Related issue
Closes #4938
What changed
RadioButtonAndroid+RadioButtonIOSinto a single MD3RadioButton(Android impl as base). DroppedRadioButton.Android,RadioButton.IOS,RadioButtonIOS, and theRadioButton.Itemmodeprop.RadioButton/tokens.ts(MD3 dims20/10/2+ color roles); colors resolved via tokens inutils.errorprop — added toRadioButtonandRadioButton.Item(ring + dot usetheme.colors.error;disabled/custom colors take precedence).Animated.Values into one shared value and migrated toreact-native-reanimated(matching Checkbox): dot scales in with overshoot on selection, keyed oncheckedso it also animates inside aRadioButton.Group. Usestheme.motionMD3 duration/easing tokens and respects reduce-motion.selectionControlOpacitywas previously computed but never applied).onValueChangewithuse-latest-callback; consumers switched fromContext.ConsumertouseContext.accessible={false}+ containerimportantForAccessibility="no-hide-descendants", so a screen reader sees one radio per row; dropped per-radioaccessibilityLiveRegion;labelMaxFontSizeMultiplier=1.5+${testID}-textfor CheckboxItem parity.RadioButtonAndroid/RadioButtonIOSdoc pages.Breaking changes
RadioButton.Android,RadioButton.IOS,RadioButtonIOS(andRadioButtonAndroidProps/RadioButtonIOSPropsexports).RadioButton.Itemmodeprop.errorprop added (no visual change for existing usage).Test plan
yarn typescript,yarn lint,yarn test(snapshots updated) — green.yarn --cwd docs build— green.Videos
radio_ios.mp4
radio_android.mp4
radio_web.mp4