@@ -190,7 +190,7 @@ export default class DraggableCore extends React.Component {
190190 if ( this . props . enableUserSelectHack ) removeUserSelectStyles ( ownerDocument . body ) ;
191191 }
192192
193- handleDragStart : EventHandler < MouseEvent > = ( e ) => {
193+ handleDragStart : EventHandler < MouseTouchEvent > = ( e ) => {
194194 // Make it possible to attach event handlers on top of this one.
195195 this . props . onMouseDown ( e ) ;
196196
@@ -251,7 +251,7 @@ export default class DraggableCore extends React.Component {
251251 addEvent ( ownerDocument , dragEventFor . stop , this . handleDragStop ) ;
252252 } ;
253253
254- handleDrag : EventHandler < MouseEvent > = ( e ) => {
254+ handleDrag : EventHandler < MouseTouchEvent > = ( e ) => {
255255
256256 // Get the current drag point from the event. This is used as the offset.
257257 const position = getControlPosition ( e , this . state . touchIdentifier , this ) ;
@@ -276,10 +276,11 @@ export default class DraggableCore extends React.Component {
276276 const shouldUpdate = this . props . onDrag ( e , coreEvent ) ;
277277 if ( shouldUpdate === false ) {
278278 try {
279+ // $FlowIgnore
279280 this . handleDragStop ( new MouseEvent ( 'mouseup' ) ) ;
280281 } catch ( err ) {
281282 // Old browsers
282- const event = ( ( document . createEvent ( 'MouseEvents' ) : any ) : MouseEvent ) ;
283+ const event = ( ( document . createEvent ( 'MouseEvents' ) : any ) : MouseTouchEvent ) ;
283284 // I see why this insanity was deprecated
284285 // $FlowIgnore
285286 event . initMouseEvent ( 'mouseup' , true , true , window , 0 , 0 , 0 , 0 , 0 , false , false , false , false , 0 , null ) ;
@@ -294,7 +295,7 @@ export default class DraggableCore extends React.Component {
294295 } ) ;
295296 } ;
296297
297- handleDragStop : EventHandler < MouseEvent > = ( e ) => {
298+ handleDragStop : EventHandler < MouseTouchEvent > = ( e ) => {
298299 if ( ! this . state . dragging ) return ;
299300
300301 const position = getControlPosition ( e , this . state . touchIdentifier , this ) ;
@@ -324,27 +325,27 @@ export default class DraggableCore extends React.Component {
324325 removeEvent ( ownerDocument , dragEventFor . stop , this . handleDragStop ) ;
325326 } ;
326327
327- onMouseDown : EventHandler < MouseEvent > = ( e ) => {
328+ onMouseDown : EventHandler < MouseTouchEvent > = ( e ) => {
328329 dragEventFor = eventsFor . mouse ; // on touchscreen laptops we could switch back to mouse
329330
330331 return this . handleDragStart ( e ) ;
331332 } ;
332333
333- onMouseUp : EventHandler < MouseEvent > = ( e ) => {
334+ onMouseUp : EventHandler < MouseTouchEvent > = ( e ) => {
334335 dragEventFor = eventsFor . mouse ;
335336
336337 return this . handleDragStop ( e ) ;
337338 } ;
338339
339340 // Same as onMouseDown (start drag), but now consider this a touch device.
340- onTouchStart : EventHandler < MouseEvent > = ( e ) => {
341+ onTouchStart : EventHandler < MouseTouchEvent > = ( e ) => {
341342 // We're on a touch device now, so change the event handlers
342343 dragEventFor = eventsFor . touch ;
343344
344345 return this . handleDragStart ( e ) ;
345346 } ;
346347
347- onTouchEnd : EventHandler < MouseEvent > = ( e ) => {
348+ onTouchEnd : EventHandler < MouseTouchEvent > = ( e ) => {
348349 // We're on a touch device now, so change the event handlers
349350 dragEventFor = eventsFor . touch ;
350351
0 commit comments