Home / Function/ withVerticalScrollbarLayout() — react Function Reference

withVerticalScrollbarLayout() — react Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  e286e208_564c_fd3e_c601_e47312461d47["withVerticalScrollbarLayout()"]
  9d25a570_0086_154f_00bb_c5b100737b42["withVerticalScrollbarLayout.js"]
  e286e208_564c_fd3e_c601_e47312461d47 -->|defined in| 9d25a570_0086_154f_00bb_c5b100737b42
  style e286e208_564c_fd3e_c601_e47312461d47 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-devtools-timeline/src/view-base/vertical-scroll-overflow/withVerticalScrollbarLayout.js lines 15–55

export const withVerticalScrollbarLayout: Layouter = (
  layout,
  containerFrame,
) => {
  const [contentLayoutInfo, scrollbarLayoutInfo] = layout;

  const desiredContentSize = contentLayoutInfo.view.desiredSize();
  const shouldShowScrollbar =
    desiredContentSize.height > containerFrame.size.height;
  const scrollbarWidth = shouldShowScrollbar
    ? scrollbarLayoutInfo.view.desiredSize().width
    : 0;

  const laidOutContentLayoutInfo: LayoutInfo = {
    ...contentLayoutInfo,
    frame: {
      origin: contentLayoutInfo.view.frame.origin,
      size: {
        width: containerFrame.size.width - scrollbarWidth,
        height: containerFrame.size.height,
      },
    },
  };
  const laidOutScrollbarLayoutInfo: LayoutInfo = {
    ...scrollbarLayoutInfo,
    frame: {
      origin: {
        x:
          laidOutContentLayoutInfo.frame.origin.x +
          laidOutContentLayoutInfo.frame.size.width,
        y: containerFrame.origin.y,
      },
      size: {
        width: scrollbarWidth,
        height: containerFrame.size.height,
      },
    },
  };

  return [laidOutContentLayoutInfo, laidOutScrollbarLayoutInfo];
};

Domain

Subdomains

Frequently Asked Questions

What does withVerticalScrollbarLayout() do?
withVerticalScrollbarLayout() is a function in the react codebase, defined in packages/react-devtools-timeline/src/view-base/vertical-scroll-overflow/withVerticalScrollbarLayout.js.
Where is withVerticalScrollbarLayout() defined?
withVerticalScrollbarLayout() is defined in packages/react-devtools-timeline/src/view-base/vertical-scroll-overflow/withVerticalScrollbarLayout.js at line 15.

Analyze Your Own Codebase

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

Try Supermodel Free