summaryrefslogtreecommitdiffstats
path: root/web/react
diff options
context:
space:
mode:
authorHarrison Healey <harrisonmhealey@gmail.com>2015-10-19 10:35:33 -0400
committerHarrison Healey <harrisonmhealey@gmail.com>2015-10-19 10:35:33 -0400
commit75da10fffa07517b6c8c738b3687d9d46a50dc5f (patch)
tree2d16dc6bb05677cf5518aba9ce9e76a2ed3be30e /web/react
parent9a71222db06f5716c435051be05c1d6b7f1eea14 (diff)
parentbfba1d55adf3e82fe29b0888db12acdbceb507ec (diff)
downloadchat-75da10fffa07517b6c8c738b3687d9d46a50dc5f.tar.gz
chat-75da10fffa07517b6c8c738b3687d9d46a50dc5f.tar.bz2
chat-75da10fffa07517b6c8c738b3687d9d46a50dc5f.zip
Merge pull request #1104 from florianorben/fix_arrow_left_right
No longer try to navigate to next/prev image if image preview modal is not open
Diffstat (limited to 'web/react')
-rw-r--r--web/react/components/view_image.jsx7
1 files changed, 4 insertions, 3 deletions
diff --git a/web/react/components/view_image.jsx b/web/react/components/view_image.jsx
index f75693470..322e68c17 100644
--- a/web/react/components/view_image.jsx
+++ b/web/react/components/view_image.jsx
@@ -6,6 +6,7 @@ const Utils = require('../utils/utils.jsx');
const Constants = require('../utils/constants.jsx');
const ViewImagePopoverBar = require('./view_image_popover_bar.jsx');
const Modal = ReactBootstrap.Modal;
+const KeyCodes = Constants.KeyCodes;
export default class ViewImageModal extends React.Component {
constructor(props) {
@@ -63,11 +64,11 @@ export default class ViewImageModal extends React.Component {
this.loadImage(id);
}
handleKeyPress(e) {
- if (!e) {
+ if (!e || !this.props.show) {
return;
- } else if (e.keyCode === 39) {
+ } else if (e.keyCode === KeyCodes.RIGHT) {
this.handleNext();
- } else if (e.keyCode === 37) {
+ } else if (e.keyCode === KeyCodes.LEFT) {
this.handlePrev();
}
}