Home / File/ ReactNativeGetListener.js — react Source File

ReactNativeGetListener.js — react Source File

Architecture documentation for ReactNativeGetListener.js, a javascript file in the react codebase. 2 imports, 3 dependents.

File javascript BabelCompiler Validation 2 imports 3 dependents 1 functions

Entity Profile

Dependency Diagram

graph LR
  5f61475e_65e9_53ee_1eeb_f357a8fb2b93["ReactNativeGetListener.js"]
  c47175ea_4123_c4e5_c30d_de7506f00f3a["EventPluginUtils.js"]
  5f61475e_65e9_53ee_1eeb_f357a8fb2b93 --> c47175ea_4123_c4e5_c30d_de7506f00f3a
  42892443_e223_3da0_aeb9_e1b32a408fb0["ReactInternalTypes"]
  5f61475e_65e9_53ee_1eeb_f357a8fb2b93 --> 42892443_e223_3da0_aeb9_e1b32a408fb0
  846f0667_39ae_eb6e_55fe_26d3acf81e44["ReactFabricEventEmitter.js"]
  846f0667_39ae_eb6e_55fe_26d3acf81e44 --> 5f61475e_65e9_53ee_1eeb_f357a8fb2b93
  577670f6_1f7f_5e0d_b9b6_894b69a76a73["ReactNativeBridgeEventPlugin.js"]
  577670f6_1f7f_5e0d_b9b6_894b69a76a73 --> 5f61475e_65e9_53ee_1eeb_f357a8fb2b93
  baab5855_112a_37e6_6ca7_0813fd6ae027["ReactNativeEventEmitter.js"]
  baab5855_112a_37e6_6ca7_0813fd6ae027 --> 5f61475e_65e9_53ee_1eeb_f357a8fb2b93
  style 5f61475e_65e9_53ee_1eeb_f357a8fb2b93 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @flow
 */

import type {Fiber} from 'react-reconciler/src/ReactInternalTypes';

import {getFiberCurrentPropsFromNode} from './legacy-events/EventPluginUtils';

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

Functions

Dependencies

Frequently Asked Questions

What does ReactNativeGetListener.js do?
ReactNativeGetListener.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in ReactNativeGetListener.js?
ReactNativeGetListener.js defines 1 function(s): getListener.
What does ReactNativeGetListener.js depend on?
ReactNativeGetListener.js imports 2 module(s): EventPluginUtils.js, ReactInternalTypes.
What files import ReactNativeGetListener.js?
ReactNativeGetListener.js is imported by 3 file(s): ReactFabricEventEmitter.js, ReactNativeBridgeEventPlugin.js, ReactNativeEventEmitter.js.
Where is ReactNativeGetListener.js in the architecture?
ReactNativeGetListener.js is located at packages/react-native-renderer/src/ReactNativeGetListener.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-native-renderer/src).

Analyze Your Own Codebase

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

Try Supermodel Free