How to get this work, in the simplest way, I have trouble getting the callback send to react-native, probably I'm missing something.
@ReactMethod
public void testCallback(Callback cb) {
String sampleText = "Java is fun";
int textLength = sampleText.length();
try{
cb.invoke(textLength);
}catch (Exception e){
cb.invoke("err");
}
}
On react-native side
var getNativeCallback = require('react-native-native-callback');
getNativeCallback.testCallback(function (result){
console.log(result)
})