react-paginate icon indicating copy to clipboard operation
react-paginate copied to clipboard

marginPagesDisplayed when set to 0 shows break at the end

Open daanvdberg opened this issue 1 year ago • 0 comments

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: https://github.com/AdeleD/react-paginate/blob/98db5f7a456919caa0e050164800766f7ca7f2c4/react_components/PaginationBoxView.js#L470-L471

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!

daanvdberg avatar Feb 02 '23 14:02 daanvdberg