react-scroll-captor
A component that confines scroll events to its immediate child. Great for dropdown menus etc.
Last updated 8 years ago by jossmac .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install react-scroll-captor 
SYNC missed versions from official npm registry.

React Scroll Captor

A component that confines scroll events to its immediate child. Great for dropdown menus etc.

Install

yarn add react-scroll-captor

Use

import ScrollCaptor from 'react-scroll-captor';

class GroovyThing extends Component {
  atBottom = () => {
    // user has scrolled to the bottom
  }
  render () {
    return (
      <ScrollCaptor onBottomArrive={this.atBottom}>
        <ScrollableElement />
      </ScrollCaptor>
    );
  }
}

Props

Property Type Default Description
isEnabled boolean true Enable or disable the component.
onBottomArrive function -- Called when the user reaches the bottom of the scrollable element.
onBottomLeave function -- Called when the user leaves the bottom of the scrollable element.
onTopArrive function -- Called when the user reaches the top of the scrollable element.
onTopLeave function -- Called when the user leaves the top of the scrollable element.

Current Tags

  • 1.0.1                                ...           latest (8 years ago)

2 Versions

  • 1.0.1                                ...           8 years ago
  • 1.0.0                                ...           8 years ago
Maintainers (2)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (1)
Dev Dependencies (16)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |