Replace status prop with checked in ToggleButton component
维护者通常 3 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 50/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- react-native, typescript
调研方向
在 react-native-paper 代码库中找到 ToggleButton 的实现及其使用位置,然后检查当前 status prop 的类型定义和使用方式。当组件及其调用方都统一使用布尔值 checked,而不是 status 字符串值时,工作即完成。
由索引模型根据 Issue 内容生成。
描述
Is your feature request related to a problem? Please describe.
The ToggleButton component currently uses a status prop with string values checked | unchecked. This adds unnecessary complexity for a binary state.
Describe the solution you'd like
Replace the status prop with a boolean checked prop.
Before:
const ToggleButtonExample = () => {
const [status, setStatus] = React.useState('checked');
const onButtonToggle = () => {
setStatus(status === 'checked' ? 'unchecked' : 'checked');
};
return (
<ToggleButton
icon="bluetooth"
value="bluetooth"
status={status}
onPress={onButtonToggle}
/>
);
};
After:
const ToggleButtonExample = () => {
const [isChecked, setIsChecked] = React.useState(true);
const onButtonToggle = () => {
setIsChecked(s => !s);
};
return (
<ToggleButton
icon="bluetooth"
value="bluetooth"
checked={isChecked}
onPress={onButtonToggle}
/>
);
};
Additional context
A boolean checked prop is simpler, clearer, and more consistent with common React patterns than using string values like 'checked' and 'unchecked'.
- 主要语言
- TypeScript
- 星标
- 14.5k
- 派生
- 2.3k
- 平均合并
- 8 天 7 小时
- 30 天内合并 PR
- 5
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
callstack/react-native-paper 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
callstack/react-native-paper#5146 · 2 条评论 ·
维护者通常 3 天内回复
-
Menu ignores the keyboard when it mounts while the keyboard is already open可能已有人在做 @manchoudhary 于 49 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
callstack/react-native-paper#5096 ·
维护者通常 3 天内回复
-
Tooltip: onPress event object is not propagated to parent component on native可能已有人在做 @aliyilmaztech 于 82 天前认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 74/100
callstack/react-native-paper#5003 ·
维护者通常 3 天内回复
-
Snackbar stays mounted after `visible=false` under new architecture (iOS + Android)可能重新可做 关联的 PR 已关闭且未合并。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
callstack/react-native-paper#4951 ·
维护者通常 3 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 68/100
callstack/react-native-paper#4881 ·
维护者通常 3 天内回复
查看 callstack/react-native-paper 的全部 Issue
相似的 Issue
-
area: cli bug flake ready-for-agent
难度 2/5 1-3 小时 新手友好度 62/100
gazetta-studio/gazetta-studio#1772 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
-
needs-triage
难度 2/5 1-3 小时 新手友好度 66/100
microsoft/playwright#43875 · 1 条评论 ·
维护者通常 1 天内回复
-
documentation good first issue
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
feature
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复