你好,我想为本机模块调用创建库,所以下面是我的代码
Mylib是我在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";
}
}
我从我的js中调用它
MyLib.getTags("call", (msg) => {
console.log("Error message " + msg)
}, (getTags) => {
console.log("GET Tags in REact Native: "+getTags)
});
当我运行上述代码时,出现类似“无法连接TagInfo类型的参数”的错误
你知道我该怎么解决吗?您的所有建议都是合理的。