From bf4e3364b48ece118ea1e9e915737e0163becff6 Mon Sep 17 00:00:00 2001 From: wmwragg Date: Fri, 2 Sep 2016 18:41:27 +0100 Subject: [PATCH] Tweak of the RoomTooltip to use DOM element for the parent rather than a React component --- src/components/views/rooms/RoomTooltip.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/components/views/rooms/RoomTooltip.js b/src/components/views/rooms/RoomTooltip.js index 83c8326f49..72a2f733bb 100644 --- a/src/components/views/rooms/RoomTooltip.js +++ b/src/components/views/rooms/RoomTooltip.js @@ -25,7 +25,7 @@ module.exports = React.createClass({ displayName: 'RoomTooltip', propTypes: { - component: React.PropTypes.object.isRequired, + parent: React.PropTypes.object.isRequired, room: React.PropTypes.object, label: React.PropTypes.string, }, @@ -36,14 +36,17 @@ module.exports = React.createClass({ this.tooltipContainer.className = "mx_RoomTileTooltip_wrapper"; document.body.appendChild(this.tooltipContainer); - this._renderTooltip(); + // don't render tooltip if parent is undefined + if (this.props.parent) { + this._renderTooltip(); - // tell the roomlist about us so it can position us - dis.dispatch({ - action: 'view_tooltip', - tooltip: this.tooltip, - parent: this.props.component ? ReactDOM.findDOMNode(this.props.component) : null, - }); + // tell the roomlist about us so it can position us + dis.dispatch({ + action: 'view_tooltip', + tooltip: this.tooltip, + parent: this.props.parent, + }); + } }, // Remove the wrapper element, as the tooltip has finished using it