wonday / react-native-pdf

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

Tried to access a JS module before the React instance was fully set up. #836

Open akbaraditamasp opened 6 months ago

akbaraditamasp commented 6 months ago

What react-native version are you using? 0.74.1 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

2) Interesting logs ERROR Your app just crashed. See the error below. 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. com.facebook.react.bridge.ReactContext.getJSModule(ReactContext.java:180) org.wonday.pdf.PdfView.onPageChanged(PdfView.java:98) com.github.barteksc.pdfviewer.listener.Callbacks.callOnPageChange(Callbacks.java:123) com.github.barteksc.pdfviewer.PDFView.showPage(PDFView.java:382) com.github.barteksc.pdfviewer.PDFView.jumpTo(PDFView.java:359) com.github.barteksc.pdfviewer.PDFView.loadComplete(PDFView.java:833) com.github.barteksc.pdfviewer.DecodingAsyncTask.onPostExecute(DecodingAsyncTask.java:90) com.github.barteksc.pdfviewer.DecodingAsyncTask.onPostExecute(DecodingAsyncTask.java:27) android.os.AsyncTask.finish(AsyncTask.java:771) android.os.AsyncTask.-$$Nest$mfinish(Unknown Source:0) android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:788) android.os.Handler.dispatchMessage(Handler.java:107) android.os.Looper.loopOnce(Looper.java:232) android.os.Looper.loop(Looper.java:317) android.app.ActivityThread.main(ActivityThread.java:8628) java.lang.reflect.Method.invoke(Native Method) com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580) com.android.internal.os.ZygoteInit.main(ZygoteInit.java:878)

quany commented 5 months ago

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(SourceFile:21) at org.wonday.pdf.a.e(SourceFile:86) at y9.a.b(SourceFile:5) at com.github.barteksc.pdfviewer.e.T(SourceFile:60) at com.github.barteksc.pdfviewer.c.c(SourceFile:23) at com.github.barteksc.pdfviewer.c.onPostExecute(SourceFile:3) 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:224) at android.os.Looper.loop(Looper.java:318) at android.app.ActivityThread.main(ActivityThread.java:8772) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:561) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1013)

Eduardo-Queiroz commented 5 months ago

Its happening for me too

TraFost commented 5 months ago

do u guys have any solution?

akbaraditamasp commented 5 months ago

do u guys have any solution?

Nope, just use old architecture

TraFost commented 5 months ago

can u explain more? im really frustrated and dont know how to fix this

mianala commented 5 months ago

I guess we need to wait for the upgrade to react native New Architecture.

TraFost commented 5 months ago

do u have any suggestion what library/method i can use to show pdf? im new at react native i try to look up some libraries but some of them is deprecated

patphantuan251 commented 4 months ago

Its happening for me too

Anusha-mathur commented 2 months ago

@akbaraditamasp did you happen to find any solution? I am also facing the same issue after the react-native version upgrade.