Home / File/ withVerticalScrollbarLayout.js — react Source File

withVerticalScrollbarLayout.js — react Source File

Architecture documentation for withVerticalScrollbarLayout.js, a javascript file in the react codebase. 1 imports, 1 dependents.

File javascript BabelCompiler Validation 1 imports 1 dependents 1 functions

Entity Profile

Dependency Diagram

graph LR
  9d25a570_0086_154f_00bb_c5b100737b42["withVerticalScrollbarLayout.js"]
  967225f1_4dbc_efd7_073f_8182bb20aa4f["layouter.js"]
  9d25a570_0086_154f_00bb_c5b100737b42 --> 967225f1_4dbc_efd7_073f_8182bb20aa4f
  9576b70a_cfcb_5729_1030_479df0856820["VerticalScrollOverflowView.js"]
  9576b70a_cfcb_5729_1030_479df0856820 --> 9d25a570_0086_154f_00bb_c5b100737b42
  style 9d25a570_0086_154f_00bb_c5b100737b42 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @flow
 */

import type {LayoutInfo, Layouter} from '../layouter';

/**
 * Assumes {@param layout} will only contain 2 views.
 */
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

Dependencies

Frequently Asked Questions

What does withVerticalScrollbarLayout.js do?
withVerticalScrollbarLayout.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in withVerticalScrollbarLayout.js?
withVerticalScrollbarLayout.js defines 1 function(s): withVerticalScrollbarLayout.
What does withVerticalScrollbarLayout.js depend on?
withVerticalScrollbarLayout.js imports 1 module(s): layouter.js.
What files import withVerticalScrollbarLayout.js?
withVerticalScrollbarLayout.js is imported by 1 file(s): VerticalScrollOverflowView.js.
Where is withVerticalScrollbarLayout.js in the architecture?
withVerticalScrollbarLayout.js is located at packages/react-devtools-timeline/src/view-base/vertical-scroll-overflow/withVerticalScrollbarLayout.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-devtools-timeline/src/view-base/vertical-scroll-overflow).

Analyze Your Own Codebase

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

Try Supermodel Free