1.1.0 • Published 5 years ago

r-intersection-observer v1.1.0

Weekly downloads
5
License
MIT
Repository
github
Last release
5 years ago

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

NameRequiredTypeDescriptionDefault Value
rootMarginfalsestringdefine rootMargin option0px
thresholdfalsenumberdefine threshold option0
rootfalseJSXdefine root option--
callBackfalsefunctioncallback after intersecting--
onlyCallBackfalsebooleanreturns only callBack functionfalse
onlyOncefalsebooleanintersecting entry only oncetrue
classNamefalsestringdefine className for Observer--
stylefalseReact.CSSPropertiesdefine style object--
functionarguments
callBack(isIntersecting: boolean, entry: IntersectionObserverEntry, ref: React.MutableRefObject)

License

MIT © arsengit

1.1.0

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago