Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(mobile): 修复任务标题与导航按钮的间距 (#5106)

Dash545182df3d28
diff --git a/apps/mobile/app/sessions/[sessionId].tsx b/apps/mobile/app/sessions/[sessionId].tsx
index 7dcd72433f..41b01cd72f 100644
--- a/apps/mobile/app/sessions/[sessionId].tsx
+++ b/apps/mobile/app/sessions/[sessionId].tsx
@@ -681,7 +681,7 @@ import type { MobileCodexRateLimitsResult } from '@cindy/maker-shared/device-lin
import { useTranslation } from 'react-i18next';
import { i18n } from '@/i18n';
import { useTheme, useThemedStyles, type ThemeColors } from '@/theme';
-import { fontWeight, iconSize, iconStroke, lineHeight, radius, spacing, typeScale } from '@/theme/tokens';
+import { fontWeight, iconSize, iconStroke, lineHeight, navigationChrome, radius, spacing, typeScale } from '@/theme/tokens';
const SESSION_ACTION_TEST_IDS = {
files: 'session.filesButton',
@@ -9792,6 +9792,15 @@ function SessionHeaderBar({
});
const nativeHeader = Platform.OS === 'ios';
const systemBack = useSystemNavigationBack();
+ const headerWindow = useWindowDimensions();
+ const headerInsets = useSafeAreaInsets();
+ // Budget the title together with both toolbars; UIKit cannot shrink a
+ // fixed-size React title's contents when the trailing glass capsule grows.
+ const nativeTitleMaxWidth = Math.max(0, Math.min(240,
+ headerWindow.width - headerInsets.left - headerInsets.right
+ - (spacing.lg + spacing.xs) * 2 - navigationChrome.target * (onOpenSessionList ? 5 : 4)
+ - (onOpenSessionList ? spacing.sm : 0) - spacing.sm * 2,
+ ));
const sessionListButton = onOpenSessionList ? (
<HomeHeaderGlassButton accessibilityLabel={t('home.drawer.openA11y')}
onPress={onOpenSessionList} testID="session.sessionListButton">
@@ -9808,7 +9817,9 @@ function SessionHeaderBar({
headerStyle: { backgroundColor: 'transparent' }, headerTintColor: colors.textPrimary,
// Route-owned options survive the title component's unmount during a pop transition.
headerTitle: () => (
- <View style={{ maxWidth: 240, height: 44, flexShrink: 1, justifyContent: 'center' }}>
+ <View style={{ width: nativeTitleMaxWidth, height: navigationChrome.target,
+ // Reserve the toolbar gaps in the width budget, outside the title.
+ minWidth: 0, flexShrink: 1, overflow: 'hidden', justifyContent: 'center' }}>
<SessionHeaderNativeTitle title={title} pinned={!messageOnly && !!currentSession?.pinnedAt}
syncing={syncing} syncingImmediately={syncingImmediately} notice={notice} />
</View>
diff --git a/apps/mobile/src/session/SessionHeaderNativeControls.ios.tsx b/apps/mobile/src/session/SessionHeaderNativeControls.ios.tsx
index 647c7862ef..c97281ee35 100644
--- a/apps/mobile/src/session/SessionHeaderNativeControls.ios.tsx
+++ b/apps/mobile/src/session/SessionHeaderNativeControls.ios.tsx
@@ -97,7 +97,7 @@ export function SessionHeaderNativeTitle({ title,
borderRadius: radius.pill,
minHeight: 44,
justifyContent: "center" as const,
- paddingHorizontal: spacing.md,
+ paddingHorizontal: spacing.xs / 2,
overflow: "hidden" as const,
};
const label = (
@@ -121,7 +121,7 @@ export function SessionHeaderNativeTitle({ title,
<View style={{ flex: 1, minWidth: 0, justifyContent: 'center' }}>
<View style={style}>
<BlurBackdrop intensity={20} overlayColor={colors.surfaceTranslucent} />
- <View style={{ flexDirection: "row", alignItems: "center", justifyContent: "center", gap: spacing.xs }}>
+ <View style={{ flexDirection: "row", minWidth: 0, alignItems: "center", justifyContent: "center", gap: spacing.xs }}>
{pinned ? <Pin color={colors.textTertiary} size={iconSize.sm} strokeWidth={iconStroke.regular} /> : null}
{label}
<TaskTagDots