Permalink
Browse files

Allow overrides of NativeModules

Reviewed By: mhorowitz

Differential Revision: D4764126

fbshipit-source-id: 036f848f8b3debbb3cc4a34fc99044304615760e
  • Loading branch information...
javache authored and facebook-github-bot committed Mar 24, 2017
1 parent de8ce45 commit ff7fb6efda0418752302cfa461ade600e636943b
Showing with 3 additions and 2 deletions.
  1. +3 −2 ReactCommon/cxxreact/JSCNativeModules.cpp
@@ -12,7 +12,7 @@ JSCNativeModules::JSCNativeModules(std::shared_ptr<ModuleRegistry> moduleRegistr
JSValueRef JSCNativeModules::getModule(JSContextRef context, JSStringRef jsName) {
if (!m_moduleRegistry) {
return Value::makeUndefined(context);
return nullptr;
}
std::string moduleName = String::ref(context, jsName).str();
@@ -24,7 +24,8 @@ JSValueRef JSCNativeModules::getModule(JSContextRef context, JSStringRef jsName)
auto module = createModule(moduleName, context);
if (!module.hasValue()) {
return Value::makeUndefined(context);
// Allow lookup to continue in the objects own properties, which allows for overrides of NativeModules
return nullptr;
}
// Protect since we'll be holding on to this value, even though JS may not

0 comments on commit ff7fb6e

Please sign in to comment.