1.1.1 • Published 6 years ago

react-swipe-view v1.1.1

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

react-swipe-view

react component for mobile, switch tab views by gesture

install

npm i react-swipe-view

usage

import SwipeView from 'react-swipe-view'

<SwipeView cur={0} num={5} tabWidth={375} tabChange={tabChange} onSwipe={onSwipe} animation={{duration:0.3, timing: 'ease', delay: 0}} disableTouch={['.disabled']}>
    {views}
</SwipeView>

check the demo code at example folder and effect here

Prop Types

PropertyTypeRequired?Description
numNumbertotal number of tab view
tabWidthNumberwidth of each tab view
curNumbercurrent tab index start from 0, default 0
fastSwipeTimeNumberswipe time less then fastSwipeTime(default 300ms) will cause tab view change
tabChangeFunctioncallback invoked when tab view changed by user's gesture (index: Number): void
onSwipeFunctioncallback invoked when user is sliding (isSwipe: Boolean):void, if user is sliding horizontally isSwipe is true else false
containerStyleObjectthis component use display: flex to layout inner tab views, set containerStyle to change it
animationObjectdefine the animation props for tab transition. eg:{duration: 0.3, timing: 'ease', delay: 0}
disableTouchArrayan array of dom selectors, indicate the dom not trigger touch effect. eg: ['.disabled', '.no-touch']. selector should not use ,
1.1.1

6 years ago

1.1.0

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago