Import dispatchCommand utility from the right Renderer module

Summary:
With the new architecture, this module should be using the implementation from ReactFabric instead. However, given the ReactNative module had side effects (like registering `RCTEventEmitter`), let's import from ReactFabric only in the latest "new architecture" mode.

Changelog: [Internal]

Reviewed By: TheSavior

Differential Revision: D36535626

fbshipit-source-id: 6758b671df9a47607d8caf4a021ac73410f4c6e9
This commit is contained in:
Kevin Gozali 2022-05-19 20:54:48 -07:00 коммит произвёл Facebook GitHub Bot
Родитель 0fc42fd35c
Коммит 4ec75b1797
1 изменённых файлов: 10 добавлений и 1 удалений

Просмотреть файл

@ -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<T = string> = $ReadOnly<{|
supportedCommands: $ReadOnlyArray<T>,