Skip to content

Commit

Permalink
Fix #407
Browse files Browse the repository at this point in the history
  • Loading branch information
javivelasco committed Apr 10, 2016
1 parent ee4cc54 commit 48e5c48
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion components/menu/Menu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ class Menu extends React.Component {
};

calculatePosition () {
const {top, left, height, width} = ReactDOM.findDOMNode(this).parentNode.getBoundingClientRect();
const parentNode = ReactDOM.findDOMNode(this).parentNode;
if (!parentNode) return;
const {top, left, height, width} = parentNode.getBoundingClientRect();
const {height: wh, width: ww} = utils.getViewport();
const toTop = top < ((wh / 2) - height / 2);
const toLeft = left < ((ww / 2) - width / 2);
Expand Down

0 comments on commit 48e5c48

Please sign in to comment.