fix(mobile): anchor chat history below paging header

This commit is contained in:
Brennan Benson
2026-08-03 20:19:35 -07:00
parent 7d4686ded6
commit e362e5beb2
2 changed files with 3 additions and 3 deletions
@@ -236,6 +236,7 @@ describe('MobileNativeChatView', () => {
await update({ messages: [current], hasMore: true, loadingEarlier: true })
await update({ messages: [older, current], hasMore: false, loadingEarlier: false })
const list = renderer!.root.find((node) => node.type === 'FlatList')
expect(list.props.maintainVisibleContentPosition).toEqual({ minIndexForVisible: 1 })
act(() => list.props.onContentSizeChange())
await act(async () => vi.runAllTimersAsync())
+2 -3
View File
@@ -303,9 +303,8 @@ export function MobileNativeChatView({
contentContainerStyle={styles.listContent}
onScroll={onScroll}
scrollEventThrottle={32}
// Anchor the viewport to the first visible row so a loadEarlier
// prepend grows the list upward instead of jumping the reader.
maintainVisibleContentPosition={{ minIndexForVisible: 0 }}
// Skip the load-earlier header so the first visible message stays anchored.
maintainVisibleContentPosition={{ minIndexForVisible: 1 }}
onContentSizeChange={() => {
if (data.length > 0 && atBottom && !keepHistoryPosition) {
listRef.current?.scrollToEnd({ animated: false })