Repository navigation
Button remains unclickable after disabled state changes #491
Copy link
Copy link
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the issue
On Android if html.button state is set to disabled and then back to enabled the pressable itself remains unclickable, while it's children are clickable as expected. As with other similar issues in React Native a workaround is to set a key based on disabled state, but this issue doesn't seem to come from React Native, as it doesn't happen in React Native.
On iOS the button regains clickability as expected.
Expected behavior
Like on iOS, the pressable on Android should become clickable when the disabled state changes back to false.
Steps to reproduce
Platform: Android
OS version: 16.0 ("Baklava"); API 36.0
React version: 19.2.3
React Native version: 0.85.3
RSD version: 0.0.55
- Use the below example:
import { useState } from "react";
import { Button, Pressable, Text, View } from "react-native";
import { css, html } from "react-strict-dom";
export default function RootLayout() {
const [buttonDisabled, setButtonDisabled] = useState(false);
const [rnPresses, setRnPresses] = useState(0);
const [rsdPresses, setRsdPresses] = useState(0);
return (
<View
style={{ flex: 1, backgroundColor: "white", alignItems: "center", justifyContent: "center" }}
>
<Button
title={"Toggle button disabled - now: " + buttonDisabled.toString()}
onPress={() => {
setButtonDisabled((prev) => !prev);
}}
/>
<View>
<Text>RN Pressable - {rnPresses} presses</Text>
<Pressable
disabled={buttonDisabled}
style={({ pressed }) => [
{ backgroundColor: "lightgreen", padding: 16 },
pressed && { opacity: 0.5 },
]}
onPress={() => {
setRnPresses((prev) => prev + 1);
}}
>
<Text style={{ backgroundColor: "black", color: "white", padding: 8 }}>Press me</Text>
</Pressable>
</View>
<View>
<Text>RSD Button - {rsdPresses} presses</Text>
<html.button
disabled={buttonDisabled}
style={styles.button}
onClick={() => {
setRsdPresses((prev) => prev + 1);
}}
>
<html.span style={styles.buttonText}>Press me</html.span>
</html.button>
</View>
</View>
);
}
const styles = css.create({
button: {
backgroundColor: "lightblue",
opacity: {
default: 1,
":active": 0.5,
},
padding: 16,
},
buttonText: {
backgroundColor: "black",
color: "white",
padding: 8,
},
});- Run the app on Android device/emulator
- Verify that, for both RN and RSD cases, both pressable and it's children trigger press event (press count increases)
- Toggle button disabled state to true
- Toggle button disabled state to false
- Verify that for RN case both pressable and children regained clickability, while in RSD case only the label can be clicked to trigger an event
Test case
No response
Additional comments
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Activity
MoOx commentedon Jun 1, 2026
@pmleczek I created a pr with a fix that you can try until it's merged and release. It's basically this change only:
https://github.com/facebook/react-strict-dom/pull/492/changes#diff-be58f0c50c0390b6b5545eb9d78dc0894ebaf0b105cebef05188f9c783347037
pmleczek commentedon Jun 1, 2026
Hi @MoOx
Thanks for raising the PR!
I have a very similar patch in my workspace, so I can confirm that this fixes the issue. Though my fix is a bit different (regarding handling of
disabledwith value ofundefined) - left a comment under the PRpmleczek commentedon Jun 1, 2026
Also wondering if you did any investigation on how React Native version affects this issue? I have a quick observation with using the Expo app from this repo that on the RN version it uses by default (0.83) it works just fine but if bumped to 0.85 (and Expo SDK 56, but Expo shouldn't change anything here) it starts happening 🤔
Fix html.button staying unclickable on Android after toggling disable…
MoOx commentedon Jun 1, 2026
I continued the discussion directly in the PR #492 (comment)