Skip to content

refactor(checkbox): unify platform-specific files (use Android impl)#4961

Merged
adrcotfas merged 1 commit into
callstack:mainfrom
fabriziocucci:feat/checkbox-unify-platforms
May 21, 2026
Merged

refactor(checkbox): unify platform-specific files (use Android impl)#4961
adrcotfas merged 1 commit into
callstack:mainfrom
fabriziocucci:feat/checkbox-unify-platforms

Conversation

@fabriziocucci
Copy link
Copy Markdown
Contributor

@fabriziocucci fabriziocucci commented May 21, 2026

Summary

Per adrcotfas's feedback on #4955 and the team decision to push breaking changes in v6, this PR fully unifies the Checkbox platform variants. The same MD3 control renders everywhere. All back-compat scaffolding (platform-specific files, props and type aliases) is removed.

Changes

  • Checkbox.tsx: now the only implementation. Renders the MD3 control using checkbox-marked / checkbox-blank-outline / minus-box MaterialCommunityIcon glyphs.
  • CheckboxAndroid.tsx and CheckboxIOS.tsx: deleted.
  • Checkbox/index.ts: drops the Android and IOS aliases. Only Checkbox and Checkbox.Item are exported.
  • CheckboxItem.tsx: drops the mode?: 'android' | 'ios' prop. The component always renders the unified Checkbox.
  • utils.ts: renames getAndroidSelectionControlColor to getSelectionControlColor (and the internal Android-prefixed helpers). The iOS helpers (getSelectionControlIOSColor, getIOSCheckedColor) are intentionally retained because RadioButtonIOS still depends on them; they can be removed once RadioButton is unified the same way.
  • src/index.tsx: drops the CheckboxAndroidProps and CheckboxIOSProps type exports. Use CheckboxProps.
  • docs/docusaurus.config.js: removes the entries for the deleted CheckboxAndroid and CheckboxIOS files.
  • RadioButton/RadioButtonAndroid.tsx: updates the import to match the renamed getSelectionControlColor.
  • example/src/Examples/CheckboxItemExample.tsx: drops the mode="android" / mode="ios" examples and the corresponding state. The Material Design / iOS sample items are now redundant.

Breaking changes (v6)

  • Checkbox.Android, Checkbox.IOS removed.
  • CheckboxItem.mode prop removed.
  • CheckboxAndroidProps, CheckboxIOSProps type exports removed.

Test plan

  • yarn typescript clean
  • yarn lint clean
  • yarn jest: 736/737 (1 skipped, pre-existing); 159/159 snapshots pass. Two CheckboxItem.test.tsx cases that exercised the removed mode dispatch are deleted; the leading-control snapshot is updated.

Visuals

Captured on iOS Simulator (iPhone 17 Pro) and Android Emulator, light + dark theme.

iOS Simulator

Before (old CheckboxIOS) After (unified)
Light ios-before-light ios-after-light
Dark ios-before-dark ios-after-dark

Android Emulator

Before After
Light android-before-light android-after-light
Dark android-before-dark android-after-dark

Android rendering is identical before/after; included to document there is no Android regression.

Copilot AI review requested due to automatic review settings May 21, 2026 08:52
@fabriziocucci fabriziocucci marked this pull request as draft May 21, 2026 08:53
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR unifies Checkbox rendering across platforms by routing <Checkbox /> and the iOS-specific entry points (CheckboxIOS, Checkbox.IOS, and Checkbox.Item mode="ios") through the Android implementation to match the MD3 outlined-control look consistently on iOS and Android.

Changes:

  • Updated Checkbox to always render CheckboxAndroid (removed Platform.OS === 'ios' branching).
  • Replaced the iOS-specific CheckboxIOS implementation with an alias/re-export of CheckboxAndroid to preserve existing imports/types.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/components/Checkbox/CheckboxIOS.tsx Replaced iOS implementation with a re-export/alias to Android checkbox implementation.
src/components/Checkbox/Checkbox.tsx Removed platform conditional logic; always renders CheckboxAndroid.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/components/Checkbox/CheckboxIOS.tsx Outdated
Comment thread src/components/Checkbox/CheckboxIOS.tsx Outdated
@fabriziocucci fabriziocucci force-pushed the feat/checkbox-unify-platforms branch 6 times, most recently from f2bcafa to ab117e4 Compare May 21, 2026 10:35
@callstack-bot
Copy link
Copy Markdown

callstack-bot commented May 21, 2026

Hey @fabriziocucci, thank you for your pull request 🤗. The documentation from this branch can be viewed here.

@fabriziocucci fabriziocucci marked this pull request as ready for review May 21, 2026 10:59
Comment thread src/components/Checkbox/CheckboxItem.tsx Outdated
@fabriziocucci fabriziocucci force-pushed the feat/checkbox-unify-platforms branch 2 times, most recently from c82720b to ee67d03 Compare May 21, 2026 11:42
@fabriziocucci fabriziocucci requested a review from adrcotfas May 21, 2026 11:52
Comment thread src/components/Checkbox/Checkbox.tsx
Comment thread src/components/Checkbox/Checkbox.tsx Outdated
@fabriziocucci fabriziocucci force-pushed the feat/checkbox-unify-platforms branch from ee67d03 to f94f88f Compare May 21, 2026 14:07
Comment thread src/components/Checkbox/utils.ts Outdated
@fabriziocucci fabriziocucci force-pushed the feat/checkbox-unify-platforms branch from f94f88f to d4eac3d Compare May 21, 2026 14:12
Per maintainer feedback on callstack#4955, drop the iOS-specific Checkbox renderer
and inline the unified MD3 implementation directly into Checkbox.tsx.
The same MaterialCommunityIcon-based control now renders on both
platforms.

Changes:
- Checkbox.tsx: inlines what was the Android implementation; renders the
  same control on both platforms. Drops the Platform.OS dispatching.
- CheckboxAndroid.tsx, CheckboxIOS.tsx: deleted.
- Checkbox/index.ts: `Checkbox.Android` and `Checkbox.IOS` are kept as
  back-compat aliases of `Checkbox` itself, so existing imports keep
  working with no breaking change.
- CheckboxItem.tsx: drops the `mode`-based branching; always renders
  `<Checkbox />`. The `mode` prop is kept and marked deprecated.
- src/index.tsx: `CheckboxAndroidProps` and `CheckboxIOSProps` now
  alias the unified `Props` from Checkbox.tsx (no breaking change).
- docs/docusaurus.config.js: removed entries for the now-deleted
  CheckboxAndroid and CheckboxIOS files.
- Snapshot tests updated: the renderer now uses the unified container
  (36x36 ripple) and MaterialCommunityIcon glyphs on both platforms.

`getSelectionControlIOSColor` in utils.ts is intentionally left in
place because RadioButtonIOS still depends on it. A similar unification
for RadioButton can follow in a separate PR.

As a side benefit, callers using `<Checkbox.IOS uncheckedColor=...>`
will now see the prop applied (the old iOS variant silently dropped it),
addressing one of the API-parity gaps noted in callstack#4949.
@fabriziocucci fabriziocucci force-pushed the feat/checkbox-unify-platforms branch from d4eac3d to efa620a Compare May 21, 2026 14:17
@fabriziocucci fabriziocucci requested a review from adrcotfas May 21, 2026 14:22
@adrcotfas adrcotfas merged commit 6d92d77 into callstack:main May 21, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants