-
Notifications
You must be signed in to change notification settings - Fork 577
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
feat: add Fabric support #700
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 [email protected]