From bfe3cd01bc6b51d4d0882969ddb1133cf85c68ec Mon Sep 17 00:00:00 2001 From: Paige Sun Date: Thu, 25 Mar 2021 16:07:04 -0700 Subject: [PATCH] Log info when TurboModule cannot be found Summary: There are a surprisingly large number of nil modules in both bridge and bridgeless. So far, features may silently fail if a module is nil. We can't log with with console.error or console.warn because many tests will break even though modules aren't used in the test. Differential Revision: D27285601 fbshipit-source-id: 1467100f2a4c48e97de5dd6e846c26981c14f099 --- Libraries/TurboModule/TurboModuleRegistry.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Libraries/TurboModule/TurboModuleRegistry.js b/Libraries/TurboModule/TurboModuleRegistry.js index 105089391ce..c69f0f032ab 100644 --- a/Libraries/TurboModule/TurboModuleRegistry.js +++ b/Libraries/TurboModule/TurboModuleRegistry.js @@ -26,6 +26,10 @@ function requireModule(name: string): ?T { if (turboModuleProxy != null) { const module: ?T = turboModuleProxy(name); + if (module == null) { + // Common fixes: Verify the TurboModule is registered in the native binary, and adopts the code generated type-safe Spec base class. + console.info('Unable to get iOS TurboModule for ' + name + '.'); + } return module; }