JSPM

r-intersection-observer

1.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q30595F
  • License MIT

Simple React intersection observer component

Package Exports

  • r-intersection-observer

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (r-intersection-observer) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

r-intersection-observer

Custom React intersection observer component

NPM JavaScript Style Guide

Install

npm install --save r-intersection-observer

Usage

import * as React from 'react'

import Observer from 'r-intersection-observer'

function Example () {
    return (
      <Observer>
        {
          inView => (
             <div>
               Observing Element
             </div>
          )
        }
      </Observer>
    )
 }


 inView returns boolean if element is intersecting or not

Properties

Name Required Type Description Default Value
rootMargin false string define rootMargin option 0px
threshold false number define threshold option 0
root false JSX define root option --
callBack false function callback after intersecting --
onlyCallBack false boolean returns only callBack function false
onlyOnce false boolean intersecting entry only once true
className false string define className for Observer --
style false React.CSSProperties define style object --
function arguments
callBack (isIntersecting: boolean, entry: IntersectionObserverEntry, ref: React.MutableRefObject)

License

MIT © arsengit