Skip to content
This repository has been archived by the owner on Feb 19, 2022. It is now read-only.

fix tooltip rendering #280

Merged
merged 3 commits into from
Aug 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/victory-label/victory-label.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,9 @@ export default class VictoryLabel extends React.Component {
shouldComponentUpdate(nextProps) {
const attrs = this.calculateAttributes(nextProps);
const { style, dx, dy, content, lineHeight, textAnchor, transform } = attrs;
const { angle, className, datum, x, y } = this.props;
const { angle, className, datum, x, y, active } = this.props;
if (!Collection.allSetsEqual([
[active, nextProps.active],
[angle, nextProps.angle],
[className, nextProps.className],
[x, nextProps.x],
Expand Down
7 changes: 6 additions & 1 deletion src/victory-tooltip/victory-tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import PropTypes from "prop-types";
import CustomPropTypes from "../victory-util/prop-types";
import TextSize from "../victory-util/textsize";
import Helpers from "../victory-util/helpers";
import Collection from "../victory-util/collection";
import LabelHelpers from "../victory-util/label-helpers";
import VictoryLabel from "../victory-label/victory-label";
import VictoryTheme from "../victory-theme/victory-theme";
Expand Down Expand Up @@ -121,6 +122,10 @@ export default class VictoryTooltip extends React.Component {
}
}];

shouldComponentUpdate(nextProps) {
return !Collection.areVictoryPropsEqual(this.props, nextProps);
}

getDefaultOrientation(props) {
const { datum, horizontal, polar } = props;
if (!polar) {
Expand Down Expand Up @@ -333,7 +338,7 @@ export default class VictoryTooltip extends React.Component {
flyoutComponent, labelComponent, groupComponent, active, renderInPortal
} = evaluatedProps;
if (!active) {
return null;
return renderInPortal ? <VictoryPortal>{null}</VictoryPortal> : null;
}
const calculatedValues = this.getCalculatedValues(evaluatedProps);
const children = [
Expand Down