Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

marginPagesDisplayed when set to 0 shows break at the end #466

Open
daanvdberg opened this issue Feb 2, 2023 · 0 comments
Open

marginPagesDisplayed when set to 0 shows break at the end #466

daanvdberg opened this issue Feb 2, 2023 · 0 comments

Comments

@daanvdberg
Copy link

Hello,

Thanks for providing this library, I appreciate the effort. Not sure if this is really an issue, but I thought I'd raise an ticket nonetheless.

When setting marginPagesDisplayed to 0, I excepted the pagination to render like this:

rp2
rp1

<ReactPaginate
        pageRangeDisplayed={4}
        marginPagesDisplayed={0}
        onPageChange={handlePageClick}
        pageCount={pageCount}
        forcePage={page}
/>

Instead, there is a break at the end:

rp4
rp3

The issue seems to be coming from this line:

// We do not show break if only one active page is displayed.
(pageRangeDisplayed > 0 || marginPagesDisplayed > 0)

I reckon these two checks need to be separated:

// We do not show break if only one active page is displayed.
pageRangeDisplayed > 0 &&
marginPagesDisplayed > 0

Let me know if you'd like me to submit a PR!

@Noothan-am Noothan-am mentioned this issue Apr 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant