Skip to content

Commit

Permalink
🐛 [bug]fix android4.4 TouchEvent has PageY propery (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
lanjingling0510 committed Jul 3, 2017
1 parent 436906c commit 49d2fc7
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/DatePickerItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,19 @@ class DatePickerItem extends Component {
}

handleStart(event) {
this.touchY = event.pageY || event.targetTouches[0].pageY;
this.touchY =
(event.targetTouches && event.targetTouches[0] && event.targetTouches[0].pageY) ||
event.pageY;

this.translateY = this.state.translateY;
}


handleMove(event) {
const touchY = event.pageY || event.targetTouches[0].pageY;
const touchY =
(event.targetTouches && event.targetTouches[0] && event.targetTouches[0].pageY) ||
event.pageY;

const dir = touchY - this.touchY;
const translateY = this.translateY + dir;
const direction = dir > 0 ? -1 : 1;
Expand Down

0 comments on commit 49d2fc7

Please sign in to comment.