Skip to content

Commit ec5ca67

Browse files
nicklockwoodfacebook-github-bot-7
authored andcommitted
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
1 parent 7f710f9 commit ec5ca67

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Libraries/BatchedBridge/BatchedBridgedModules/NativeModules.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Object.keys(RemoteModules).forEach((moduleName) => {
4444
enumerable: true,
4545
get: () => {
4646
let module = RemoteModules[moduleName];
47-
if (module && module.moduleID) {
47+
if (module && module.moduleID && global.nativeRequireModuleConfig) {
4848
const json = global.nativeRequireModuleConfig(moduleName);
4949
const config = json && JSON.parse(json);
5050
module = config && BatchedBridge.processModuleConfig(config, module.moduleID);

0 commit comments

Comments
 (0)