diff options
author | Samuel Newman <mozzius@protonmail.com> | 2025-06-20 22:19:48 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-06-20 14:19:48 -0500 |
commit | dcbcd1bb80b7f0c45cea93ed9c10d2b33ac2f0fa (patch) | |
tree | 412f31b165b34e69d62e8b24d35218ec4b50cb1e /src/screens | |
parent | 92ee6260c1f889f350b7138c4abd537bc4424abc (diff) | |
download | voidsky-dcbcd1bb80b7f0c45cea93ed9c10d2b33ac2f0fa.tar.zst |
simple heuristic for reducing footer height in thread (#8549)
Diffstat (limited to 'src/screens')
-rw-r--r-- | src/screens/PostThread/index.tsx | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/screens/PostThread/index.tsx b/src/screens/PostThread/index.tsx index a4f94851a..350fc41ae 100644 --- a/src/screens/PostThread/index.tsx +++ b/src/screens/PostThread/index.tsx @@ -54,13 +54,16 @@ export function PostThread({uri}: {uri: string}) { * One query to rule them all */ const thread = usePostThread({anchor: uri}) - const anchor = useMemo(() => { + const {anchor, hasParents} = useMemo(() => { + // eslint-disable-next-line @typescript-eslint/no-shadow + let hasParents = false for (const item of thread.data.items) { if (item.type === 'threadPost' && item.depth === 0) { - return item + return {anchor: item, hasParents} } + hasParents = true } - return + return {hasParents} }, [thread.data.items]) const {openComposer} = useOpenComposer() @@ -481,6 +484,8 @@ export function PostThread({uri}: {uri: string}) { ], ) + const defaultListFooterHeight = hasParents ? windowHeight - 200 : undefined + return ( <> <Layout.Header.Outer headerRef={headerRef}> @@ -537,8 +542,10 @@ export function PostThread({uri}: {uri: string}) { * back to the top of the screen when handling scroll. */ height={platform({ - web: windowHeight - 200, - default: deferParents ? windowHeight * 2 : windowHeight - 200, + web: defaultListFooterHeight, + default: deferParents + ? windowHeight * 2 + : defaultListFooterHeight, })} style={isTombstoneView ? {borderTopWidth: 0} : undefined} /> |