Skip to content

Card has wrong backgroundColor with "elevated" mode #3477

@Bi0max

Description

@Bi0max

Current behaviour

According to Material3 spec, the elevated Card sould have a tint color (https://m3.material.io/components/cards/specs).
image

But every mode except "contained" receives only "color.surface".

const getBackgroundColor = ({
theme,
isMode,
}: {
theme: InternalTheme;
isMode: (mode: CardMode) => boolean;
}) => {
if (theme.isV3) {
if (isMode('contained')) {
return theme.colors.surfaceVariant;
}
return theme.colors.surface;
}
return undefined;
};

Then this color is passed directly to Surface component, which overrides the elevation configuration.
https://github.com/callstack/react-native-paper/blob/main/src/components/Card/Card.tsx#L223-L242

Expected behaviour

"Elevated Card" should have a tint color from colors.elevation.level${elevation}.

How to reproduce?

Just any "elevated" Card

What have you tried so far?

Looked at the source code.

Thank you for an awesome library. Makes life easier!!

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions