react-scrollbar-size

WebJar for react-scrollbar-size

Лицензия

Лицензия

MIT
Категории

Категории

React Взаимодействие с пользователем Веб-фреймворки
Группа

Группа

org.webjars.npm
Идентификатор

Идентификатор

react-scrollbar-size
Последняя версия

Последняя версия

2.1.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

react-scrollbar-size
WebJar for react-scrollbar-size
Ссылка на сайт

Ссылка на сайт

http://webjars.org
Система контроля версий

Система контроля версий

https://github.com/STORIS/react-scrollbar-size

Скачать react-scrollbar-size

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.npm/react-scrollbar-size/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>react-scrollbar-size</artifactId>
    <version>2.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/react-scrollbar-size/
implementation 'org.webjars.npm:react-scrollbar-size:2.1.0'
// https://jarcasting.com/artifacts/org.webjars.npm/react-scrollbar-size/
implementation ("org.webjars.npm:react-scrollbar-size:2.1.0")
'org.webjars.npm:react-scrollbar-size:jar:2.1.0'
<dependency org="org.webjars.npm" name="react-scrollbar-size" rev="2.1.0">
  <artifact name="react-scrollbar-size" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='react-scrollbar-size', version='2.1.0')
)
libraryDependencies += "org.webjars.npm" % "react-scrollbar-size" % "2.1.0"
[org.webjars.npm/react-scrollbar-size "2.1.0"]

Зависимости

compile (4)

Идентификатор библиотеки Тип Версия
org.webjars.npm : babel-runtime jar [6.26.0,7)
org.webjars.npm : prop-types jar [15.6.0,16)
org.webjars.npm : react-event-listener jar [0.5.1,0.6)
org.webjars.npm : stifle jar [1.0.2,2)

Модули Проекта

Данный проект не имеет модулей.

React-Scrollbar-Size

React-Scrollbar-Size is a React component designed to calculate the size of the user agent's horizontal and vertical scrollbars. It will also detect when the size of the scrollbars change, such as when the user agent's zoom factor changes.

npm package npm downloads CircleCI Code Climate Code Style Code style Dependabot Status Dependencies PeerDependencies DevDependencies Percentage of issues still open License Contributor Covenant Star on Github

Installation

React-Scrollbar-Size is available as an npm package:

$ npm install react-scrollbar-size

Usage

Props

Name Description
onChange Callback which will fire when the scrollbar sizes change.

The callback accepts an object which will be updated with the following properties:

Name Description
width The current width of the vertical scrollbar.
height The current height of the horizontal scrollbar.

Examples

To see a live example, follow these instructions.

TypeScript

import React, { CSSProperties, FunctionComponent, useState } from 'react';
import ScrollbarSize from 'react-scrollbar-size';

const styles: CSSProperties = {
  margin: '1rem',
  textAlign: 'center',
};

const ScrollbarSizeDemo: FunctionComponent = () => {
  const [currentHeight, setHeight] = useState(0);
  const [currentWidth, setWidth] = useState(0);

  const scrollbarSizeChange = ({ height, width }: ScrollbarSizeChangeHandlerParams) => {
    if (height !== currentHeight) {
      setHeight(height);
    }

    if (width !== currentWidth) {
      setWidth(width);
    }
  };

  return (
    <div style={styles}>
      <h2>React Scrollbar Size Demo</h2>
      <h4>Tip: Change browser zoom level to see scrollbar sizes change.</h4>
      <ScrollbarSize onChange={scrollbarSizeChange} />
      <p>
        {`The current height of the scrollbar is ${currentHeight}px.`}
        <br />
        {`The current width of the scrollbar is ${currentWidth}px.`}
      </p>
    </div>
  );
};

JavaScript

import React, { useState } from 'react';
import ScrollbarSize from 'react-scrollbar-size';

const styles = {
  margin: '1rem',
  textAlign: 'center',
};

const ScrollbarSizeDemo = () => {
  const [currentHeight, setHeight] = useState(0);
  const [currentWidth, setWidth] = useState(0);

  const scrollbarSizeChange = ({ height, width }) => {
    if (height !== currentHeight) {
      setHeight(height);
    }

    if (width !== currentWidth) {
      setWidth(width);
    }
  };

  return (
    <div style={styles}>
      <h2>React Scrollbar Size Demo</h2>
      <h4>Tip: Change browser zoom level to see scrollbar sizes change.</h4>
      <ScrollbarSize onChange={scrollbarSizeChange} />
      <p>
        {`The current height of the scrollbar is ${currentHeight}px.`}
        <br />
        {`The current width of the scrollbar is ${currentWidth}px.`}
      </p>
    </div>
  );
};

License

This project is licensed under the terms of the MIT license.

org.webjars.npm

STORIS

Версии библиотеки

Версия
2.1.0
2.0.2