TM iOS C++: don't throw if a method is not found
Summary: Let JS decide if a missing method should be treated as an error, or whether it allows optional methods (e.g. methods that are only for android or for ios). Reviewed By: JoshuaGross Differential Revision: D14155799 fbshipit-source-id: 1e298b46a59761cf09e98147da885b1e9a9a675a
This commit is contained in:
Родитель
d53bfed9bb
Коммит
45288a0f63
|
@ -26,7 +26,8 @@ jsi::Value TurboModule::get(jsi::Runtime& runtime, const jsi::PropNameID& propNa
|
|||
std::string propNameUtf8 = propName.utf8(runtime);
|
||||
auto p = methodMap_.find(propNameUtf8);
|
||||
if (p == methodMap_.end()) {
|
||||
throw std::runtime_error("Function '" + propNameUtf8 + "' cannot be found on module: " + name_);
|
||||
// Method was not found, let JS decide what to do.
|
||||
return jsi::Value::undefined();
|
||||
}
|
||||
MethodMetadata meta = p->second;
|
||||
return jsi::Function::createFromHostFunction(
|
||||
|
|
Загрузка…
Ссылка в новой задаче