From ee264b644cc47cca0d0150b5c064ec39d50c6edc Mon Sep 17 00:00:00 2001
From: doublex001 <16157008+doublex001@user.noreply.gitee.com>
Date: Mon, 14 Sep 2026 12:58:20 +0800
Subject: [PATCH] =?UTF-8?q?fix(privacy):=20=E4=BF=AE=E5=A4=8D=E9=9A=90?=
=?UTF-8?q?=E7=A7=81=E8=AE=BE=E7=BD=AE=E9=A1=B5=E5=BC=80=E5=85=B3=E9=A1=B9?=
=?UTF-8?q?=E6=97=A0=E5=85=A5=E5=8F=A3=EF=BC=8C7=20=E4=B8=AA=E9=A1=B5?=
=?UTF-8?q?=E9=9D=A2=E6=97=A0=E6=B3=95=E8=B7=B3=E8=BD=AC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
app/settings/privacy.tsx 的 switch 分支渲染为 View + Switch,未绑定
onPress;而 handlePress(内部 router.push(item.route))只挂在
Pressable 分支上,导致带 route 的开关型条目点击无任何反应。
mock 数据中共 7 条 type: 'switch' 条目挂着 route(real-name /
contact / algo / third-party / location / contacts / dnd),对应
app/settings/privacy/[id].tsx(279 行,覆盖 6 个 slug)与 dnd.tsx
(295 行)两个实页面,运行期完全不可达,违反「有页面出口就一定要
有入口」规范。
对照证据:同组末尾的 keyword-block 是 type: 'value',走 Pressable
分支,其 /settings/privacy/keywords(357 行)可正常进入。这种不对称
证明是漏绑而非设计意图。
修法:仅将左侧文字区包为 Pressable 触发跳转,并补 chevron-forward
提示可点;右侧 Switch 保持独立切换,二者为兄弟节点不嵌套,互不干扰。
无 route 的开关(如「头像公开」)行为不变。
---
app/settings/privacy.tsx | 31 +++++++++++++++++++++++--------
1 file changed, 23 insertions(+), 8 deletions(-)
diff --git a/app/settings/privacy.tsx b/app/settings/privacy.tsx
index 6c5e7a6..0e49b2f 100644
--- a/app/settings/privacy.tsx
+++ b/app/settings/privacy.tsx
@@ -65,19 +65,29 @@ function SettingRow({
const titleColor = isDanger ? colors.dangerText : colors.textPrimary;
const handlePress = () => {
- if (item.route) {
- router.push(item.route);
- return;
- }
+ if (item.route) router.push(item.route);
};
+ const rowBody = (
+
+ {item.title}
+ {item.description ? {item.description} : null}
+
+ );
+
+ // 开关型条目:带 route 的(如「勿扰模式」「真实姓名可见性」)点击左侧文字区进详情页,
+ // 右侧 Switch 保持独立可切换,两者互不干扰。
if (item.type === 'switch') {
return (
-
- {item.title}
- {item.description ? {item.description} : null}
-
+ {item.route ? (
+
+ {rowBody}
+
+
+ ) : (
+ rowBody
+ )}
onToggle?.(item.id, next)}
@@ -270,6 +280,11 @@ const styles = StyleSheet.create({
flex: 1,
marginRight: 12,
},
+ rowTapArea: {
+ flex: 1,
+ flexDirection: 'row',
+ alignItems: 'center',
+ },
rowTitle: {
fontSize: 15,
fontWeight: '600',