From 796c34468050c625f941a44e3819dc047e469224 Mon Sep 17 00:00:00 2001 From: ilker0 Date: Sat, 27 Jan 2018 16:49:11 +0300 Subject: [PATCH] lightbox componentdidmount currentImage added --- src/Lightbox.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Lightbox.js b/src/Lightbox.js index 41af9874..00998782 100644 --- a/src/Lightbox.js +++ b/src/Lightbox.js @@ -38,8 +38,13 @@ class Lightbox extends Component { }; } componentDidMount () { - if (this.props.isOpen && this.props.enableKeyboardInput) { - window.addEventListener('keydown', this.handleKeyboardInput); + if (this.props.isOpen) { + if (this.props.enableKeyboardInput) { + window.addEventListener('keydown', this.handleKeyboardInput); + } + if (this.props.currentImage) { + this.preloadImage(this.props.currentImage, this.handleImageLoaded); + } } } componentWillReceiveProps (nextProps) {