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

Commit

Permalink
Merge pull request #280 from FormidableLabs/bug/tooltip-rendering
Browse files Browse the repository at this point in the history
fix tooltip rendering
  • Loading branch information
boygirl committed Aug 5, 2017
2 parents f440798 + 914ea49 commit 9f9c150
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
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

0 comments on commit 9f9c150

Please sign in to comment.