Skip to content

Commit

Permalink
feat: Add Swipe support touch event
Browse files Browse the repository at this point in the history
  • Loading branch information
myxvisual committed Jul 1, 2017
1 parent af62e4b commit 0b5579f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Swipe/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ export default class Swipe extends React.Component<SwipeProps, SwipeState> {
return focusIndex < 0 ? length - Math.abs(focusIndex) % length : focusIndex % length;
}

checkIsToucheEvent = (e: React.SyntheticEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>) => "changedTouches" in e;
checkIsToucheEvent = (e: React.SyntheticEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>) => e.type.includes("touch");

mouseOrTouchDownHandler = (e: any) => {
Object.assign(document.body.style, {
Expand Down Expand Up @@ -362,10 +362,10 @@ export default class Swipe extends React.Component<SwipeProps, SwipeState> {
>
<div
onMouseDown={
stopSwipe && !isSingleChildren ? this.mouseOrTouchDownHandler : void 0
(!stopSwipe && !isSingleChildren) ? this.mouseOrTouchDownHandler : void 0
}
onTouchStart={
stopSwipe && !isSingleChildren ? this.mouseOrTouchDownHandler : void 0
(!stopSwipe && !isSingleChildren) ? this.mouseOrTouchDownHandler : void 0
}
ref="content"
style={styles.content}
Expand Down

0 comments on commit 0b5579f

Please sign in to comment.