mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Use registerCallableModule consistently (#48238)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/48238 Use the helper module we have, which has better type-safety and less code duplication. Changelog: [Internal] Reviewed By: fabriziocucci Differential Revision: D67139572 fbshipit-source-id: 39ae9119d97f937b30ad6e7451468cbb3cc37a84
This commit is contained in:
committed by
Facebook GitHub Bot
parent
c06f13e7fb
commit
8fc4e8b35b
+1
-12
@@ -10,18 +10,7 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
let registerModule;
|
||||
if (global.RN$Bridgeless === true && global.RN$registerCallableModule) {
|
||||
registerModule = global.RN$registerCallableModule;
|
||||
} else {
|
||||
const BatchedBridge = require('../BatchedBridge/BatchedBridge');
|
||||
registerModule = (
|
||||
moduleName: string,
|
||||
/* $FlowFixMe[missing-local-annot] The type annotation(s) required by
|
||||
* Flow's LTI update could not be added via codemod */
|
||||
factory,
|
||||
) => BatchedBridge.registerLazyCallableModule(moduleName, factory);
|
||||
}
|
||||
import registerModule from './registerCallableModule';
|
||||
|
||||
registerModule('Systrace', () => require('../Performance/Systrace'));
|
||||
if (!(global.RN$Bridgeless === true)) {
|
||||
|
||||
@@ -10,15 +10,11 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
const BatchedBridge = require('../BatchedBridge/BatchedBridge');
|
||||
import registerCallableModule from '../Core/registerCallableModule';
|
||||
|
||||
const RCTEventEmitter = {
|
||||
register(eventEmitter: any) {
|
||||
if (global.RN$Bridgeless) {
|
||||
global.RN$registerCallableModule('RCTEventEmitter', () => eventEmitter);
|
||||
} else {
|
||||
BatchedBridge.registerCallableModule('RCTEventEmitter', eventEmitter);
|
||||
}
|
||||
registerCallableModule('RCTEventEmitter', eventEmitter);
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user