diff --git a/Libraries/Utilities/codegenNativeCommands.js b/Libraries/Utilities/codegenNativeCommands.js index 0780fa762a..fe8e23944b 100644 --- a/Libraries/Utilities/codegenNativeCommands.js +++ b/Libraries/Utilities/codegenNativeCommands.js @@ -8,7 +8,16 @@ * @flow */ -import {dispatchCommand} from '../../Libraries/Renderer/shims/ReactNative'; +let dispatchCommand; +if (global.RN$Bridgeless) { + // Note: this function has the same implementation in the legacy and new renderer. + // However, evaluating the old renderer comes with some side effects. + dispatchCommand = + require('../../Libraries/Renderer/shims/ReactFabric').dispatchCommand; +} else { + dispatchCommand = + require('../../Libraries/Renderer/shims/ReactNative').dispatchCommand; +} type Options = $ReadOnly<{| supportedCommands: $ReadOnlyArray,