@@ -17,7 +17,8 @@ function returnDocument() {
17
17
return window . document ;
18
18
}
19
19
20
- const ALL_HANDLERS = [ 'onClick' , 'onMouseDown' , 'onTouchStart' , 'onMouseEnter' ,
20
+ // use fastclick for mobile touch
21
+ const ALL_HANDLERS = [ 'onClick' , 'onMouseDown' , 'onMouseEnter' ,
21
22
'onMouseLeave' , 'onFocus' , 'onBlur' ] ;
22
23
23
24
const Trigger = React . createClass ( {
@@ -162,13 +163,7 @@ const Trigger = React.createClass({
162
163
if ( ! this . clickOutsideHandler && this . isClickToHide ( ) ) {
163
164
currentDocument = props . getDocument ( ) ;
164
165
this . clickOutsideHandler = addEventListener ( currentDocument ,
165
- 'mousedown' , this . onDocumentClick ) ;
166
- }
167
- // always hide on mobile
168
- if ( ! this . touchOutsideHandler ) {
169
- currentDocument = currentDocument || props . getDocument ( ) ;
170
- this . touchOutsideHandler = addEventListener ( currentDocument ,
171
- 'touchstart' , this . onDocumentClick ) ;
166
+ 'click' , this . onDocumentClick ) ;
172
167
}
173
168
return ;
174
169
}
@@ -221,11 +216,6 @@ const Trigger = React.createClass({
221
216
this . preClickTime = Date . now ( ) ;
222
217
} ,
223
218
224
- onTouchStart ( e ) {
225
- this . fireEvents ( 'onTouchStart' , e ) ;
226
- this . preTouchTime = Date . now ( ) ;
227
- } ,
228
-
229
219
onBlur ( e ) {
230
220
this . fireEvents ( 'onBlur' , e ) ;
231
221
this . clearDelayTimer ( ) ;
@@ -239,20 +229,15 @@ const Trigger = React.createClass({
239
229
// focus will trigger click
240
230
if ( this . focusTime ) {
241
231
let preTime ;
242
- if ( this . preClickTime && this . preTouchTime ) {
243
- preTime = Math . min ( this . preClickTime , this . preTouchTime ) ;
244
- } else if ( this . preClickTime ) {
232
+ if ( this . preClickTime ) {
245
233
preTime = this . preClickTime ;
246
- } else if ( this . preTouchTime ) {
247
- preTime = this . preTouchTime ;
248
234
}
249
235
if ( Math . abs ( preTime - this . focusTime ) < 20 ) {
250
236
return ;
251
237
}
252
238
this . focusTime = 0 ;
253
239
}
254
240
this . preClickTime = 0 ;
255
- this . preTouchTime = 0 ;
256
241
event . preventDefault ( ) ;
257
242
const nextVisible = ! this . state . popupVisible ;
258
243
if ( this . isClickToHide ( ) && ! nextVisible || nextVisible && this . isClickToShow ( ) ) {
@@ -377,11 +362,6 @@ const Trigger = React.createClass({
377
362
this . clickOutsideHandler . remove ( ) ;
378
363
this . clickOutsideHandler = null ;
379
364
}
380
-
381
- if ( this . touchOutsideHandler ) {
382
- this . touchOutsideHandler . remove ( ) ;
383
- this . touchOutsideHandler = null ;
384
- }
385
365
} ,
386
366
387
367
createTwoChains ( event ) {
@@ -451,11 +431,9 @@ const Trigger = React.createClass({
451
431
if ( this . isClickToHide ( ) || this . isClickToShow ( ) ) {
452
432
newChildProps . onClick = this . onClick ;
453
433
newChildProps . onMouseDown = this . onMouseDown ;
454
- newChildProps . onTouchStart = this . onTouchStart ;
455
434
} else {
456
435
newChildProps . onClick = this . createTwoChains ( 'onClick' ) ;
457
436
newChildProps . onMouseDown = this . createTwoChains ( 'onMouseDown' ) ;
458
- newChildProps . onTouchStart = this . createTwoChains ( 'onTouchStart' ) ;
459
437
}
460
438
if ( this . isMouseEnterToShow ( ) ) {
461
439
newChildProps . onMouseEnter = this . onMouseEnter ;
0 commit comments