# react-to-target-auto-scroll

> A React auto scroll component which scrolls to a given target position, supports linear and eased scrolling

Latest version **1.0.5** (published 2019-09-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-to-target-auto-scroll
pnpm add react-to-target-auto-scroll
yarn add react-to-target-auto-scroll
bun add react-to-target-auto-scroll
```

## 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.0.5 |
| Published | 2019-09-10 |
| First published | 2017-02-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 67.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | marciano viereck |
| Maintainers | jvoost, marcianoviereck |
| Keywords | react, reactjs, react-component, auto-scroll, auto, scroll, scrolling, auto-scrolling, scroll-component, target-scroll |

## Links

- npm: https://www.npmjs.com/package/react-to-target-auto-scroll
- Repository: https://github.com/simacan/react-to-target-auto-scroll
- Homepage: https://github.com/simacan/react-to-target-auto-scroll#readme
- Issues: https://github.com/simacan/react-to-target-auto-scroll/issues
- npm.io page: https://npm.io/package/react-to-target-auto-scroll

## Dependencies (2)

- [react](https://npm.io/package/react.md) ^15.3.1
- [babel-runtime](https://npm.io/package/babel-runtime.md) ~5.8.20

## 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.0.5 (latest) — 2019-09-10
- 1.0.4 — 2017-03-01
- 1.0.3 — 2017-02-28
- 1.0.2 — 2017-02-28
- 1.0.1 — 2017-02-28
- 1.0.0 — 2017-02-28

## README

# ReactAutoScroll

This component is a simple react auto scroll component which should be wrapped around a scrollable component and requires a **ref** to the container that it will scroll vertically.

If you'd like to see more different kinds of easeTypes, then feel free to check out the github project.

### Basic Example with linear scrolling
```js
export default class ScrollExample extends Component {
  render() {
    return (
      <ReactAutoScroll
        targetPosition={900}
        easeType={'linear'}
        speed={5}
        updateInterval={40}
        onScrollingDone={() => console.log('scrolling finished')}
        scrollTargetRef={this.refs.scrollExample}
        isEnabled
      >
        <div
          ref="scrollExample"
          style={{ overflow: 'scroll', backgroundColor: 'red', width: '300px', height: '300px' }}
          >
           <div style={{ height: '2000px' }}>
            content
           </div>
         </div>
     </ReactAutoScroll>
    );
  }
}
```   
### Different scroll type

```js
  <ReactAutoScroll
    targetPosition={900}
    easeType={'accelerated'}
    speed={0.05}
    updateInterval={40}
    onScrollingDone={() => console.log('accelerated scrolling finished')}
    scrollTargetRef={this.refs.scrollExample}
    isEnabled
  >
```

### But im using the React Infinite scroll component?
This also works with the infinite scroll component, exactly the same way:
```js
  <ReactAutoScroll
    targetPosition={900}
    easeType={'accelerated'}
    speed={0.05}
    updateInterval={40}
    onScrollingDone={() => console.log('accelerated scrolling finished')}
    scrollTargetRef={this.refs.scrollExample}
    isEnabled
  >

    <Infinite ref="scrollExample">
      stuff
    </Infinite>
  </ReactAutoScroll>
```

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