Skip to content

Repository files navigation

Swipe

Swipe Component for react.

Built on top of hscroll

Build with webpack

Story book

Features

  • Responsive, children width automatically adjusted.
  • Customize style easily, no default styles.
  • Support wheel event, mousemove event and touchmove event.
  • Driven by props, play/stop support.
  • User friendly, buildin fast swipe check.
  • No conflit with transition property on children.

TODO

  • Infinite loop

Install

npm i rc-swipe -S

Usage

<Swipe style={boxStyles}>
<div>one</div>
<div>two</div>
<div>three</div>
</Swipe>

Props

nametypedefaultdescription
playboolfalsePlaying status
intervalnumber2000Play interval in miliseconds
activenumber0Current active item index
thresholdnumber200Maximun duration in ms for fast swipe
fastThreshold:number15minimum moved distance for fast swipe
durationnumber200duration for transition
onShowfuncnullcallback function called with active index after active element changed

Remember use onShow to sync active property if you change swipe state by props

You can also have classNamestyle props for swipe element.

License

MIT

About

Swipe component works accross all platform

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages