Skip to content

Module exports two methods to JavaScript with the same name #857

@kesherai

Description

@kesherai

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the project I'm working on.

The android build, using react-native 0.81.1, was crashing due to this error:
Unable to parse @ReactMethod annotations from native module: RNCallKeep. Details: Module exports two methods to JavaScript with the same name: "displayIncomingCall
Turns out that using the new architecture, you can't expose two functions with the same name, even if they have a different signature.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-callkeep/android/src/main/java/io/wazo/callkeep/RNCallKeepModule.java b/node_modules/react-native-callkeep/android/src/main/java/io/wazo/callkeep/RNCallKeepModule.java
index 025480a..2722d74 100644
--- a/node_modules/react-native-callkeep/android/src/main/java/io/wazo/callkeep/RNCallKeepModule.java
+++ b/node_modules/react-native-callkeep/android/src/main/java/io/wazo/callkeep/RNCallKeepModule.java
@@ -434,10 +434,10 @@ public class RNCallKeepModule extends ReactContextBaseJavaModule implements Life
         this.hasListeners = false;
     }
 
-    @ReactMethod
-    public void displayIncomingCall(String uuid, String number, String callerName) {
-        this.displayIncomingCall(uuid, number, callerName, false, null);
-    }
+    // @ReactMethod
+    // public void displayIncomingCall(String uuid, String number, String callerName) {
+    //     this.displayIncomingCall(uuid, number, callerName, false, null);
+    // }
 
     @ReactMethod
     public void displayIncomingCall(String uuid, String number, String callerName, boolean hasVideo) {
@@ -483,10 +483,10 @@ public class RNCallKeepModule extends ReactContextBaseJavaModule implements Life
         conn.onAnswer();
     }
 
-    @ReactMethod
-    public void startCall(String uuid, String number, String callerName) {
-        this.startCall(uuid, number, callerName, false, null);
-    }
+    // @ReactMethod
+    // public void startCall(String uuid, String number, String callerName) {
+    //     this.startCall(uuid, number, callerName, false, null);
+    // }
 
     @ReactMethod
     public void startCall(String uuid, String number, String callerName, boolean hasVideo) {

This issue body was partially generated by patch-package.

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