fix: reader for first and last page should not continue on next and first pages
This commit is contained in:
@@ -98,6 +98,7 @@ export const usePageNavigation = ({
|
|||||||
);
|
);
|
||||||
|
|
||||||
const handlePreviousPage = useCallback(() => {
|
const handlePreviousPage = useCallback(() => {
|
||||||
|
if (currentPage === 1) return;
|
||||||
if (isDoublePage && shouldShowDoublePage(currentPage - 2)) {
|
if (isDoublePage && shouldShowDoublePage(currentPage - 2)) {
|
||||||
navigateToPage(Math.max(1, currentPage - 2));
|
navigateToPage(Math.max(1, currentPage - 2));
|
||||||
} else {
|
} else {
|
||||||
@@ -106,6 +107,7 @@ export const usePageNavigation = ({
|
|||||||
}, [currentPage, isDoublePage, navigateToPage, shouldShowDoublePage]);
|
}, [currentPage, isDoublePage, navigateToPage, shouldShowDoublePage]);
|
||||||
|
|
||||||
const handleNextPage = useCallback(() => {
|
const handleNextPage = useCallback(() => {
|
||||||
|
if (currentPage === pages.length) return;
|
||||||
if (isDoublePage && shouldShowDoublePage(currentPage)) {
|
if (isDoublePage && shouldShowDoublePage(currentPage)) {
|
||||||
navigateToPage(Math.min(pages.length, currentPage + 2));
|
navigateToPage(Math.min(pages.length, currentPage + 2));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user