New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-snap-scroll

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-snap-scroll

A container to handle 'snap scrolling' behaviour.

latest
npmnpm
Version
0.0.5
Version published
Maintainers
1
Created
Source

ReactSnapScroll

Introduction:

A React.js Component for "snap" scrolling between elements.

Install:
npm install react-snap-scroll --save
// Or
yarn add react-snap-scroll
Usage:
import ReactSnapScroll from 'react-snap-scroll';

const App = () => (
    <ReactSnapScroll transition="move-top-bottom">
        <div />
        <div />
        <div />
    </ReactSnapScroll>
);
Example Usage:

The examples folder contains an example use with create-react-app.

cd examples
yarn
yarn start
Props:
PropertyTypeDefaultDescription
childrennode, arrayOf(node)isRequiredThe elements to snap between.
startnumber0The starting index of the Snapper.
indexChangedfuncf => fCallback function when the Snapper changes indexes.
transitionstring"move-top-bottom"The transition to apply on index changed.
orientationstring"vertical"The orientation of a scroll/swipe necessary to trigger an index change.
customTransitionstringnullA custom classname to use for the CSSTransition instead of one of the default animations.
customDurationobject{ enter: 1000, exit: 1000 }The timeout duration applied to the CSSTransition to manipulate the classes applied to the transitioning elements.
Built-in Transitions
  • "move-top-bottom"
  • "move-top-bottom-stagger"
  • "scale-down-top-bottom"
  • "scale-down-up"
  • "fold-top-bottom"
  • "cube-top-bottom"

These transitions come from here.

Additional Information:

If you're using the customTransition prop it is assumed you know your way around react-transition-group and its Component CSSTransition. The string defined in the customTransition prop will be suffixed with 'forward' and 'reverse' in order to create separate transitions in either direction.

Ex: customTransition="my-transition"

Classnames applied to the element that is appearing:

  • .my-transition-forward-enter
  • .my-transition-forward-enter-active
  • .my-transition-forward-enter-done
  • .my-transition-reverse-enter
  • .my-transition-reverse-enter-active
  • .my-transition-reverse-enter-done

Classnames applied to the element that is leaving:

  • .my-transition-forward-exit
  • .my-transition-forward-exit-active
  • .my-transition-forward-exit-done
  • .my-transition-reverse-exit
  • .my-transition-reverse-exit-active
  • .my-transition-reverse-exit-done

The enter and exit properties of the customDuration object will be applied to the timeout prop in CSSTransition. These values should match up with the animation duration + delay for the respective animation.

Keywords

react

FAQs

Package last updated on 25 Jan 2019

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