Fixed JS crash on Android when requiring a native module that doesn't exist
Summary: public NativeModule getters call the nativeRequireModuleConfig function to lazily load a module if it's not already available, but this crashes on Android since the nativeRequireModuleConfig hook hasn't been implemented yet. This diff checks that the hook exists before calling it. Reviewed By: gsaraf Differential Revision: D2744080 fb-gh-sync-id: cae9c8c45a4d3c80ceb8c10f3d4d59a8d9d3c7f8
This commit is contained in:
parent
7f710f9050
commit
ec5ca67044
|
@ -44,7 +44,7 @@ Object.keys(RemoteModules).forEach((moduleName) => {
|
|||
enumerable: true,
|
||||
get: () => {
|
||||
let module = RemoteModules[moduleName];
|
||||
if (module && module.moduleID) {
|
||||
if (module && module.moduleID && global.nativeRequireModuleConfig) {
|
||||
const json = global.nativeRequireModuleConfig(moduleName);
|
||||
const config = json && JSON.parse(json);
|
||||
module = config && BatchedBridge.processModuleConfig(config, module.moduleID);
|
||||
|
|
Loading…
Reference in New Issue