wonday / react-native-pdf

A <Pdf /> component for react-native
MIT License
1.59k stars 544 forks source link

Android: Native crash #868

Open Anusha-mathur opened 5 days ago

Anusha-mathur commented 5 days ago

What react-native version are you using? --> 0.74.5

What react-native-pdf version are you using? --> 6.7.5

What platform does your issue occur on? (android/ios/both) Android

Describe your issue as precisely as possible : 1) Steps to reproduce the issue or to explain in which case you get the issue

updated the app from 0.71 to 0.74.5 and PDF is not working after that. The app crashes as soon as the PDF finishes loading.

2) Interesting logs

java.lang.IllegalStateException: Tried to access a JS module before the React instance was fully set up. Calls to ReactContext#getJSModule should only happen once initialize() has been called on your native module. at com.facebook.react.bridge.ReactContext.getJSModule(ReactContext.java:180) at org.wonday.pdf.PdfView.loadComplete(PdfView.java:139) at com.github.barteksc.pdfviewer.listener.Callbacks.callOnLoadComplete(Callbacks.java:83) at com.github.barteksc.pdfviewer.PDFView.loadComplete(PDFView.java:831) at com.github.barteksc.pdfviewer.DecodingAsyncTask.onPostExecute(DecodingAsyncTask.java:90) at com.github.barteksc.pdfviewer.DecodingAsyncTask.onPostExecute(DecodingAsyncTask.java:27) at android.os.AsyncTask.finish(AsyncTask.java:771) at android.os.AsyncTask.-$$Nest$mfinish(Unknown Source:0) at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:788) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:205) at android.os.Looper.loop(Looper.java:294) at android.app.ActivityThread.main(ActivityThread.java:8177) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)

Join a screenshot or video of the problem on the simulator or device?

Show us the code you are using?

<Pdf trustAllCerts={false} source={source} fitWidth activityIndicator={} onLoadComplete={(numberOfPages, filePath) => console.log(number of pages: ${numberOfPages})} onPageChanged={(page, numberOfPages) => console.log(current page: ${page})} onError={(error) => { console.log(error); this.setPdfError(); }} onPressLink={(uri) => console.log(Link press: ${uri})} style={this.styles.pdf} />

griffinshuth commented 4 days ago

Im seeing the same thing here