Comments (21)
I have downgrade version @6.7.2 its working fine
for me, it lead to a build issue. i used 6.7.3 and it seems fine. no crash
from react-native-pdf.
I was having the same issue. reinstalling the package with the latest one solved my crashing issue but then it was not crashing rather it was giving reactnativeblobutil error. by adding trustAllCerts={false} solved the not displaying pdf issue.
<PDFView
style={styles.pdfContainer}
source={{uri: link}}
onError={onError}
trustAllCerts={false}
/>
from react-native-pdf.
same issue
from react-native-pdf.
do you find anything?
from react-native-pdf.
+1
from react-native-pdf.
+1
from react-native-pdf.
I have the same issue when browsing fast between different unloaded PDFs and download does not have time to finish before I start fetching new PDF.
This is due to this code introduced and merged about 2 weeks ago. In index.js, line 279, with declaration of this.lastRNBFTask.
BAD CODE:
.catch(async (error) => {
this._onError(error);
});
comment it out and problem solved.
I am not an very experienced dev, but my guess is that the catch intercepts the cancel call that is supposed to be sent to ReactNativeBlobUtil and run its course there as it should, so instead it doesn't, and the code asks where the hell is my cancel method? Crash.
Well we caught the error before the cancel could do it's thing...
There is another similar catch on line 323. That one is fine, let it be.
from react-native-pdf.
from react-native-pdf.
Well, what do you want to do? For me, I had to have the app stop crashing when browsing fast between PDFs. The better approach for me was to comment out the recently introduced code (that I specified in last post).
from react-native-pdf.
from react-native-pdf.
I have downgrade version @6.7.2 its working fine
from react-native-pdf.
from react-native-pdf.
I have the same issue when browsing fast between different unloaded PDFs and download does not have time to finish before I start fetching new PDF.
This is due to this code introduced and merged about 2 weeks ago. In index.js, line 279, with declaration of this.lastRNBFTask.
BAD CODE: .catch(async (error) => { this._onError(error); });
comment it out and problem solved.
I am not an very experienced dev, but my guess is that the catch intercepts the cancel call that is supposed to be sent to ReactNativeBlobUtil and run its course there as it should, so instead it doesn't, and the code asks where the hell is my cancel method? Crash.
Well we caught the error before the cancel could do it's thing...
There is another similar catch on line 323. That one is fine, let it be.
I also have the same issue, when I press back button it arise the same error, then I saw your comment and try to do the same thing as you mentioned. But still it arise error. It didn't crash the app but arise error on the onError props, but I don't want to arise any error on the cancel. Then I commented out the below code on the line 146, and it works for me.
// componentWillUnmount() {
// this._mounted = false;
// if (this.lastRNBFTask) {
// this.lastRNBFTask.cancel(err => {
// });
// this.lastRNBFTask = null;
// }
// }
from react-native-pdf.
Also happening to me any way to solve? Happening on latest also. @shahid-0 how does one deploy with commented out code? Is that possible?
from react-native-pdf.
from react-native-pdf.
+1
This is a blocker and I can't update this package anymore
from react-native-pdf.
I have the same issue when browsing fast between different unloaded PDFs and download does not have time to finish before I start fetching new PDF.
This is due to this code introduced and merged about 2 weeks ago. In index.js, line 279, with declaration of this.lastRNBFTask.
BAD CODE: .catch(async (error) => { this._onError(error); });
comment it out and problem solved.
I am not an very experienced dev, but my guess is that the catch intercepts the cancel call that is supposed to be sent to ReactNativeBlobUtil and run its course there as it should, so instead it doesn't, and the code asks where the hell is my cancel method? Crash.
Well we caught the error before the cancel could do it's thing...
There is another similar catch on line 323. That one is fine, let it be.
Wow this is working really well. Spend alot of time on this issue and thank god u have solved my issue
from react-native-pdf.
I created this patch (patch-package) for avoid this crash:
react-native-pdf+6.7.4.patch
diff --git a/node_modules/react-native-pdf/index.js b/node_modules/react-native-pdf/index.js
index c7c58d8..70a6057 100644
--- a/node_modules/react-native-pdf/index.js
+++ b/node_modules/react-native-pdf/index.js
@@ -127,7 +127,7 @@ export default class Pdf extends Component {
if ((nextSource.uri !== curSource.uri)) {
// if has download task, then cancel it.
- if (this.lastRNBFTask) {
+ if (this.lastRNBFTask?.cancel) {
this.lastRNBFTask.cancel(err => {
this._loadFromSource(this.props.source);
});
@@ -145,7 +145,7 @@ export default class Pdf extends Component {
componentWillUnmount() {
this._mounted = false;
- if (this.lastRNBFTask) {
+ if (this.lastRNBFTask?.cancel) {
this.lastRNBFTask.cancel(err => {
});
this.lastRNBFTask = null;
@@ -250,7 +250,7 @@ export default class Pdf extends Component {
_downloadFile = async (source, cacheFile) => {
- if (this.lastRNBFTask) {
+ if (this.lastRNBFTask?.cancel) {
this.lastRNBFTask.cancel(err => {
});
this.lastRNBFTask = null;
from react-native-pdf.
Related Issues (20)
- package name missing from androidManifest causes pod install error HOT 3
- PDF preview issue in Android & iOS HOT 6
- import undefined.RNPDFPackage error with 6.7.3 HOT 5
- crypto-js is no longer maintained HOT 1
- 6.7.4 build issue HOT 1
- Please add lazy load function with large pdf file HOT 1
- import undefined.RNPDFPackage error HOT 4
- crypto-js 3.3.0 is vulnerable and please update to 4.2.0+ HOT 1
- Unable to load file from local file system HOT 1
- Unable to read online insecure PDF file HOT 3
- Double Tap on pdf Zoom disable Issue HOT 1
- Source file at path`xxxxxxxxxxxxxxxxxxxx.pdf.tmp` does not exist HOT 9
- iOS: 'yoga/style/Style.h' Not Found with New Architecture Enabled HOT 3
- Web platform fails to bundle when react-native-pdf component exists HOT 1
- FitPolicy does not work based on canvas width on iOS
- file not open
- Want To show every single page as in gridView for Selection purpose
- Android buld failed due to Caused by: org.gradle.api.internal.provider.AbstractProperty$PropertyQueryException: Failed to calculate the value of task ':react-native-pdf:processDebugManifest' property 'packageOverride'. HOT 1
- Scroll bar indicator not visible
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-pdf.