react-native-pdf
react-native-pdf copied to clipboard
onPageChanged bug
What react-native version are you using?
0.70.5
What react-native-pdf version are you using?
^6.6.2
What platform does your issue occur on? (android/ios/both) both
Describe your issue as precisely as possible :
I had notice this issue opening a horizontal pdf with only 2 pages but this hapens with any pdf.
I've tryed setting enablePaging but doesn't fix too
With onPageChange event I've created a function to log current page and total pages, what I noticed is:
- When the pdf opens it logs
current 1, total X, if you change to page 2 the log repeatscurrent 1, total Xand if you go to page 3 it logscurrent 3, total X. I also noticed the logs are beeing duplicated after the second log of page 1. Changing pages back gives an error, the page count goes to a very high number before reach page 1 again
Join a screenshot or video of the problem on the simulator or device?

Show us the code you are using?
<Pdf
trustAllCerts={ false }
source={ {
uri: documentUrl,
cache: true
} }
style={ S.Pdf }
enablePaging
onPageChanged={ (
page,
numberOfPages
) => {
console.log( 'current', page, 'total', numberOfPages )
if ( documentReaded ) return
setDocumentReaded( () => page === numberOfPages )
} }
onError={ () => console.log('error .....')}
/>
I think this project is abandoned....