Javi Velasco 2016-04-10 19:22:15 +02:00
parent ee4cc5437d
commit 48e5c484c4
1 changed files with 3 additions and 1 deletions

View File

@ -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);