Reputation: 344
I am trying to get values from my java module to my js but my callback funtion returns nothing.
My module method:
@ReactMethod
public void foo(Integer stateNum, Callback func){
final Integer num = stateNum;
final Callback funcCallback = func;
try{
funcCallback.invoke(num);
}catch (Exception e){}
}
Then I call it on my js:
showTest = () => {
55,
test.foo( (num) => {
this.setState({ number1: num, number2: 200 })
} );
}
So, when I run the showTest
function, the state number1
is not updated but state number2
becomes 200, since I passed the value 200 directly from my js code. What is wrong with my code?
Upvotes: 1
Views: 247
Reputation: 344
I was passing the argument at the wrong place and I also had forgoten to recompile the whole project. The application wasn't warning me about the arguments because I was simply reloading it instead of recompiling it.
Upvotes: 1