callstack / callstack/react-native-paper

Elevation prop does not work for M2 theme

未关闭
#4,413 0 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看
bug
主要语言
TypeScript
星标
14.5k
派生
2.2k
平均合并
5 天 23 小时
30 天内合并 PR
12

描述

### Current behaviour
According to documentation
"In version 2 the `elevation` prop was accepted via `style` prop i.e. `style={{ elevation: 4 }}`.
It's no longer supported with theme version 3 and you should use `elevation` property instead."

But in reality, even if we use style with `elevation: 0`. it does not affect the button at all.

### Expected behaviour

After adding the style={{ elevation: 0 }} on M2 themed contained button it should not contain any shadows, and must behave like a flat button.

### How to reproduce?

- use Button component with `mode=contained`
- make sure to have theme version 2 enabled
- add `style={{ elevation: 0 }}` to the Button

Reproduced Snack

https://snack.expo.dev/@stanwar/react-native-paper-m2-button-issue

### Preview

### What have you tried so far?

### Your Environment

| software | version
| --------------------- | -------
| ios | N/A
| android | 14
| react-native | 0.73.6
| react-native-paper | 5.12.3
| node | 20.11.1
| npm or yarn | 1.22.22 (Yarn)
| expo sdk | None (bare project)

贡献指南

打开贡献指南

调研方向

从 React Native Paper 的 Button 组件及其特定于主题版本的 elevation 处理开始,然后使用链接的 Snack 或提供的 Android 设置重现该行为。跟踪 contained M2 button 如何应用 style elevation,并验证 style={{ elevation: 0 }} 会移除其阴影,同时不会影响其他 button 模式。

由索引模型根据 Issue 内容生成。

评估

技术栈
react-native, typescript
领域
frontend, mobile-dev
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。