diff --git a/src/screens/PostThread/index.tsx b/src/screens/PostThread/index.tsx index 21a3a1dbbd..f0b68a2e1c 100644 --- a/src/screens/PostThread/index.tsx +++ b/src/screens/PostThread/index.tsx @@ -110,16 +110,19 @@ export function Inner({uri}: {uri: string | undefined}) { * handler scrolls the `List` to the top of the highlighted post after * parents are prepended, offset by any fixed elements like the header. */ - const hasScrolledToAnchor = useRef(false) + { + /* const hasScrolledToAnchor = useRef(false) */ + } const onContentSizeChangeWebOnly = web(() => { const anchorElement = anchorRef.current as any as Element const headerElement = headerRef.current as any as Element if ( anchorElement && headerElement && - !deferParents && - !hasScrolledToAnchor.current + !deferParents + //!hasScrolledToAnchor.current ) { + console.log('HANDLE') // distance from top of the list (screen) const anchorOffsetTop = anchorElement.getBoundingClientRect().top const headerHeight = headerElement.getBoundingClientRect().height @@ -131,11 +134,20 @@ export function Inner({uri}: {uri: string | undefined}) { * at all. */ if (scrollPosition >= headerHeight) { + console.log('Scrolling to anchor post at', scrollPosition) listRef.current?.scrollToOffset({ animated: false, offset: scrollPosition, }) - hasScrolledToAnchor.current = true + { + /* hasScrolledToAnchor.current = true */ + } + } else { + console.log('Scrolling to first position') + listRef.current?.scrollToOffset({ + animated: false, + offset: headerHeight * -1, + }) } } })