mirror of
https://github.com/stablyai/orca.git
synced 2026-10-20 16:03:20 +00:00
fix(mobile): anchor chat history below paging header
This commit is contained in:
@@ -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())
|
||||
|
||||
|
||||
@@ -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 })
|
||||
|
||||
Reference in New Issue
Block a user