react / react/react-native

Button `disabled` unexpected behavior on Android

オープン
#54,293 コメント 6 件 リアクション 7 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Component: Button Platform: Android
主要言語
C++
スター
127k
フォーク
25.3k
平均マージ
1日 23時間
マージ済み PR(30日)
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
  1. Check out https://snack.expo.dev/@ctnelson1997/button-reset?platform=android
  2. Run on Android (Pixel 9 Pro used)
  3. When useState has an initial value of 0, the app works as expected.
  4. When useState has an initial value of 5, and the reset button is pressed, the button still appears disabled. 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
Image

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、issue に記載された2つの初期 useState 値を使って Android で必須の Snack reproducer を実行し、続いて React Native Button の Android 実装を追跡します。reset 後に disabled を true から false に変更すると灰色の無効状態の外観も削除され、一方で既存の false から false への動作は変わらない状態になれば完了です。関連するテストのエントリポイントが特定できた場合は、回帰テストのカバレッジを追加してください。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
android, react-native
領域
mobile
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
55/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。