File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -49,9 +49,17 @@ function matchesSelector(el, selector) {
4949}
5050
5151// @credits : http://stackoverflow.com/questions/4817029/whats-the-best-way-to-detect-a-touch-screen-device-using-javascript/4819886#4819886
52- var isTouchDevice = 'ontouchstart' in window // works on most browsers
52+ /* Conditional to fix node server side rendering of component */
53+ if ( typeof window === 'undefined' ) {
54+ // Do Node Stuff
55+ var isTouchDevice = false ;
56+ } else {
57+ // Do Browser Stuff
58+ var isTouchDevice = 'ontouchstart' in window // works on most browsers
5359 || 'onmsgesturechange' in window ; // works on ie10 on ms surface
5460
61+ }
62+
5563// look ::handleDragStart
5664//function isMultiTouch(e) {
5765// return e.touches && Array.isArray(e.touches) && e.touches.length > 1
@@ -402,7 +410,7 @@ module.exports = React.createClass({
402410 var directionY = clientY < parseInt ( this . state . clientY , 10 ) ? - 1 : 1 ;
403411
404412 clientX = Math . abs ( clientX - parseInt ( this . state . clientX , 10 ) ) >= this . props . grid [ 0 ]
405- ? ( parseInt ( this . state . clientX , 10 ) + ( this . props . grid [ 0 ] * directionX ) )
413+ ? ( parseInt ( this . state . clientX , 10 ) + ( this . props . grid [ 0 ] * directionX ) )
406414 : this . state . clientX ;
407415
408416 clientY = Math . abs ( clientY - parseInt ( this . state . clientY , 10 ) ) >= this . props . grid [ 1 ]
You can’t perform that action at this time.
0 commit comments