0.0.6 • Published 7 years ago

react-motion-scroll v0.0.6

Weekly downloads
165
License
MIT
Repository
github
Last release
7 years ago

react-motion-scroll 🍭

react-motion-scroll is a tiny plugin for react-motion. It provides a simple HOC to have smooth scrolling in seconds.

How it works

Just put any component inside <SmoothScroll /> and set an height, if you don't it will inherit the parent height.

MotionScroll makes accessible a new property called scrollTo to your <Child /> you can pass it a number (scrollTop value) or a string (an element id) and enjoy smooth scrolling

import React, { Component } from 'react'
import MotionScroll from 'react-motion-scroll'
import List from 'SomeList'

const Content = ({ scrollTo }) => {
  return (
    <List onClick={scrollTo('item-50')} />
  )
}

export default class App extends React.Component {
  render() {
    return (
      <MotionScroll height={500}>
        <Content />
      </MotionScroll>
    )
  }
}

ReactDOM.render(<App />, document.querySelector('react'))

Nothing more, have fun !

More

react-motion

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago

0.0.0

7 years ago