From 49d2fc7c5af1a7b097ec9fdcaa1e32f77f86cafe Mon Sep 17 00:00:00 2001 From: rainie <463103063@qq.com> Date: Mon, 3 Jul 2017 19:55:25 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=20[bug]fix=20android4.4=20Touch?= =?UTF-8?q?Event=20has=20PageY=20propery=20(https://github.com/lanjingling?= =?UTF-8?q?0510/react-mobile-datepicker/issues/9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/DatePickerItem.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/DatePickerItem.js b/lib/DatePickerItem.js index fbd402b..543d70a 100644 --- a/lib/DatePickerItem.js +++ b/lib/DatePickerItem.js @@ -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;