Skip to content

Commit 48e5c48

Browse files
committed
Fix #407
1 parent ee4cc54 commit 48e5c48

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

components/menu/Menu.jsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,9 @@ class Menu extends React.Component {
106106
};
107107

108108
calculatePosition () {
109-
const {top, left, height, width} = ReactDOM.findDOMNode(this).parentNode.getBoundingClientRect();
109+
const parentNode = ReactDOM.findDOMNode(this).parentNode;
110+
if (!parentNode) return;
111+
const {top, left, height, width} = parentNode.getBoundingClientRect();
110112
const {height: wh, width: ww} = utils.getViewport();
111113
const toTop = top < ((wh / 2) - height / 2);
112114
const toLeft = left < ((ww / 2) - width / 2);

0 commit comments

Comments
 (0)