Fix Button background not updating when initially disabled on Android #54505
+15
−6
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.
Summary
On Android, a Button that is initially rendered with disabled={true} and later toggled to disabled={false} can keep a gray/disabled background instead of returning to the enabled appearance. This PR fixes the state/appearance reset so Buttons render correctly when disabled is changed from true to false.
Related issue
Closes #54293 — Button disabled unexpected behavior on Android
Root cause
When the Button is first rendered disabled, the native background/tint state on Android stays in the disabled drawable/state and is not re-applied when the enabled state toggles back. The fix ensures the background/drawable/tint/state is updated when the disabled prop changes.
What I changed
Risk
Low. Change is limited to Android Button state handling and only affects how the background/drawable is refreshed on prop updates.
Notes for reviewers
Changelog:
[Android] [Fixed] - Fix Button remaining visually disabled when initially rendered with disabled={true}; refresh the native background/drawable/tint when the disabled prop changes so the Button returns to the enabled appearance when toggled from true → false.
Test Plan