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) {
49
49
}
50
50
51
51
// @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
53
59
|| 'onmsgesturechange' in window ; // works on ie10 on ms surface
54
60
61
+ }
62
+
55
63
// look ::handleDragStart
56
64
//function isMultiTouch(e) {
57
65
// return e.touches && Array.isArray(e.touches) && e.touches.length > 1
@@ -402,7 +410,7 @@ module.exports = React.createClass({
402
410
var directionY = clientY < parseInt ( this . state . clientY , 10 ) ? - 1 : 1 ;
403
411
404
412
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 ) )
406
414
: this . state . clientX ;
407
415
408
416
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