Button remains unclickable after disabled state changes
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 62/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- android, javascript, react, react-native
- Lĩnh vực
- frontend, mobile-dev
Hướng nghiên cứu
Bắt đầu với bản tái hiện Android được cung cấp cho html.button và so sánh cách xử lý trạng thái disabled với React Native Pressable. Theo dõi phần triển khai Android và thêm một bài kiểm thử hồi quy cho việc chuyển disabled từ true trở lại false; hoàn tất khi chính nút đó và các phần tử con của nó lại phản hồi với thao tác nhấn.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- JavaScript
- Star
- 3.6k
- Fork
- 206
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của react/react-strict-dom
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
react/react-strict-dom#467 · 1 bình luận ·
-
Missing disabled prop Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
react/react-strict-dom#465 · 2 bình luận ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
react/react-strict-dom#520 ·
-
css.defineVars() with kebab-case keys warns unrecognized custom property and fails to resolve Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 35/100
react/react-strict-dom#505 · 2 reaction ·
-
Publish react-strict-animated Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
react/react-strict-dom#482 · 1 bình luận ·
Tất cả issue của react/react-strict-dom
Issue tương tự
-
Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Automattic/safe-publish#594 ·
-
内部文件键(绝对路径的 base64)泄漏到界面标签 Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
dream-num/dsh-univer-office#104 ·
-
comp/dashboard invalid P3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
NousResearch/hermes-agent#121143 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
avniproject/avni-webapp#1811 ·
-
area/auroraboot area/webui bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100