Home / Function/ getListener() — react Function Reference

getListener() — react Function Reference

Architecture documentation for the getListener() function in ReactNativeGetListener.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  2d91c4ed_9a58_6013_5118_49d8f98f9453["getListener()"]
  5f61475e_65e9_53ee_1eeb_f357a8fb2b93["ReactNativeGetListener.js"]
  2d91c4ed_9a58_6013_5118_49d8f98f9453 -->|defined in| 5f61475e_65e9_53ee_1eeb_f357a8fb2b93
  c558c9dd_a1dc_db67_3703_eedad8d98d20["listenerAtPhase()"]
  c558c9dd_a1dc_db67_3703_eedad8d98d20 -->|calls| 2d91c4ed_9a58_6013_5118_49d8f98f9453
  6121a217_2e4b_768e_aac8_fc53edf5823b["accumulateDispatches()"]
  6121a217_2e4b_768e_aac8_fc53edf5823b -->|calls| 2d91c4ed_9a58_6013_5118_49d8f98f9453
  style 2d91c4ed_9a58_6013_5118_49d8f98f9453 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-native-renderer/src/ReactNativeGetListener.js lines 14–37

export default function getListener(
  inst: Fiber,
  registrationName: string,
): Function | null {
  const stateNode = inst.stateNode;
  if (stateNode === null) {
    // Work in progress (ex: onload events in incremental mode).
    return null;
  }
  const props = getFiberCurrentPropsFromNode(stateNode);
  if (props === null) {
    // Work in progress.
    return null;
  }
  const listener = props[registrationName];

  if (listener && typeof listener !== 'function') {
    throw new Error(
      `Expected \`${registrationName}\` listener to be a function, instead got a value of \`${typeof listener}\` type.`,
    );
  }

  return listener;
}

Domain

Subdomains

Frequently Asked Questions

What does getListener() do?
getListener() is a function in the react codebase, defined in packages/react-native-renderer/src/ReactNativeGetListener.js.
Where is getListener() defined?
getListener() is defined in packages/react-native-renderer/src/ReactNativeGetListener.js at line 14.
What calls getListener()?
getListener() is called by 2 function(s): accumulateDispatches, listenerAtPhase.

Analyze Your Own Codebase

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

Try Supermodel Free