Conversation
It seems like in some cases, Yoga (I think) will measure the view only along one axis first, resulting in `onSizeChanged` being called with either w or h set to zero. This in turn starts the rendering of the pdf under the hood with one dimension being set to zero and the follow-up call to `onSizeChanged` with the correct dimensions doesn't have any effect on the already started process. The offending class is [DecodingAsyncTask](https://github.com/barteksc/AndroidPdfViewer/blob/d243b39377f19c3eae41e227067da254ebbf731b/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/DecodingAsyncTask.java#L68), which tries to get width and height of the `PdfView` in the constructor, and is [created](https://github.com/barteksc/AndroidPdfViewer/blob/d243b39377f19c3eae41e227067da254ebbf731b/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/PDFView.java#L279) as soon as the measurement is complete (relevant lines [here](https://github.com/barteksc/AndroidPdfViewer/blob/d243b39377f19c3eae41e227067da254ebbf731b/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/PDFView.java#L1525-L1528) and [here](https://github.com/barteksc/AndroidPdfViewer/blob/d243b39377f19c3eae41e227067da254ebbf731b/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/PDFView.java#L482-L484)), which in some cases may be incomplete as described above. By delaying calling `super.onSizeChanged` until the size in both dimensions is correct we are able to prevent this from happening.
|
Hello @WoLewicki , just want to thanks for your development work. I have tried to using |
|
Hello, @wonday . Do you have any plans to release a new version of the library? I was thinking it might be a good idea to prepare a pull request for the minor version bump, let me know if there's anything we can do to help. Thanks for your time! |
@WoLewicki, same sentiment here. Thank you for this PR. Had an app breaking on me with the PDF when I migrated to RN Installed via # terminal
yarn add https://github.com/wonday/react-native-pdf.git#master# package.json
"react-native-pdf": "https://github.com/wonday/react-native-pdf.git#master", |
PR adding New Architecture support to the library 🎉
We at Software Mansion have been working on improving support for the new architecture for quite a while now. If you need help with anything related to New Architecture, like:
or you just want to ask any questions, hit us up on projects@swmansion.com