# react-scroll-lock-component

> A React component wrapper that restricts scrolling capabilities of everything except for its children.

Latest version **1.2.0** (published 2019-02-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-scroll-lock-component
pnpm add react-scroll-lock-component
yarn add react-scroll-lock-component
bun add react-scroll-lock-component
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2019-02-06 |
| First published | 2016-04-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 193.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 29 |
| Author | Teddy Ortega |
| Maintainers | tortega128 |
| Keywords | React, scroll, lock, scrolllock, javascript, component |

## Links

- npm: https://www.npmjs.com/package/react-scroll-lock-component
- Repository: https://github.com/orteth01/react-scroll-lock-component
- Homepage: https://github.com/orteth01/react-scroll-lock-component#readme
- Issues: https://github.com/orteth01/react-scroll-lock-component/issues
- npm.io page: https://npm.io/package/react-scroll-lock-component

## Dependencies (1)

- [prop-types](https://npm.io/package/prop-types.md) ^15.6.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.2.0 (latest) — 2019-02-06
- 1.1.2-test.1 (test) — 2019-02-06
- 1.1.2 — 2017-10-04
- 1.1.1 — 2017-10-04
- 1.1.0 — 2017-06-28
- 1.0.1 — 2017-04-01
- 1.0.0 — 2017-03-31
- 0.3.0 — 2017-03-30
- 0.2.1 — 2017-03-07
- 0.2.0 — 2017-03-06
- 0.1.3 — 2017-01-01
- 0.1.2 — 2016-10-13
- 0.1.1 — 2016-04-18
- 0.1.0 — 2016-04-17
- 0.0.3 — 2016-04-17
- … 2 more at https://npm.io/package/react-scroll-lock-component/versions

## README

# react-scroll-lock-component
[![npm version](https://badge.fury.io/js/react-scroll-lock-component.svg)](https://badge.fury.io/js/react-scroll-lock-component)
[![Build Status](https://travis-ci.org/orteth01/react-scroll-lock-component.svg?branch=master)](https://travis-ci.org/orteth01/react-scroll-lock-component)

A React component wrapper that restricts scrolling capabilities of everything except for its children. 

Wheel events, touchmove events, and key press events that affect page location (e.g. directional arrows, pageup/pagedown/spacebar) are all locked.

## Demo
Check out the demo [here](https://orteth01.github.io/react-scroll-lock-component-demo)!

## Installation
```
npm install react-scroll-lock-component
```
or 
```
yarn add react-scroll-lock-component
```

## Usage

```js
import React from 'react';
import ScrollLock from 'react-scroll-lock-component';

export default () => (
    <div>
        <ScrollLock>
            <div> 
                {/*
                    unlike normal scroll functionality, when the user scrolls this
                    div and reaches the beginning or end nothing else on the page will scroll
                */}
            </div>
        </ScrollLock>
        <div>
            {/* scrolling outside of the scroll lock will remain normal */}
        </div>
    </div>
);
```

### optional props

|Prop|description|default value|
|:-:|:-:|:-:|
| enabled|programatically enable or disable the scroll lock|`true`|
|className|apply custom styles to the scroll lock component|`''`|

## Credits
Adapted from [this old mixin](http://codepen.io/somethingkindawierd/post/react-mixin-scroll-lock)

## License
MIT

---
_Source: https://npm.io/package/react-scroll-lock-component · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
