appodeal / react-native-appodeal

Official React Native package that adds Appodeal SDK support to your react-native application.
https://appodeal.com
59 stars 37 forks source link

sendEventToJS() crashes on Android #82

Closed 90minutes closed 2 years ago

90minutes commented 3 years ago

Hi there!

First of all, thanks for the amazing work. Been using this for months in production. But there has been this issue since I first added Appodeal:

Fatal Exception: 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:148)
       at com.appodeal.rnappodeal.RNAppodealModule.sendEventToJS(RNAppodealModule.java:61)
       at com.appodeal.rnappodeal.RNAppodealModule.onInterstitialFailedToLoad(RNAppodealModule.java:460)
       at com.appodeal.ads.ap$a.a(:48)
       at com.appodeal.ads.an$a$1.run(:7)
       at android.os.Handler.handleCallback(Handler.java:873)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:216)
       at android.app.ActivityThread.main(ActivityThread.java:7266)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:975)

Would you please help with that?

staskochkin commented 3 years ago

Hello @90minutes, this commit should fix this issue

90minutes commented 3 years ago

Thank you!

90minutes commented 2 years ago

@staskochkin, can you please publish the changes on npm? Thanks!

staskochkin commented 2 years ago

@90minutes Changes has been added into 2.10.2 release.