From 4f89be9d89024cf4492e9cd342df7cfdae981f92 Mon Sep 17 00:00:00 2001 From: Xiao Lin Date: Tue, 19 Feb 2019 10:27:04 -0500 Subject: [PATCH] Hot fix SSR broken using window --- package.json | 4 ++-- src/ImageGallery.jsx | 6 +----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index d66fadf2..e808e956 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-image-gallery", - "version": "0.8.13", + "version": "0.8.14", "description": "React carousel image gallery component with thumbnail and mobile support", "main": "./build/image-gallery.js", "scripts": { @@ -64,7 +64,7 @@ "lodash.debounce": "^4.0.8", "lodash.throttle": "^4.1.1", "prop-types": "^15.5.8", - "react-swipeable": "^4.2.2", + "react-swipeable": "^4.3.2", "resize-observer-polyfill": "^1.5.0" } } diff --git a/src/ImageGallery.jsx b/src/ImageGallery.jsx index f857347d..b3bcb399 100644 --- a/src/ImageGallery.jsx +++ b/src/ImageGallery.jsx @@ -36,8 +36,6 @@ export default class ImageGallery extends React.Component { if (props.lazyLoad) { this._lazyLoaded = []; } - - window.addEventListener('keydown', this._handleKeyDown); } static propTypes = { @@ -191,9 +189,7 @@ export default class ImageGallery extends React.Component { if (this.props.autoPlay) { this.play(); } - if (!this.props.disableArrowKeys) { - window.addEventListener('keydown', this._handleKeyDown); - } + window.addEventListener('keydown', this._handleKeyDown); this._onScreenChangeEvent(); }