Prevent layout shifts in continuous pagers
I was unable to find a fix for this problem, thus, the only solution I see is disabling this functionality for the continuous readers. Due to preloading leading pages, the layout got shifted once the pages got loaded. This messed with the scroll position which caused the top of the scrolled into views pages to not be at the top of the viewport anymore.
This commit is contained in:
@@ -43,8 +43,15 @@ const BaseBasePager = ({
|
||||
}) => {
|
||||
const previousCurrentPageIndex = useRef(-1);
|
||||
const pagesIndexesToRender = useMemo(
|
||||
() => getPageIndexesToLoad(currentPageIndex, pages, previousCurrentPageIndex.current, imagePreLoadAmount),
|
||||
[currentPageIndex, pages, imagePreLoadAmount],
|
||||
() =>
|
||||
getPageIndexesToLoad(
|
||||
currentPageIndex,
|
||||
pages,
|
||||
previousCurrentPageIndex.current,
|
||||
imagePreLoadAmount,
|
||||
readingMode,
|
||||
),
|
||||
[currentPageIndex, pages, imagePreLoadAmount, readingMode],
|
||||
);
|
||||
useEffect(() => {
|
||||
previousCurrentPageIndex.current = currentPageIndex;
|
||||
|
||||
Reference in New Issue
Block a user