@@ -157,8 +157,6 @@ class ReactImageLightbox extends Component {
157157 window . addEventListener ( 'resize' , this . handleWindowResize ) ;
158158 window . addEventListener ( 'mouseup' , this . handleMouseUp ) ;
159159 window . addEventListener ( 'touchend' , this . handleMouseUp ) ;
160- document . addEventListener ( 'touchstart' , this . handleOuterTouchStart ) ;
161- window . addEventListener ( 'touchmove' , this . handleOuterTouchMove ) ;
162160
163161 // Have to add an extra mouseup handler to catch mouseup events outside of the window
164162 // if the page containing the lightbox is displayed in an iframe
@@ -238,8 +236,6 @@ class ReactImageLightbox extends Component {
238236 window . removeEventListener ( 'resize' , this . handleWindowResize ) ;
239237 window . removeEventListener ( 'mouseup' , this . handleMouseUp ) ;
240238 window . removeEventListener ( 'touchend' , this . handleMouseUp ) ;
241- document . removeEventListener ( 'touchstart' , this . handleOuterTouchStart ) ;
242- window . removeEventListener ( 'touchmove' , this . handleOuterTouchMove ) ;
243239
244240 if ( isInIframe ( ) ) {
245241 window . top . removeEventListener ( 'mouseup' , this . handleMouseUp ) ;
@@ -918,6 +914,8 @@ class ReactImageLightbox extends Component {
918914 onWheel = { this . handleOuterMousewheel }
919915 onMouseMove = { this . handleOuterMouseMove }
920916 onMouseDown = { this . handleOuterMouseDown }
917+ onTouchStart = { this . handleOuterTouchStart }
918+ onTouchMove = { this . handleOuterTouchMove }
921919 className = { `outer ${ styles . outer } ${ styles . outerAnimating } ` +
922920 ( this . state . isClosing ? ` closing ${ styles . outerClosing } ` : '' )
923921 }
0 commit comments