Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(mobile): Android 首页抽屉改用独立窗口,折叠屏展开后不再被列表盖住
Lizi2da17157015c
diff --git a/apps/mobile/src/__tests__/homeDesktopFirst.test.ts b/apps/mobile/src/__tests__/homeDesktopFirst.test.tsindex 9c529d1186..5fc2750d32 100644--- a/apps/mobile/src/__tests__/homeDesktopFirst.test.ts+++ b/apps/mobile/src/__tests__/homeDesktopFirst.test.ts@@ -785,4 +785,15 @@ describe('home menu presentation', () => {expect(drawer).toContain('Gesture.Pan()');expect(drawer).not.toContain('ComposerSheet');});++ it('keeps the Android drawer in its own window above the resident home list', () => {+ const drawer = readSource('src/session/HomeChromeDrawer.tsx');+ // Wide layouts mount the home list in a root layer after the routes; an in-route+ // overlay cannot rise above it, so Android presents the drawer as a Dialog window.+ expect(drawer).not.toContain('if (Platform.OS !== "ios") return overlay;');+ expect(drawer).toMatch(/<Modal[\s\S]*?onRequestClose=\{requestClose\}[\s\S]*?transparent[\s\S]*?\{content\}\s*<\/Modal>/);+ expect(drawer).toContain('statusBarTranslucent');+ expect(drawer).toContain('navigationBarTranslucent');+ expect(drawer).not.toContain('BackHandler');+ });});diff --git a/apps/mobile/src/session/HomeChromeDrawer.tsx b/apps/mobile/src/session/HomeChromeDrawer.tsxindex 05128e85a5..d6fd78fe20 100644--- a/apps/mobile/src/session/HomeChromeDrawer.tsx+++ b/apps/mobile/src/session/HomeChromeDrawer.tsx@@ -2,19 +2,21 @@* HomeChromeDrawer —— 首页左上角系统菜单。** 从左边滑出,不是下拉卡:承载搜索、设备管理、设置和账号入口。- * 不用 RN Modal,避免和首页其它 Modal 抢 present/dismiss。- * iOS 系统导航栏在 RN 内容之上,树内 overlay 盖不住顶栏,所以走- * react-native-screens FullWindowOverlay(独立 UIWindow)。- * 新窗口里要自带 GestureHandlerRootView,左滑关闭才有效。- * Android 无系统顶栏,继续树内 overlay。动画遵循 reduce-motion。+ * 抽屉必须盖住整个窗口,所以不能是树内 overlay,两端都放进独立窗口:+ * - iOS 系统导航栏在 RN 内容之上,走 react-native-screens FullWindowOverlay+ * (独立 UIWindow),不用 RN Modal,避免和首页其它 Modal 抢 present/dismiss。+ * - Android 宽屏常驻布局(折叠屏展开等)把首页列表挂在路由树之上的根层+ * (ResidentHomeList),连接提示也在根层,树内 zIndex 越不过这些兄弟层;+ * 走透明 RN Modal(独立 Dialog 窗口),返回键由 onRequestClose 接管。+ * 新窗口里要自带 GestureHandlerRootView,左滑关闭才有效。动画遵循 reduce-motion。*/import { LogOut, Monitor, Search, Settings, UsersRound } from 'lucide-react-native';import { useCallback, useEffect, useMemo, useRef, useState } from 'react';import {AccessibilityInfo,- BackHandler,findNodeHandle,Image,+ Modal,Platform,Pressable,StyleSheet,@@ -191,17 +193,11 @@ export function HomeChromeDrawer({reduceMotion,]);- useEffect(() => {- if (!open) return;- const subscription = BackHandler.addEventListener(- "hardwareBackPress",- () => {- onClose();- return true;- },- );- return () => subscription.remove();- }, [onClose, open]);+ // Android 返回键落在抽屉的 Dialog 窗口上。只有打开态才转成关闭:退场动画期间+ // 调用方可能已记下关闭后的动作,再调 onClose 会把它清掉。+ const requestClose = useCallback(() => {+ if (openRef.current) onClose();+ }, [onClose]);const closeFromGesture = useCallback(() => onClose(), [onClose]);const panGesture = useMemo(@@ -398,14 +394,31 @@ export function HomeChromeDrawer({</View>);- if (Platform.OS !== "ios") return overlay;+ const content = (+ <GestureHandlerRootView style={styles.overlayHost}>+ {overlay}+ </GestureHandlerRootView>+ );++ if (Platform.OS === "ios") {+ return (+ <FullWindowOverlay unstable_accessibilityContainerViewIsModal>+ {content}+ </FullWindowOverlay>+ );+ }return (- <FullWindowOverlay unstable_accessibilityContainerViewIsModal>- <GestureHandlerRootView style={styles.overlayHost}>- {overlay}- </GestureHandlerRootView>- </FullWindowOverlay>+ <Modal+ animationType="none"+ navigationBarTranslucent+ onRequestClose={requestClose}+ statusBarTranslucent+ transparent+ visible+ >+ {content}+ </Modal>);}diff --git a/docs/design-rules/DESIGN.md b/docs/design-rules/DESIGN.mdindex bce4ae73b1..4c145f5a58 100644--- a/docs/design-rules/DESIGN.md+++ b/docs/design-rules/DESIGN.md@@ -441,7 +441,7 @@ download happens in the normal startup Splash, not in the row.- Custom iOS home/sidebar icon buttons and standalone back buttons share `NativeChromeButton` (SwiftUI Button with native glass style). Preserve existing icon artwork inside the native label; do not substitute a React Native Pressable with a separate GlassView for this button family.- Mobile glass button styles are configured in `platform/chrome/nativeGlassButtonStyle.ios.ts`: neutral circles, text/primary actions and grouped toolbar material share that entry. Home floating new-task and share-cancel actions use the same native button path; text buttons retain intrinsic label sizing. Keep light/dark semantic colors and native disabled/activation behavior. Non-iOS retains the React Native fallback.- Login actions use `LoginNativeButton.ios.tsx` with the same shared glass styling. SwiftUI owns activation, disabled state and loading indicators; existing brand artwork can remain inside RNHostView labels. The login stage retains its design-coordinate frames and scaling, while text actions use native borderless buttons. This supersedes the hand-painted button feedback in the login skin on iOS only; inputs, consent checkbox, inline legal links and non-iOS controls retain their existing implementations.-- The home main menu remains a left-edge drawer on every platform and window shape, using `HomeChromeDrawer.tsx` (iOS uses FullWindowOverlay above the native header). Preserve backdrop dismissal, swipe-left dismissal and the drawer's close lifecycle. Native glass button unification must not replace this navigation drawer with a bottom sheet. Device-scope/display pull-downs keep their existing system UIMenu path and native toolbar menus; their custom panels are fallback code, not a reason to replace working native menus. System navigation/toolbars remain native container-owned.+- The home main menu remains a left-edge drawer on every platform and window shape, using `HomeChromeDrawer.tsx` (iOS uses FullWindowOverlay above the native header; Android uses a transparent Modal window, because wide layouts mount the resident home list and connection notices in root layers that an in-route overlay cannot cover). Preserve backdrop dismissal, swipe-left dismissal and the drawer's close lifecycle. Native glass button unification must not replace this navigation drawer with a bottom sheet. Device-scope/display pull-downs keep their existing system UIMenu path and native toolbar menus; their custom panels are fallback code, not a reason to replace working native menus. System navigation/toolbars remain native container-owned.- Standalone custom navigation controls use a 44pt visible circle and 44pt hit frame (`navigationChrome.target`), with 20pt artwork (`iconSize.action`) centered inside. Apply the native interactive glass effect after the explicit frame on a borderless SwiftUI Button; do not add `controlSize(large)` or another glass/padding layer. System toolbar items retain native sizing and positioning: never replace them with `Toolbar.View` to enforce this custom-control rule, because that breaks Duo's vertical adaptation.- Prefer the native navigation container for page back/close and toolbar actions. On Duo, let the system adapt navigation to the shared status/toolbar region; only the detail column gets the vertical bar in a split view. Sidebar-local menus stay in the sidebar.- Full-screen custom overlays (remote desktop) keep back and tools on the right in both Duo landscape rotations, centered on one rail below the system status area. Back comes before tools. Respect safe areas and reserved folds; do not mirror the rail from a video orientation event.