Fix for button popup menus not rendering

Summary: The electron menu popup requires that the position be an integer. Somehow the y-position of the button in the title bar has been moved by half a pixel. Calling Math.floor on the returned values fixes this.

Reviewed By: passy

Differential Revision: D16936833

fbshipit-source-id: 6abb9add4288f1d64c051ba3e45519340ccbb56e
This commit is contained in:
Benjamin Elo
2019-08-21 04:10:27 -07:00
committed by Facebook Github Bot
parent 8699d62b47
commit 076087f0b2

View File

@@ -285,8 +285,8 @@ class Button extends React.Component<Props, State> {
const node = findDOMNode(current); const node = findDOMNode(current);
if (node instanceof Element) { if (node instanceof Element) {
const {left, bottom} = node.getBoundingClientRect(); const {left, bottom} = node.getBoundingClientRect();
position.x = left; position.x = Math.floor(left);
position.y = bottom + 6; position.y = Math.floor(bottom) + 6;
} }
} }
menu.popup({ menu.popup({