I’m developing a native module for Android in React Native. I have two method with the same name but I can’t use them in React Native because Java Script has not overloading directly. So I write a function which can get null as a paramater in React Native and try to handle it in Java.
React Native side:
function a(arg=null){
moduleName.b(arg)
}
Java side:
public void wrapper(@Nullable Boolean arg, final Promise promise){
if(arg == null){
c()
}else{
c(arg)
}
}
Then I have not problem when I pass true or false to function a but when I pass nothing to funtion a I get an error on my phone like that:
What is the problem?