Compare commits

...

2 Commits

Author SHA1 Message Date
Samuel Newman d1fb10dce4 changed my mind on maintainVisibleContentPosition 2026-06-05 11:58:59 +03:00
Samuel Newman bd0852d0a2 fix feed scroll reset on device rotation
Remove the dead contentOffset prop from List and add
maintainVisibleContentPosition to anchor the visible item across
relayouts.

The negative contentOffset was originally paired with a matching
contentInset (web PR #230) so the first render sat flush under the
floating header. PR #2216 swapped the inset for a paddingTop style but
left the offset behind, where it's been dead on initial render since.
On rotation its value changes (it's partly derived from the top safe
-area inset), and RN re-applies it as an absolute scroll, snapping the
list. maintainVisibleContentPosition then keeps the visible post pinned
as items reflow to the new width.

APP-2315

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-05 11:50:00 +03:00
-3
View File
@@ -147,12 +147,10 @@ let List = forwardRef<ListMethods, ListProps>(
)
}
let contentOffset
if (headerOffset != null) {
style = addStyle(style, {
paddingTop: headerOffset,
})
contentOffset = {x: 0, y: headerOffset * -1}
}
return (
@@ -170,7 +168,6 @@ let List = forwardRef<ListMethods, ListProps>(
...props.scrollIndicatorInsets,
}}
indicatorStyle={t.scheme === 'dark' ? 'white' : 'black'}
contentOffset={contentOffset}
refreshControl={refreshControl}
onScroll={scrollHandler}
scrollsToTop={scrollsToTop}