New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-timeline-animation

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-timeline-animation

Scroll animation component

  • 1.2.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
263
increased by13.85%
Maintainers
1
Weekly downloads
 
Created
Source

React scroll animation component.

drawing

Demo codesandbox 🚀

How to use it

1. Installation

npm install --save react-timeline-animation

or

yarn add react-timeline-animation

2. Quick start

Important to add a unique id to the observed element (id="timeline100500").

<div id="timeline100500" ref={timeline} className="timeline" />;

Component using react "render prop" pattern.

<TimelineObserver
  initialColor="#e5e5e5"
  fillColor="#53b374"
  handleObserve={(setObserver) => (
    <Timeline
      callback={onCallback}
      className="timeline"
      setObserver={setObserver}
    />
  )}
/>;
const Timeline = ({ setObserver, callback }) => {
  const timeline = useRef(null);

  // It Will be fired when the element crossed the middle of the screen. 
  const someCallback = () => {
    callback();
  };

  useEffect(() => {
    if (timeline.current) {
      setObserver(timeline.current, someCallback);
    }
  }, []);

  return <div id="timeline100500" ref={timeline} className="timeline" />;
};

Options (props) 🛠

initialColor: not required. Initial color of observable element.
fillColor: not required. Color to fill element.
handleObserve: required. "render prop" to handle observable element.
hasReverse: not required. Allow to scroll in both directions.
interface TimelineObserverProps {
  handleObserve?: (
    observer: (target: Element, callbackFn?: () => void) => void
  ) => JSX.Element;
  initialColor?: string;
  fillColor?: string;
  hasReverse?: boolean;
}

Keywords

FAQs

Package last updated on 22 Nov 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc