You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
react-swipeable generates a React component (defaults to `<div>`) and binds touch events to it.
14
+
13
15
```js
14
16
var Swipeable =require('react-swipeable')
15
17
@@ -27,16 +29,14 @@ var SampleComponent = React.createClass({
27
29
onSwipedDown={this.swipedDown}
28
30
onSwipedLeft={this.swipedLeft}
29
31
onSwiped={this.handleSwipeAction}>
30
-
<div>
31
-
This element can be swiped
32
-
</div>
32
+
You can be swipe here!
33
33
</Swipeable>
34
34
)
35
35
}
36
36
})
37
37
```
38
38
39
-
## Props
39
+
## Event Props
40
40
41
41
**`onSwiping`**, **`onSwipingUp`**, **`onSwipingRight`**, **`onSwipingDown`**, **`onSwipingLeft`**, are called with the event
42
42
as well as the absolute delta of where the swipe started and where it's currently at. These constantly fire throughout touch events.
@@ -50,12 +50,14 @@ as well as the x distance, + or -, from where the swipe started to where it ende
50
50
51
51
#####Configuration Props
52
52
53
-
**`flickThreshold`** is a number (float) which determines the max velocity of a swipe before it's considered a flick.
53
+
**`flickThreshold`** is a number (float) which determines the max velocity of a swipe before it's considered a flick. The default value is `0.6`.
54
54
55
-
**`delta`** is the amount of px before we start firing events. Also effects how far `onSwipedUp`, `onSwipedRight`, `onSwipedDown`, and `onSwipedLeft` need to be before they fire events. The default value is 10.
55
+
**`delta`** is the amount of px before we start firing events. Also effects how far `onSwipedUp`, `onSwipedRight`, `onSwipedDown`, and `onSwipedLeft` need to be before they fire events. The default value is `10`.
56
56
57
57
**`preventDefaultTouchmoveEvent`** is whether to prevent the browser's [touchmove](https://developer.mozilla.org/en-US/docs/Web/Events/touchmove) event. Sometimes you would like the target to scroll natively. The default value is `true`.
58
58
59
+
**`nodeName`** is a string which determines the html element/node that this react component binds its touch events to then returns. The default value is `'div'`.
60
+
59
61
**None of the props are required.**
60
62
### PropTypes
61
63
@@ -73,6 +75,7 @@ as well as the x distance, + or -, from where the swipe started to where it ende
0 commit comments