mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-02 09:21:44 +08:00
Allow overrides of NativeModules
Reviewed By: mhorowitz Differential Revision: D4764126 fbshipit-source-id: 036f848f8b3debbb3cc4a34fc99044304615760e
This commit is contained in:
committed by
Facebook Github Bot
parent
de8ce45258
commit
ff7fb6efda
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user