react-native-wear-connectivity icon indicating copy to clipboard operation
react-native-wear-connectivity copied to clipboard

RuntimeException: Illegal callback invocation from native module

Open furlupe opened this issue 7 months ago • 0 comments

First of all, thank you for the library - it has been a good help in my apps! :)

But, sometimes I see a crash right after calling sendMessage:

java.lang.RuntimeException: Illegal callback invocation from native module. This callback type only permits a single invocation from native code.
    at com.facebook.react.bridge.CallbackImpl.invoke(CallbackImpl.java:26)
    at com.wearconnectivity.WearConnectivityModule.lambda$sendMessageToClient$0(WearConnectivityModule.java:107)
    at com.wearconnectivity.WearConnectivityModule$$ExternalSyntheticLambda0.onSuccess
    at com.google.android.gms.tasks.zzm.run(com.google.android.gms:play-services-tasks@@18.1.0:1)
    at android.os.Handler.handleCallback(Handler.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:246)
    at android.app.ActivityThread.main(ActivityThread.java:8653)
    at java.lang.reflect.Method.invoke(Method.java)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)

Unfortunately, I couldn't come up with a reproducible example, since it looks like it's happening during some obscure re-rendering or whatnot.

As far as I understand, the error rises when calling onSuccess \ onFailure callbacks (which are provided to the sendMessage method) from native side.

What could be done in that case? It does not occur often, but I still would like to get rid of it :) Thanks in advance!

furlupe avatar Mar 26 '25 06:03 furlupe