MCPcopy Index your code
hub / github.com/AvraamMavridis/react-intersection-visible

github.com/AvraamMavridis/react-intersection-visible @v2.0.6

Chat with this repo
repository ↗ · DeepWiki ↗ · release v2.0.6 ↗ · + Follow
8 symbols 20 edges 6 files 6 documented · 75% updated 6y ago★ 529 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

react-intersection-visible

HOC-wrapper Component that helps you track when an element enters in the viewport. It uses the new IntersectionObserver API with polyfill fallback

Demo

codecov Build Status Greenkeeper badge

How to use

  1. Import IntersectionVisible hoc component
  2. Wrap your main component with the IntersectionVisible
  3. Provide the options and callbacks you want

Example

```javascript import React, { Component } from 'react'; import ReactDOM from 'react-dom'; import IntersectionVisible from 'react-intersection-visible';

class YourComponent extends Component {

onHide( entries )
{
    // do something
}

onShow( entries )
{
    // do something
}

onIntersect( entries )
{
    // do something
}

render(){
    return (<IntersectionVisible onIntersect={ e => this.onIntersect( e ) }
                                 onHide={ e => this.onHide( e ) }>
                                 onShow={ e => this.onShow( e ) }>



                    blah blah blah  blah blah blah  blah blah blah  blah blah
                      blah blah blah  blah blah blah  blah blah blah



            </IntersectionVisible>);
}

}

```

Options:

Name Description
onIntersect Function that is called when the visibility status of the element change
onHide Function that is called when the element becomes invisible
onShow Function that is called when the element becomes visible
options Object, with the extras options supported by the IntersectionObserver API (root, rootMargin, threshold)

More about the options here

Contribute

Any pull-request is more than welcome :boom: :smile:

License

MIT

Core symbols most depended-on inside this repo

startObserving
called by 2
src/index.js
stopObserving
called by 1
src/index.js
componentDidMount
called by 0
src/index.js
componentDidUpdate
called by 0
src/index.js
componentWillUnmount
called by 0
src/index.js
render
called by 0
src/index.js

Shape

Method 6
Class 2

Languages

TypeScript100%

Modules by API surface

src/index.js8 symbols

For agents

$ claude mcp add react-intersection-visible \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact