Skip to content
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

Android: Native crash #868

Open
Anusha-mathur opened this issue Sep 16, 2024 · 6 comments
Open

Android: Native crash #868

Anusha-mathur opened this issue Sep 16, 2024 · 6 comments

Comments

@Anusha-mathur
Copy link

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.

  1. 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
Copy link

Im seeing the same thing here

@mahshid22
Copy link

Hi I have same problem here
when I change page number very quick, it crashes
Is there any solution?

@ferasabufaresKabi
Copy link

ferasabufaresKabi commented Oct 8, 2024

@Anusha-mathur
Hi How are you
did find any solution for this

@rajivchaulagain
Copy link

   <Pdf
          ref={pdfRef}
          trustAllCerts={false}
          source={{
            uri,
          }}
          onLoadProgress={(percent) => calculateLoadingProgress(percent)}
          style={{
            width,
            height,
          }}
          onPageSingleTap={(e, x, y) => handlePosition(e, x, y)}
          onLoadComplete={(numberOfPages, path, { height, width }) =>
            console.log(`height & width : ${height} ${width}`)
          }
        />

this is my implementation and I never got such error

@ferasabufaresKabi
Copy link

@rajivchaulagain thank you for your response i have figure out what is the problem and i have fix it

@TechLead18
Copy link

@rajivchaulagain thank you for your response i have figure out what is the problem and i have fix it

what was the issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants
@mahshid22 @griffinshuth @TechLead18 @rajivchaulagain @Anusha-mathur @ferasabufaresKabi and others