Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
refactor(mobile): 清理冗余——合并键盘跟随规则、收窄仅内部使用的导出、按压反馈引用统一样式
kirozeng39bd981ce30a
diff --git a/apps/mobile/app/sessions/new.tsx b/apps/mobile/app/sessions/new.tsxindex e270d69620..fd7734031b 100644--- a/apps/mobile/app/sessions/new.tsx+++ b/apps/mobile/app/sessions/new.tsx@@ -11,7 +11,8 @@ import { resolveWorkspacePickerFrame, type WorkspacePickerFrame } from '@/sessioimport { simpleScreenSafeAreaEdges } from '@/platform/chrome/SimpleStackHeader';import { readComposerEntry, useComposerDock } from '@/session/composerMorph';import { useComposerPillOpen } from '@/session/useComposerPillOpen';-import { ComposerDockKeyboardSpacer } from '@/session/ComposerDockKeyboardSpacer';+import { DockKeyboardBottomSpacer } from '@/session/ComposerDockKeyboardFollow';+import { mobileInteractionStyles } from '@/components/mobileInteractionStyles';import { composerGeometry } from '@/session/composerGeometry';import Constants from 'expo-constants';import { MOBILE_VISUAL_MOCK_ENABLED } from '@/config/env';@@ -6227,7 +6228,7 @@ export default function NewRemoteSessionScreen() {</View></ScrollView>{composerDock.enabled ? (- <ComposerDockKeyboardSpacer restingBottom={composerDock.restingBottom} keyboardGap={composerDock.keyboardGap} />+ <DockKeyboardBottomSpacer restingBottom={composerDock.restingBottom} keyboardGap={composerDock.keyboardGap} />) : null}{/* Keep the floating panel inside its native touch bounds on Android. */}{!nativeSelectionSheet && workspacePickerOpen && workspacePickerFrame ? (@@ -7415,7 +7416,6 @@ const makeStyles = (colors: ThemeColors) => StyleSheet.create({borderColor: colors.border,},sendButtonPressed: { opacity: 0.86 },- // 与 mobileInteractionStyles.pressed 同值(0.72),全端按压反馈统一。- pressed: { opacity: 0.72 },+ pressed: mobileInteractionStyles.pressed,disabled: { opacity: 0.44 },});diff --git a/apps/mobile/docs/navigation-demo.md b/apps/mobile/docs/navigation-demo.mdindex abfc885f93..0638faeb76 100644--- a/apps/mobile/docs/navigation-demo.md+++ b/apps/mobile/docs/navigation-demo.md@@ -66,10 +66,10 @@ ExpoModulesJSI 的接口清理脚本只识别旧编译器的 __ObjC. 写法,27就绪后真实玻璃带速度接力;进入时不播推入动画,进入后恢复普通返回动画。只有首页开启形变。- 输入框:新建、已有任务、伙伴聊天统一为 55pt 药丸,下沿同一条线;不自动聚焦。手动点药丸先向上拉开成完整卡片(原生),约 0.05s 后原生聚焦,键盘随后升起;输入框逐帧跟随键盘- (新建页 `ComposerDockKeyboardSpacer`,已有任务 `DockKeyboardLift` / `DockKeyboardViewportSpacer`)。+ (均在 `ComposerDockKeyboardFollow.tsx`:新建页 `DockKeyboardBottomSpacer`,已有任务 `DockKeyboardLift` / `DockKeyboardViewportSpacer`)。- 减弱动态效果:不播形变与拉开,直接到位。- 伙伴对话:左上角为返回(回到伙伴列表);Duo 系统栏已有返回时保留侧栏按钮,不出现两个返回。-- 设置等整页滚动的二级页:顶栏透明、系统柔和边缘,内容滚到顶栏和底部指示条下面,无硬分界(设置、语音词典、账号注销、伙伴私聊、共享任务管理、资源列表);设备详情、自动化只去掉底部色带。+- 设置等整页滚动的二级页:顶栏透明、系统柔和边缘,内容滚到顶栏和底部指示条下面,无硬分界(设置、语音词典、账号注销、伙伴私聊、共享任务管理、资源列表);设备详情只去掉底部色带。## 已知未完成@@ -77,7 +77,9 @@ ExpoModulesJSI 的接口清理脚本只识别旧编译器的 __ObjC. 写法,27- 卡片收回药丸仍为直接切换;禁用的新建按钮点击无说明。- 深色全量实走、Duo 各姿态、真机帧率未做。- `devices.json` 同一对象里 `failed` 键重复(基线即如此,前者文案永不生效),未处理。-- 设备详情、自动化页列表上方有固定的搜索/概览条,列表顶端仍是硬切。+- 设备详情页列表上方有固定的搜索条,列表顶端仍是硬切。++- 已合入 main 000337155f(2026-09-29):首页标题宽度改用 main 的对称算法,比试用版更早截断。## 合入前待办(效果全部确认后统一处理)diff --git a/apps/mobile/src/components/MobileUserAvatar.tsx b/apps/mobile/src/components/MobileUserAvatar.tsxindex 36b9f9fd38..e833da57a7 100644--- a/apps/mobile/src/components/MobileUserAvatar.tsx+++ b/apps/mobile/src/components/MobileUserAvatar.tsx@@ -17,7 +17,7 @@ const AVATAR_DIMENSION: Record<MobileUserAvatarSize, number> = {regular: 44,};-export function mobileUserAvatarInitial(name: string | null | undefined): string {+function mobileUserAvatarInitial(name: string | null | undefined): string {// Whole code point, so a name starting with an emoji or astral character stays intact.return (Array.from(name?.trim() ?? '')[0] ?? '?').toUpperCase();}diff --git a/apps/mobile/src/session/CompanionProfileSheet.tsx b/apps/mobile/src/session/CompanionProfileSheet.tsxindex 0982d37346..da40921b27 100644--- a/apps/mobile/src/session/CompanionProfileSheet.tsx+++ b/apps/mobile/src/session/CompanionProfileSheet.tsx@@ -17,7 +17,7 @@ import { readRemoteCollectionCache } from '@/device-link/remoteResourceAvailabilimport { CompanionSettingsRow as ContextSheetRow } from './CompanionSettingsRow';import { CompanionChoice } from './CompanionChoice';import { CompanionSheet } from './CompanionSheet';-import { fontWeight, iconSize, iconStroke, lineHeight, radius, spacing, typeScale, useTheme, useThemedStyles, type ThemeColors } from '@/theme';+import { fontWeight, iconSize, lineHeight, radius, spacing, typeScale, useTheme, useThemedStyles, type ThemeColors } from '@/theme';import { CompanionModelChain, CompanionModelPicker, readCompanionModelChain } from './CompanionModelChain';import { CompanionCreateNativeView } from './CompanionCreateNativeView';import { CompanionPortraitPicker, randomCompanionPortrait } from './CompanionPortraitPicker';diff --git a/apps/mobile/src/session/ComposerDockKeyboardFollow.tsx b/apps/mobile/src/session/ComposerDockKeyboardFollow.tsxindex cbafd11b4a..59a3653d42 100644--- a/apps/mobile/src/session/ComposerDockKeyboardFollow.tsx+++ b/apps/mobile/src/session/ComposerDockKeyboardFollow.tsx@@ -3,19 +3,26 @@ import { Platform, View } from 'react-native';import Reanimated, { useAnimatedKeyboard, useAnimatedStyle } from 'react-native-reanimated';/**- * iOS existing task / partner chat: the composer and- * the message viewport follow the keyboard on the UI thread every frame,- * instead of jumping to the end position when the keyboard event arrives- * (RN LayoutAnimation does not run for these views in this build).+ * iOS composer dock: the composer (and, in an existing task / partner chat, the+ * message viewport) follows the keyboard on the UI thread every frame, instead of+ * jumping to the end position when the keyboard event arrives (RN LayoutAnimation+ * does not run for these views in this build).*- * The composer bottom is max(restingBottom, keyboard + gap): it stays at the- * new-task button's edge until the keyboard reaches it, then rides with a fixed- * gap. Only iOS mounts the keyboard tracker; the choice is a platform- * constant, so hooks never change between renders and toggling `active`- * never remounts the composer.+ * Only iOS mounts the keyboard tracker; the choice is a platform constant, so+ * hooks never change between renders and toggling `active` never remounts the+ * composer.*/const TRACKS = Platform.OS === 'ios';+/**+ * Composer bottom edge: it stays at the new-task button's edge until the keyboard+ * reaches it, then rides the keyboard with a fixed gap.+ */+function dockBottom(keyboardHeight: number, restingBottom: number, keyboardGap: number): number {+ 'worklet';+ return Math.max(restingBottom, keyboardHeight + keyboardGap);+}+type ViewProps = ComponentProps<typeof View>;/** Lifts its subtree by transform (no per-frame layout for the composer). */@@ -30,7 +37,7 @@ function TrackingLift({ active, restingBottom, keyboardGap, style, children, ...}) {const keyboard = useAnimatedKeyboard();const lift = useAnimatedStyle(() => ({- transform: [{ translateY: active ? -Math.max(0, keyboard.height.value + keyboardGap - restingBottom) : 0 }],+ transform: [{ translateY: active ? restingBottom - dockBottom(keyboard.height.value, restingBottom, keyboardGap) : 0 }],}), [active, keyboardGap, restingBottom]);return <Reanimated.View {...props} style={[style, lift]}>{children}</Reanimated.View>;}@@ -44,3 +51,10 @@ function TrackingSpacer({ active }: { active: boolean }) {const style = useAnimatedStyle(() => ({ height: active ? keyboard.height.value : 0 }), [active]);return <Reanimated.View pointerEvents="none" style={style} />;}++/** New task: the space under the composer, sized by layout so the page content above shrinks with it. */+export function DockKeyboardBottomSpacer({ restingBottom, keyboardGap }: { restingBottom: number; keyboardGap: number }) {+ const keyboard = useAnimatedKeyboard();+ const style = useAnimatedStyle(() => ({ height: dockBottom(keyboard.height.value, restingBottom, keyboardGap) }), [keyboardGap, restingBottom]);+ return <Reanimated.View pointerEvents="none" style={style} />;+}diff --git a/apps/mobile/src/session/ComposerDockKeyboardSpacer.tsx b/apps/mobile/src/session/ComposerDockKeyboardSpacer.tsxdeleted file mode 100644index fbe2e9dac9..0000000000--- a/apps/mobile/src/session/ComposerDockKeyboardSpacer.tsx+++ /dev/null@@ -1,14 +0,0 @@-import Reanimated, { useAnimatedKeyboard, useAnimatedStyle } from 'react-native-reanimated';--/**- * iOS new task: the space under the composer, tracked on the UI- * thread every keyboard frame. The composer stays at the new-task button's bottom edge- * until the keyboard reaches it, then rides the keyboard with a fixed gap,- * instead of jumping to its final place when the keyboard event arrives.- * Mounted only on the iOS composer dock; other layouts keep the shared keyboard state.- */-export function ComposerDockKeyboardSpacer({ restingBottom, keyboardGap }: { restingBottom: number; keyboardGap: number }) {- const keyboard = useAnimatedKeyboard();- const style = useAnimatedStyle(() => ({ height: Math.max(restingBottom, keyboard.height.value + keyboardGap) }));- return <Reanimated.View pointerEvents="none" style={style} />;-}diff --git a/apps/mobile/src/session/SessionTransientNotice.tsx b/apps/mobile/src/session/SessionTransientNotice.tsxindex cbac375f1c..c0b3c7c5da 100644--- a/apps/mobile/src/session/SessionTransientNotice.tsx+++ b/apps/mobile/src/session/SessionTransientNotice.tsx@@ -21,7 +21,7 @@ import {typeScale,} from '@/theme/tokens';-export const SESSION_TRANSIENT_NOTICE_MS = 1500;+const SESSION_TRANSIENT_NOTICE_MS = 1500;export interface SessionTransientNoticeValue {/** 每次提示递增,同文案连续触发也会重新计时。 */diff --git a/apps/mobile/src/session/SettingsGroupRows.tsx b/apps/mobile/src/session/SettingsGroupRows.tsxindex 5c62d1fdbb..d44edf26ff 100644--- a/apps/mobile/src/session/SettingsGroupRows.tsx+++ b/apps/mobile/src/session/SettingsGroupRows.tsx@@ -243,7 +243,7 @@ export function SettingsSwitchRow({);}-export const makeSettingsRowStyles = (colors: ThemeColors) => StyleSheet.create({+const makeSettingsRowStyles = (colors: ThemeColors) => StyleSheet.create({// —— 分组 ——group: { gap: spacing.sm },groupTitleRow: {