feat(Android): update SwitchCompat to MaterialSwitch#56484
Open
adrcotfas wants to merge 1 commit intofacebook:mainfrom
Open
feat(Android): update SwitchCompat to MaterialSwitch#56484adrcotfas wants to merge 1 commit intofacebook:mainfrom
adrcotfas wants to merge 1 commit intofacebook:mainfrom
Conversation
|
Warning JavaScript API change detected This PR commits an update to
This change was flagged as: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
The Android
Switchhas been usingSwitchCompat, a Material Design 2 component from 2018 that produces a visually outdated toggle. This PR migrates it to Material Design 3'sMaterialSwitch. AContextThemeWrapperensures correct MD3 rendering regardless of the host app's theme.New Android-only props, consistent with the existing
trackColor: {false, true}pattern:thumbColorForTrue/thumbColorForFalse: per-state thumb color (thumbColorremains as an alias for seamless migration)thumbIcon: {false?: string, true?: string}: per-state drawable resource shown inside the thumbthumbIconTint: color tint for the thumb iconUnspecified states fall back to Material theme attributes (
colorPrimary,colorSurfaceContainerHighest,colorOnPrimary,colorOutline).Changelog:
[ANDROID] [CHANGED] - Migrate
Switchfrom the outdated MD2SwitchCompattoMaterialSwitch(MD3)[ANDROID] [ADDED] - Add
thumbColorForTrue,thumbColorForFalse, andthumbIcon: {false?: string, true?: string}props toSwitchfor per-state thumb color and icon control on AndroidTest Plan:
Tested on Android via rn-tester Switch examples:
thumbIcon={{true: 'ic_check'}}) and dual-state (thumbIcon={{false: 'ic_close', true: 'ic_check'}}) icon usagemd3_switch.webm