This commit is contained in:
Eric Bailey
2025-05-02 13:52:29 -05:00
parent 269105371b
commit 59ab4f9668
6 changed files with 1737 additions and 3 deletions
+8
View File
@@ -90,6 +90,7 @@ type ThreadSkeletonParts = {
}
const keyExtractor = (item: RowItem) => {
console.log(item._reactKey)
return item._reactKey
}
@@ -257,6 +258,7 @@ export function PostThread({uri}: {uri: string | undefined}) {
fetchedAt,
randomCache,
])
console.log({thread, skeleton})
const error = React.useMemo(() => {
if (AppBskyFeedDefs.isNotFoundPost(thread)) {
@@ -338,8 +340,11 @@ export function PostThread({uri}: {uri: string | undefined}) {
const headerNode = headerRef.current
if (postNode && headerNode) {
let pageY = (postNode as any as Element).getBoundingClientRect().top
console.log({pageY})
pageY -= (headerNode as any as Element).getBoundingClientRect().height
console.log({pageY})
pageY = Math.max(0, pageY)
console.log({pageY})
ref.current?.scrollToOffset({
animated: false,
offset: pageY,
@@ -561,6 +566,9 @@ export function PostThread({uri}: {uri: string | undefined}) {
onEndReached={onEndReached}
onEndReachedThreshold={2}
onScrollToTop={onScrollToTop}
/**
* @see https://reactnative.dev/docs/scrollview#maintainvisiblecontentposition
*/
maintainVisibleContentPosition={
isNative && hasParents
? MAINTAIN_VISIBLE_CONTENT_POSITION