Home / Function/ dispatchCommand() — react Function Reference

dispatchCommand() — react Function Reference

Architecture documentation for the dispatchCommand() function in ReactNativePublicCompat.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  7abbd0a7_571f_d7ae_06ae_e1b558f06ff3["dispatchCommand()"]
  c8cde18a_a62b_2ad5_9e88_a5d655a07f02["ReactNativePublicCompat.js"]
  7abbd0a7_571f_d7ae_06ae_e1b558f06ff3 -->|defined in| c8cde18a_a62b_2ad5_9e88_a5d655a07f02
  style 7abbd0a7_571f_d7ae_06ae_e1b558f06ff3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-native-renderer/src/ReactNativePublicCompat.js lines 162–188

export function dispatchCommand(
  handle: any,
  command: string,
  args: Array<any>,
) {
  const nativeTag =
    handle._nativeTag != null
      ? handle._nativeTag
      : getNativeTagFromPublicInstance(handle);
  if (nativeTag == null) {
    if (__DEV__) {
      console.error(
        "dispatchCommand was called with a ref that isn't a " +
          'native component. Use React.forwardRef to get access to the underlying native component',
      );
    }
    return;
  }

  const node = getNodeFromPublicInstance(handle);

  if (node != null) {
    nativeFabricUIManager.dispatchCommand(node, command, args);
  } else {
    UIManager.dispatchViewManagerCommand(nativeTag, command, args);
  }
}

Domain

Subdomains

Frequently Asked Questions

What does dispatchCommand() do?
dispatchCommand() is a function in the react codebase, defined in packages/react-native-renderer/src/ReactNativePublicCompat.js.
Where is dispatchCommand() defined?
dispatchCommand() is defined in packages/react-native-renderer/src/ReactNativePublicCompat.js at line 162.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free