Home / Function/ ScrollIntoViewCaseComplex() — react Function Reference

ScrollIntoViewCaseComplex() — react Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  96c2ac9d_c342_aef4_fd9e_e67ddc63264d["ScrollIntoViewCaseComplex()"]
  7486449c_3e36_bfbd_2139_9b76ff3b0f05["ScrollIntoViewCaseComplex.js"]
  96c2ac9d_c342_aef4_fd9e_e67ddc63264d -->|defined in| 7486449c_3e36_bfbd_2139_9b76ff3b0f05
  style 96c2ac9d_c342_aef4_fd9e_e67ddc63264d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

fixtures/dom/src/components/fixtures/fragment-refs/ScrollIntoViewCaseComplex.js lines 7–50

export default function ScrollIntoViewCaseComplex({
  caseInViewport,
  scrollContainerRef,
}) {
  const [didMount, setDidMount] = useState(false);
  // Hack to portal child into the scroll container
  // after the first render. This is to simulate a case where
  // an item is portaled into another scroll container.
  useEffect(() => {
    if (!didMount) {
      setDidMount(true);
    }
  }, []);
  return (
    <Fragment>
      {caseInViewport && (
        <div
          style={{position: 'fixed', top: 0, backgroundColor: 'red'}}
          id="header">
          Fixed header
        </div>
      )}
      {didMount &&
        ReactDOM.createPortal(
          <ScrollIntoViewTargetElement color="red" id="FROM_PORTAL" />,
          scrollContainerRef.current
        )}
      <ScrollIntoViewTargetElement color="lightgreen" id="A" />
      <ScrollIntoViewTargetElement color="lightcoral" id="B" />
      <ScrollIntoViewTargetElement color="lightblue" id="C" />
      {caseInViewport && (
        <div
          style={{
            position: 'fixed',
            bottom: 0,
            backgroundColor: 'purple',
          }}
          id="footer">
          Fixed footer
        </div>
      )}
    </Fragment>
  );
}

Domain

Subdomains

Frequently Asked Questions

What does ScrollIntoViewCaseComplex() do?
ScrollIntoViewCaseComplex() is a function in the react codebase, defined in fixtures/dom/src/components/fixtures/fragment-refs/ScrollIntoViewCaseComplex.js.
Where is ScrollIntoViewCaseComplex() defined?
ScrollIntoViewCaseComplex() is defined in fixtures/dom/src/components/fixtures/fragment-refs/ScrollIntoViewCaseComplex.js at line 7.

Analyze Your Own Codebase

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

Try Supermodel Free