Button `disabled` unexpected behavior on Android
未关闭
还没有人认领这个 Issue。
Component: Button
Platform: Android
- 主要语言
- C++
- 星标
- 127k
- 派生
- 25.3k
- 平均合并
- 1 天 23 小时
- 30 天内合并 PR
- 4
描述
Description
On Android devices, the initial state of disabled for Button leads to unexpected behavior. When disabled is initially specified as true but later changes to false, the the background remains gray and disabled-like. This is unexpected behavior. This is not the case when disabled is initially specified as false.
Steps to reproduce
- Check out https://snack.expo.dev/@ctnelson1997/button-reset?platform=android
- Run on Android (Pixel 9 Pro used)
- When
useStatehas an initial value of0, the app works as expected. - When
useStatehas an initial value of5, and the reset button is pressed, the button still appearsdisabled. This is unexpected behavior.
React Native Version
0.81.5
Affected Platforms
Runtime - Android
Output of npx @react-native-community/cli info
System:
OS: Windows 11 10.0.22631
CPU: (14) x64 Intel(R) Core(TM) Ultra 5 125U
Memory: 2.98 GB / 15.46 GB
Binaries:
Node:
version: 22.19.0
path: C:\Program Files\nodejs\node.EXE
Yarn: Not Found
npm:
version: 10.9.3
path: C:\Program Files\nodejs\npm.CMD
Watchman: Not Found
SDKs:
Android SDK: Not Found
Windows SDK:
AllowAllTrustedApps: Disabled
IDEs:
Android Studio: Not Found
Visual Studio: Not Found
Languages:
Java:
version: 21.0.5
path: C:\Program Files\Eclipse Adoptium\jdk-21.0.5.11-hotspot\bin\javac.EXE
Ruby: Not Found
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 19.1.0
wanted: 19.1.0
react-native:
installed: 0.81.5
wanted: 0.81.5
react-native-windows: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: Not found
newArchEnabled: Not found
iOS:
hermesEnabled: Not found
newArchEnabled: Not found
info React Native v0.82.1 is now available (your project is running on v0.81.5).
info Changelog: https://github.com/facebook/react-native/releases/tag/v0.82.1
info Diff: https://react-native-community.github.io/upgrade-helper/?from=0.81.5&to=0.82.1
info For more info, check out "https://reactnative.dev/docs/upgrading?os=windows".
Stacktrace or Logs
N/A, issue is visual.
MANDATORY Reproducer
https://snack.expo.dev/@ctnelson1997/button-reset?platform=android
Screenshots and Videos
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先,在 Android 上使用 issue 中描述的两个初始 useState 值运行必需的 Snack reproducer,然后跟踪 React Native Button 的 Android 实现。完成的标准是:reset 后将 disabled 从 true 改为 false 也会移除灰色的禁用外观,同时现有的 false 到 false 行为保持不变;如果确定了相关的测试入口点,则添加回归测试覆盖。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- android, react-native
- 领域
- mobile
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 冷清
- 描述清晰度
- 基本清楚
- 新手友好度
- 55/100