Skip to content

Android crash - @ReactMethod setup - promise.resolve(this) #216

@crherman7

Description

@crherman7

If a case scenario presents itself where the code hits this conditional the promise.resolve(this) causes the following crash:

E/unknown:ReactNative: Exception in native call
    java.lang.RuntimeException: Cannot convert argument of type class com.segment.analytics.reactnative.core.RNAnalyticsModule
        at com.facebook.react.bridge.Arguments.fromJavaArgs(Arguments.java:181)
        at com.facebook.react.bridge.CallbackImpl.invoke(CallbackImpl.java:30)
        at com.facebook.react.bridge.PromiseImpl.resolve(PromiseImpl.java:55)
        at com.segment.analytics.reactnative.core.RNAnalyticsModule.setup(RNAnalyticsModule.kt:116)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:371)
        at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:150)
        at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
        at android.os.Handler.handleCallback(Handler.java:789)
        at android.os.Handler.dispatchMessage(Handler.java:98)
        at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:26)
        at android.os.Looper.loop(Looper.java:164)
        at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:225)
        at java.lang.Thread.run(Thread.java:764)

I don't believe it should be resolving the class instance this - as this is not readable by the react-native bridge. Any idea why it would be resolving promise.resolve(this)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions