Home / Function/ getParent() — react Function Reference

getParent() — react Function Reference

Architecture documentation for the getParent() function in ResponderEventPlugin.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  5150711c_d8bc_1881_a612_f2d9f4cd1d44["getParent()"]
  674c6180_b91e_e17d_fb2d_40a6a3631bb3["ResponderEventPlugin.js"]
  5150711c_d8bc_1881_a612_f2d9f4cd1d44 -->|defined in| 674c6180_b91e_e17d_fb2d_40a6a3631bb3
  260a6097_933c_f093_faae_ae88bfab0cce["getLowestCommonAncestor()"]
  260a6097_933c_f093_faae_ae88bfab0cce -->|calls| 5150711c_d8bc_1881_a612_f2d9f4cd1d44
  ba0a3c44_5cde_86ea_d40b_036ef5700dd2["isAncestor()"]
  ba0a3c44_5cde_86ea_d40b_036ef5700dd2 -->|calls| 5150711c_d8bc_1881_a612_f2d9f4cd1d44
  0fe28570_d266_736a_8ea0_afbeec762b45["traverseTwoPhase()"]
  0fe28570_d266_736a_8ea0_afbeec762b45 -->|calls| 5150711c_d8bc_1881_a612_f2d9f4cd1d44
  725cfed5_d800_39aa_feef_3280555546d7["accumulateTwoPhaseDispatchesSingleSkipTarget()"]
  725cfed5_d800_39aa_feef_3280555546d7 -->|calls| 5150711c_d8bc_1881_a612_f2d9f4cd1d44
  style 5150711c_d8bc_1881_a612_f2d9f4cd1d44 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-native-renderer/src/legacy-events/ResponderEventPlugin.js lines 157–170

function getParent(inst) {
  do {
    inst = inst.return;
    // TODO: If this is a HostRoot we might want to bail out.
    // That is depending on if we want nested subtrees (layers) to bubble
    // events to their parent. We could also go through parentNode on the
    // host node but that wouldn't work for React Native and doesn't let us
    // do the portal feature.
  } while (inst && inst.tag !== HostComponent);
  if (inst) {
    return inst;
  }
  return null;
}

Domain

Subdomains

Frequently Asked Questions

What does getParent() do?
getParent() is a function in the react codebase, defined in packages/react-native-renderer/src/legacy-events/ResponderEventPlugin.js.
Where is getParent() defined?
getParent() is defined in packages/react-native-renderer/src/legacy-events/ResponderEventPlugin.js at line 157.
What calls getParent()?
getParent() is called by 4 function(s): accumulateTwoPhaseDispatchesSingleSkipTarget, getLowestCommonAncestor, isAncestor, traverseTwoPhase.

Analyze Your Own Codebase

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

Try Supermodel Free