0

Hello friends i want to create library for native module call so below is my code

Mylib is my library project in android

package com.reactlibrary;

import java.util.ArrayList;

public class RNMyLibModule extends ReactContextBaseJavaModule {

private final ReactApplicationContext reactContext;

public RNMyLibModule(ReactApplicationContext reactContext) {
super(reactContext);
this.reactContext = reactContext;
}

@ReactMethod
public void getTags(String qrcode, Callback errCallback, Callback succCallback) throws Throwable {
ArrayList<TagInfo> tagInfos;

tagInfos = parseTag();

try {
    succCallback.invoke(tagInfos);
}catch (IllegalViewOperationException e)
 {
  errCallback.invoke(e.getMessage());
  }
}

@Override
public String getName() {
return "RNMyLib";
  }
}

I call it from my js as below

MyLib.getTags("call", (msg) => {
  console.log("Error message " + msg)
}, (getTags) => {

  console.log("GET Tags in REact Native: "+getTags)
});

when i run above code i got error like "Can not connect argument of type class TagInfo"

any idea how can i solve this ? your all suggestions are appreciable.

Harshal Kalavadiya
  • 2,412
  • 4
  • 38
  • 71

0 Answers0