Skip to content

Commit

Permalink
Merge pull request #200 from ilker0/lightbox
Browse files Browse the repository at this point in the history
lightbox componentdidmount currentImage added
  • Loading branch information
neptunian authored Jan 29, 2018
2 parents 45d11e5 + 796c344 commit cc2634f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Lightbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit cc2634f

Please sign in to comment.