Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 2.2k
refactor: modernize non standard components to the latest MD3 spec#5016
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
MrMuzyk
wants to merge
4
commits into
callstack:mainChoose a base branch
from
MrMuzyk:refactor/non-standard-components
base:main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Uh oh!
There was an error while loading. Please reload this page.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| import type { ColorValue } from 'react-native'; | ||
| import { white } from '../../theme/colors'; | ||
| import type { InternalTheme } from '../../types'; | ||
| import getContrastingColor from '../../utils/getContrastingColor'; | ||
| export const DEFAULT_SIZE = 64; | ||
| export const ICON_SIZE_RATIO = 0.6; | ||
| /** | ||
| * Resolve background and content colors for an avatar. | ||
| * - No custom background → MD3 container pair (primaryContainer / onPrimaryContainer). | ||
| * - Custom background → keep luminance-based contrast so arbitrary per-user | ||
| * colors stay legible (contentColorFor only handles known theme roles). | ||
| */ | ||
| export const resolveAvatarColors = ({ | ||
| theme, | ||
| backgroundColor, | ||
| color, | ||
| }: { | ||
| theme: InternalTheme; | ||
| backgroundColor?: ColorValue; | ||
| color?: string; | ||
| }) => { | ||
| const usingDefault = backgroundColor == null; | ||
| const background = backgroundColor ?? theme.colors.primaryContainer; | ||
| const textColor = | ||
| color ?? | ||
| (usingDefault | ||
| ? theme.colors.onPrimaryContainer | ||
| : getContrastingColor(background, white, 'rgba(0, 0, 0, .54)')); | ||
| return { background, textColor }; | ||
| }; |
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
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
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
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
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
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dropping the
* scalemultiplier turns off reduce-motion for Banner entirely.scaleisn't a legacy leftover —PaperProvider.tsx:35-37sets it to0wheneveruseResolvedReduceMotion()resolves true, either fromAccessibilityInfo.isReduceMotionEnabledor from the explicitreduceMotionprop.250 * scalewas therefore0for those users and the banner snapped in and out; after this change it always runs the full 250ms/200ms transition. The token adoptionitself is fine (
medium1= 250,short4= 200, identical to the old numbers), it's only the multiplier that carries the a11y behaviour.The PR description says this matches "how Switch/Checkbox adopted motion tokens", but those two didn't drop reduce-motion — they replaced the mechanism.
Switch.tsx:169-171andCheckbox.tsxboth calluseReduceMotion()fromsrc/theme/accessibility/ReduceMotionContextand feedReduceMotion.Always/Neverinto their Reanimated configs. Banner ends up honouring neither path, and it's now the only animated component insrc/that reads neithertheme.animation.scale(still live in ProgressBar, Modal, Badge, Snackbar, ActivityIndicator, Chip, Card, CrossFadeIcon, DrawerCollapsedItem, RadioButtonAndroid) noruseReduceMotion().RN's
Animated.timinghas noreduceMotionoption, so either keepscale, or take the Switch/Checkbox route:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for raising this up @JKobrynski 🙏
basically, this issue was addressed in recent ae2ecfc commit. both
Bannerdurations now usetheme.animation.scale& regression test coversscale: 0as for PR description, it's stale & I can't update since I'm not the owner of this PR
but here's what it should say instead: