ScrollIntoViewCaseComplex.js — react Source File
Architecture documentation for ScrollIntoViewCaseComplex.js, a javascript file in the react codebase. 2 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR 7486449c_3e36_bfbd_2139_9b76ff3b0f05["ScrollIntoViewCaseComplex.js"] 54fdfb71_d9cb_227f_9ddd_db85674e3758["ScrollIntoViewTargetElement.js"] 7486449c_3e36_bfbd_2139_9b76ff3b0f05 --> 54fdfb71_d9cb_227f_9ddd_db85674e3758 4b4658ce_d9f4_1bbb_1e0e_690781063dda["ScrollIntoViewTargetElement"] 7486449c_3e36_bfbd_2139_9b76ff3b0f05 --> 4b4658ce_d9f4_1bbb_1e0e_690781063dda 31c15496_1aa2_12cd_6859_37fdcdc9b145["ScrollIntoViewCase.js"] 31c15496_1aa2_12cd_6859_37fdcdc9b145 --> 7486449c_3e36_bfbd_2139_9b76ff3b0f05 style 7486449c_3e36_bfbd_2139_9b76ff3b0f05 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import ScrollIntoViewTargetElement from './ScrollIntoViewTargetElement';
const React = window.React;
const {Fragment, useRef, useState, useEffect} = React;
const ReactDOM = window.ReactDOM;
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
Functions
Source
Frequently Asked Questions
What does ScrollIntoViewCaseComplex.js do?
ScrollIntoViewCaseComplex.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Optimization subdomain.
What functions are defined in ScrollIntoViewCaseComplex.js?
ScrollIntoViewCaseComplex.js defines 1 function(s): ScrollIntoViewCaseComplex.
What does ScrollIntoViewCaseComplex.js depend on?
ScrollIntoViewCaseComplex.js imports 2 module(s): ScrollIntoViewTargetElement, ScrollIntoViewTargetElement.js.
What files import ScrollIntoViewCaseComplex.js?
ScrollIntoViewCaseComplex.js is imported by 1 file(s): ScrollIntoViewCase.js.
Where is ScrollIntoViewCaseComplex.js in the architecture?
ScrollIntoViewCaseComplex.js is located at fixtures/dom/src/components/fixtures/fragment-refs/ScrollIntoViewCaseComplex.js (domain: BabelCompiler, subdomain: Optimization, directory: fixtures/dom/src/components/fixtures/fragment-refs).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free