Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(mobile): MA cap the owner bubble in the cloud conversation inside a full-width column so long text wraps
nana28850b4398a4
diff --git a/apps/mobile/src/__tests__/CloudCompanionScreenAttachments.test.tsx b/apps/mobile/src/__tests__/CloudCompanionScreenAttachments.test.tsxindex b301c42745..a6ff23b707 100644--- a/apps/mobile/src/__tests__/CloudCompanionScreenAttachments.test.tsx+++ b/apps/mobile/src/__tests__/CloudCompanionScreenAttachments.test.tsx@@ -10,7 +10,7 @@ const h = vi.hoisted(() => ({}));vi.mock('react-native', async () => {const { createElement: el } = await import('react');- const view = ({ children, testID }: any) => el('div', { 'data-testid': testID }, children);+ const view = ({ children, testID, style }: any) => el('div', { 'data-testid': testID, 'data-style': JSON.stringify(style ?? null) }, children);return { View: view, ScrollView: view, ActivityIndicator: view, StyleSheet: { create: (s: any) => s, hairlineWidth: 1 } };});vi.mock('expo-router', () => ({ Stack: { Screen: () => null }, useRouter: () => ({}) }));@@ -92,3 +92,16 @@ it('shows the owner\'s and the companion\'s attachments under their messages, in// Captions are the attachments' names, not text repeated beside them; an attachment-only message has no empty bubble.expect([...container.querySelectorAll('p')].map(node => node.textContent)).toEqual(['please summarise', 'done', 'plain']);});++// Tier: behavior. The owner's bubble sat in a content-sized column capped at 86%; the bubble itself had no cap,+// so long text was laid out wider than the cap and clipped. The cap must live on the bubble, inside a full-width column.+it('caps the owner\'s bubble at 86% of a full-width column so long text wraps', async () => {+ h.room.messages = [message(2, id(9), [{ type: 'text', text: 'a long message '.repeat(20) }])];+ await render();+ const column = container.querySelector('[data-testid="cloudCompanion.message.user"] > div') as HTMLElement;+ const bubble = column.firstElementChild as HTMLElement;+ const style = (node: HTMLElement) => [JSON.parse(node.dataset.style!)].flat(2).reduce((all, part) => ({ ...all, ...(part || {}) }), {} as Record<string, unknown>);+ expect(style(bubble).maxWidth).toBe('86%');+ expect(style(column).maxWidth).toBeUndefined();+ expect(style(column).alignItems).toBe('flex-end');+});diff --git a/apps/mobile/src/session/CloudCompanionScreen.tsx b/apps/mobile/src/session/CloudCompanionScreen.tsxindex e0c721b2e2..79f9cbec55 100644--- a/apps/mobile/src/session/CloudCompanionScreen.tsx+++ b/apps/mobile/src/session/CloudCompanionScreen.tsx@@ -292,9 +292,10 @@ const makeStyles = (colors: ThemeColors) => StyleSheet.create({timeline: { flexGrow: 1, justifyContent: 'flex-end', gap: spacing.lg, paddingHorizontal: spacing.lg, paddingVertical: spacing.md },olderSlot: { alignItems: 'center' },userRow: { flexDirection: 'row', justifyContent: 'flex-end' },- userColumn: { maxWidth: '86%', alignItems: 'flex-end', gap: spacing.xs },- // The 1:1 user bubble: 86% wide, padding 12.- userBubble: { backgroundColor: colors.surfaceElevated, borderColor: colors.border, borderWidth: StyleSheet.hairlineWidth,+ // Full row width, so the bubble's 86% cap resolves against a definite width instead of its own content.+ userColumn: { flex: 1, minWidth: 0, alignItems: 'flex-end', gap: spacing.xs },+ // The 1:1 user bubble: up to 86% wide, padding 12.+ userBubble: { maxWidth: '86%', backgroundColor: colors.surfaceElevated, borderColor: colors.border, borderWidth: StyleSheet.hairlineWidth,borderRadius: radius.container, padding: spacing.md },replyRow: { flexDirection: 'row', alignItems: 'flex-start', gap: REPLY_AVATAR_GAP },replyRowContinued: { marginTop: -spacing.sm },