mirror of
https://github.com/PrimalHQ/primal-web-app.git
synced 2024-10-03 02:10:55 +00:00
Fix thread scroll-to-position on iPhone
This commit is contained in:
parent
44cfa8f469
commit
5a9a062b64
@ -115,14 +115,21 @@ const Thread: Component = () => {
|
|||||||
if (!pn) return;
|
if (!pn) return;
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
const threadHeader = 72;
|
||||||
|
const iOSBanner = 54;
|
||||||
|
|
||||||
const rect = pn.getBoundingClientRect();
|
const rect = pn.getBoundingClientRect();
|
||||||
const wh = window.innerHeight - 72;
|
const wh = window.innerHeight - threadHeader;
|
||||||
|
|
||||||
const block = rect.height < wh && parentNotes().length > 0 ?
|
const block = rect.height < wh && parentNotes().length > 0 ?
|
||||||
'end' : 'start';
|
'end' : 'start';
|
||||||
|
|
||||||
pn.scrollIntoView({ block });
|
pn.scrollIntoView({ block });
|
||||||
block === 'start' && window.scrollBy({ top: -72 });
|
|
||||||
|
if (block === 'start') {
|
||||||
|
const moreScroll = threadHeader + (isIOS() ? iOSBanner : 0);
|
||||||
|
window.scrollBy({ top: -moreScroll });
|
||||||
|
}
|
||||||
}, 100);
|
}, 100);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user