Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(mobile): 收起态输入胶囊内的按钮恢复垂直居中
kirozeng79f898d03e03
diff --git a/apps/mobile/src/__tests__/composerToolbarViewport.test.tsx b/apps/mobile/src/__tests__/composerToolbarViewport.test.tsxindex 67319345da..7ac0f4fe37 100644--- a/apps/mobile/src/__tests__/composerToolbarViewport.test.tsx+++ b/apps/mobile/src/__tests__/composerToolbarViewport.test.tsx@@ -16,8 +16,9 @@ vi.mock('react-native', async () => {React.createElement('div', { 'data-testid': testID, style: flatten(style), ref: (node: HTMLDivElement | null) => {if (node && onLayout) nativeLayout.set(node, height => onLayout({ nativeEvent: { layout: { height } } }));} }, children);- const ScrollView = ({ children, testID, scrollEnabled }: { children?: ReactNode; testID?: string; scrollEnabled?: boolean }) =>- React.createElement('div', { 'data-testid': testID, 'data-scroll': String(scrollEnabled) }, children);+ const ScrollView = ({ children, testID, scrollEnabled, style, contentContainerStyle }: { children?: ReactNode; testID?: string; scrollEnabled?: boolean; style?: unknown; contentContainerStyle?: unknown }) =>+ React.createElement('div', { 'data-testid': testID, 'data-scroll': String(scrollEnabled),+ 'data-grow': `${flatten(style).flexGrow}/${flatten(contentContainerStyle).flexGrow}` }, children);return { View, ScrollView, Pressable: View, Platform: { OS: 'ios' },StyleSheet: { hairlineWidth: 1, absoluteFill: {} }, Animated: {}, Easing: {} };});@@ -68,9 +69,13 @@ it('keeps send/voice/grabber outside the scrolling body and retains the editor arender(false);expect(container.querySelector('textarea')).toBe(editor);expect(body.getAttribute('data-scroll')).toBe('false');+ // Collapsed: viewport and content fill the taller pill so the row stays vertically centred.+ expect(body.getAttribute('data-grow')).toBe('1/1');render(true);expect(container.querySelector('textarea')).toBe(editor);expect(body.getAttribute('data-scroll')).toBe('true');+ // Expanded: size to children so removed attachments release their height (#6291).+ expect(body.getAttribute('data-grow')).toBe('0/0');} finally { act(() => root.unmount()); }});diff --git a/apps/mobile/src/session/MobileComposerInputRow.tsx b/apps/mobile/src/session/MobileComposerInputRow.tsxindex e23782e7ca..c38cfa3c62 100644--- a/apps/mobile/src/session/MobileComposerInputRow.tsx+++ b/apps/mobile/src/session/MobileComposerInputRow.tsx@@ -399,8 +399,8 @@ export function MobileComposerInputRow({<GestureDetector gesture={bodyScrollGesture}><ScrollViewref={bodyScrollRef}- style={styles.bodyScroll}- contentContainerStyle={styles.bodyScrollContent}+ style={[styles.bodyScroll, geometricSingleLine && styles.bodyScrollCollapsed]}+ contentContainerStyle={[styles.bodyScrollContent, geometricSingleLine && styles.bodyScrollCollapsed]}keyboardShouldPersistTaps="handled"bounces={false}scrollEnabled={cardLayout && bodyScrollEnabled}@@ -755,6 +755,9 @@ const makeMobileComposerInputRowStyles = (colors: ThemeColors) => ({// otherwise keeps the old attachment height and absorbs input resize changes.bodyScroll: { flexGrow: 0, flexShrink: 1 },bodyScrollContent: { flexGrow: 0 },+ // 收起态胶囊(collapsedHeight)比 44pt 输入行高;viewport 与内容都要铺满胶囊,+ // mainRow 才能在胶囊里垂直居中,否则 + 与停止钮贴顶、比浮动语音钮偏上。+ bodyScrollCollapsed: { flexGrow: 1 },toolbarRow: {alignItems: 'center',flexDirection: 'row',