Home / Function/ setResponderAndExtractTransfer() — react Function Reference

setResponderAndExtractTransfer() — react Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  732fb477_d858_94a9_efff_34067b22778c["setResponderAndExtractTransfer()"]
  674c6180_b91e_e17d_fb2d_40a6a3631bb3["ResponderEventPlugin.js"]
  732fb477_d858_94a9_efff_34067b22778c -->|defined in| 674c6180_b91e_e17d_fb2d_40a6a3631bb3
  8f2d8ef0_4fcf_28f9_e399_4b0f1d11c533["ResponderEventPlugin.extractEvents()"]
  8f2d8ef0_4fcf_28f9_e399_4b0f1d11c533 -->|calls| 732fb477_d858_94a9_efff_34067b22778c
  60f92383_40f2_196e_b450_7c99b0331648["isStartish()"]
  732fb477_d858_94a9_efff_34067b22778c -->|calls| 60f92383_40f2_196e_b450_7c99b0331648
  d2f15c72_7981_85cf_294a_267ee76fc3ed["isMoveish()"]
  732fb477_d858_94a9_efff_34067b22778c -->|calls| d2f15c72_7981_85cf_294a_267ee76fc3ed
  260a6097_933c_f093_faae_ae88bfab0cce["getLowestCommonAncestor()"]
  732fb477_d858_94a9_efff_34067b22778c -->|calls| 260a6097_933c_f093_faae_ae88bfab0cce
  ae88e298_3c16_8765_dcc2_3ea04fedf8d1["accumulateTwoPhaseDispatchesSkipTarget()"]
  732fb477_d858_94a9_efff_34067b22778c -->|calls| ae88e298_3c16_8765_dcc2_3ea04fedf8d1
  c17cc2cd_9efa_0533_6697_b34f304c21d8["accumulateTwoPhaseDispatches()"]
  732fb477_d858_94a9_efff_34067b22778c -->|calls| c17cc2cd_9efa_0533_6697_b34f304c21d8
  5c1bdf7c_1cc3_dfb2_4d64_5824b3570c9e["executeDispatchesInOrderStopAtTrue()"]
  732fb477_d858_94a9_efff_34067b22778c -->|calls| 5c1bdf7c_1cc3_dfb2_4d64_5824b3570c9e
  6a3c9a58_5bc7_e210_0093_952da985582c["accumulateDirectDispatches()"]
  732fb477_d858_94a9_efff_34067b22778c -->|calls| 6a3c9a58_5bc7_e210_0093_952da985582c
  87ca11ba_f1b0_34e6_deb2_620dc868ac55["executeDirectDispatch()"]
  732fb477_d858_94a9_efff_34067b22778c -->|calls| 87ca11ba_f1b0_34e6_deb2_620dc868ac55
  c0661814_ea11_4240_4b04_d01f8f70bd9a["hasDispatches()"]
  732fb477_d858_94a9_efff_34067b22778c -->|calls| c0661814_ea11_4240_4b04_d01f8f70bd9a
  fa39eed9_fdc7_2de9_92c9_3e38cd92076b["changeResponder()"]
  732fb477_d858_94a9_efff_34067b22778c -->|calls| fa39eed9_fdc7_2de9_92c9_3e38cd92076b
  style 732fb477_d858_94a9_efff_34067b22778c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-native-renderer/src/legacy-events/ResponderEventPlugin.js lines 536–635

function setResponderAndExtractTransfer(
  topLevelType,
  targetInst,
  nativeEvent,
  nativeEventTarget,
) {
  const shouldSetEventType = isStartish(topLevelType)
    ? eventTypes.startShouldSetResponder
    : isMoveish(topLevelType)
      ? eventTypes.moveShouldSetResponder
      : topLevelType === TOP_SELECTION_CHANGE
        ? eventTypes.selectionChangeShouldSetResponder
        : eventTypes.scrollShouldSetResponder;

  // TODO: stop one short of the current responder.
  const bubbleShouldSetFrom = !responderInst
    ? targetInst
    : getLowestCommonAncestor(responderInst, targetInst);

  // When capturing/bubbling the "shouldSet" event, we want to skip the target
  // (deepest ID) if it happens to be the current responder. The reasoning:
  // It's strange to get an `onMoveShouldSetResponder` when you're *already*
  // the responder.
  const skipOverBubbleShouldSetFrom = bubbleShouldSetFrom === responderInst;
  const shouldSetEvent = ResponderSyntheticEvent.getPooled(
    shouldSetEventType,
    bubbleShouldSetFrom,
    nativeEvent,
    nativeEventTarget,
  );
  shouldSetEvent.touchHistory = ResponderTouchHistoryStore.touchHistory;
  if (skipOverBubbleShouldSetFrom) {
    accumulateTwoPhaseDispatchesSkipTarget(shouldSetEvent);
  } else {
    accumulateTwoPhaseDispatches(shouldSetEvent);
  }
  const wantsResponderInst = executeDispatchesInOrderStopAtTrue(shouldSetEvent);
  if (!shouldSetEvent.isPersistent()) {
    shouldSetEvent.constructor.release(shouldSetEvent);
  }

  if (!wantsResponderInst || wantsResponderInst === responderInst) {
    return null;
  }
  let extracted;
  const grantEvent = ResponderSyntheticEvent.getPooled(
    eventTypes.responderGrant,
    wantsResponderInst,
    nativeEvent,
    nativeEventTarget,
  );
  grantEvent.touchHistory = ResponderTouchHistoryStore.touchHistory;

  accumulateDirectDispatches(grantEvent);
  const blockHostResponder = executeDirectDispatch(grantEvent) === true;
  if (responderInst) {
    const terminationRequestEvent = ResponderSyntheticEvent.getPooled(
      eventTypes.responderTerminationRequest,
      responderInst,
      nativeEvent,
      nativeEventTarget,
    );
    terminationRequestEvent.touchHistory =
      ResponderTouchHistoryStore.touchHistory;
    accumulateDirectDispatches(terminationRequestEvent);
    const shouldSwitch =
      !hasDispatches(terminationRequestEvent) ||
      executeDirectDispatch(terminationRequestEvent);
    if (!terminationRequestEvent.isPersistent()) {
      terminationRequestEvent.constructor.release(terminationRequestEvent);
    }

    if (shouldSwitch) {
      const terminateEvent = ResponderSyntheticEvent.getPooled(
        eventTypes.responderTerminate,
        responderInst,
        nativeEvent,
        nativeEventTarget,
      );
      terminateEvent.touchHistory = ResponderTouchHistoryStore.touchHistory;
      accumulateDirectDispatches(terminateEvent);

Domain

Subdomains

Frequently Asked Questions

What does setResponderAndExtractTransfer() do?
setResponderAndExtractTransfer() is a function in the react codebase, defined in packages/react-native-renderer/src/legacy-events/ResponderEventPlugin.js.
Where is setResponderAndExtractTransfer() defined?
setResponderAndExtractTransfer() is defined in packages/react-native-renderer/src/legacy-events/ResponderEventPlugin.js at line 536.
What does setResponderAndExtractTransfer() call?
setResponderAndExtractTransfer() calls 10 function(s): accumulateDirectDispatches, accumulateTwoPhaseDispatches, accumulateTwoPhaseDispatchesSkipTarget, changeResponder, executeDirectDispatch, executeDispatchesInOrderStopAtTrue, getLowestCommonAncestor, hasDispatches, and 2 more.
What calls setResponderAndExtractTransfer()?
setResponderAndExtractTransfer() is called by 1 function(s): ResponderEventPlugin.extractEvents.

Analyze Your Own Codebase

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

Try Supermodel Free