1.0.13 • Published 7 years ago

silk-react-swipe v1.0.13

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

Introduce

Wrap Swipe.js as a React component.

Installation

$ npm install silk-react-swipe --save

How To Use

import ReactSwipe from 'silk-react-swipe';

class Carousel extends React.Component {
    render() {
        return (
            <ReactSwipe className="carousel" swipeOptions={{continuous: false}}>
                <div>PANE 1</div>
                <div>PANE 2</div>
                <div>PANE 3</div>
            </ReactSwipe>
        );
    }
}

ReactDOM.render(
    <Carousel />,
    document.getElementById('app')
);

API

Props

swipeOptions

PropertyDescriptionTypeOptionalDefault
startSlideindex position Swipe should start atInteger0
speedspeed of prev and next transitions in millisecondsInteger300
autobegin with auto slideshow (time in milliseconds between slides)Integer
continuouscreate an infinite feel with no endpointsBooleantrue
disableScrollstop any touches on this container from scrolling the pageBooleanfalse
stopPropagationstop event propagationBooleanfalse
swipinginvoked while swiping with the percentage (0-1) of the full width that has been swipedFunction
callbackruns at slide changeFunction
transitionEndruns at the end slide transitionFunction
scrollHoldavoid scroll when move distance is smaller than scrollHoldFunction10

style

PropertyDescriptionTypeOptionalDefault
containerObject
wrapperObject
childObject

style defaults

    style: {
      container: {
        overflow: 'hidden',
        visibility: 'hidden',
        position: 'relative'
      },

      wrapper: {
        overflow: 'hidden',
        position: 'relative'
      },

      child: {
        float: 'left',
        width: '100%',
        position: 'relative',
        transitionProperty: 'transform'
      }

regular props as className, id for root component are also supported

1.0.13

7 years ago

1.0.12

7 years ago

1.0.11

7 years ago

1.0.10

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago