From de477a0df6da770e579892d4875a8995c430ebdf Mon Sep 17 00:00:00 2001 From: Lulu Wu Date: Fri, 23 Apr 2021 13:30:37 -0700 Subject: [PATCH] Register RCTEventEmitter as callable module for Venice Summary: ## Context Trying to fix this js error ``` com.facebook.errorreporting.lacrima.common.exception.LacrimaJavascriptException: Error: Module RCTEventEmitter has not been registered as callable. Did you forget to call `RN$registerCallableModule`?, js build: UNKNOWN ``` https://fburl.com/logview/fvc33d48 Changelog: [General][Changed] - Register RCTEventEmitter as callable module for Venice Reviewed By: PeteTheHeat Differential Revision: D27969226 fbshipit-source-id: 8e807ee5b2ef447b0bb49fa2107352d89584c181 --- Libraries/EventEmitter/RCTEventEmitter.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Libraries/EventEmitter/RCTEventEmitter.js b/Libraries/EventEmitter/RCTEventEmitter.js index 8001a7cf36a005..fd0ac72eaf9995 100644 --- a/Libraries/EventEmitter/RCTEventEmitter.js +++ b/Libraries/EventEmitter/RCTEventEmitter.js @@ -14,7 +14,11 @@ const BatchedBridge = require('../BatchedBridge/BatchedBridge'); const RCTEventEmitter = { register(eventEmitter: any) { - BatchedBridge.registerCallableModule('RCTEventEmitter', eventEmitter); + if (global.RN$Bridgeless) { + global.RN$registerCallableModule('RCTEventEmitter', () => eventEmitter); + } else { + BatchedBridge.registerCallableModule('RCTEventEmitter', eventEmitter); + } }, };