0.1.2 • Published 6 years ago

react-native-swipeable-view-wrapper v0.1.2

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

react-native-swipeable-view-wrapper PRs Welcome

A pure JS react native wrapper component to make your views support swipe gestures.

Demo

You can see a live demo here

Installation

  npm install react-native-swipeable-view-wrapper --save

Usage

 import SwipeableView from "react-native-swipeable-view-wrapper";

 class SwipeableViewExample extends Component {

   onSwipeRight = () => console.log("swiped right!");
   onSwipeLeft = () => console.log("swiped left!");

   render() {
     return (
       <SwipeableView
        onSwipeLeft={this.onSwipeLeft}
        onSwipeRight={this.onSwipeRight}
       >
        ...
       </SwipeableView>
    );
  }

}

Roadmap

  • add support for multiple different animations

Properties

PropertyDescriptionDefaultType
stylestyle applied to the wrapper componentnullObject
verticalmake the component swipeable verticallytrue (only if horizontal is not set)Boolean
horizontalmake the component swipeable horizontallyfalseBoolean
durationduration of the release animation150Number
bouncinessbounciness of the spring animation on release (the lower, the bouncier)100Number
onlyUpmake the component only swipeable upwardsfalseBoolean
onlyRightmake the component only swipeable to the rightfalseBoolean
onlyDownmake the component only swipeable downwardsfalseBoolean
onlyLeftmake the component only swipeable to the leftfalseBoolean
onSwipeUpcallback to execute after component was swiped upwardsnullFunction
onSwipeRightcallback to execute after component was swiped to the rightnullFunction
onSwipeDowncallback to execute after component was swiped downwardsnullFunction
onSwipeLeftcallback to execute after component was swiped to the leftnullFunction
onCancelcallback to execute if the component swipe gesture didn't reach the thresholdnullFunction
requiredTranslationYporcentual value of the screen's height that the gesture must reach to swipe successfully0.25Number
requiredTranslationXporcentual value of the screen's width that the gesture must reach to swipe succesfully0.1Number
_resetOnAnimationEndmake the inner component reappear on default location after 1000msfalseBoolean

License

MIT