Skip to content
This repository has been archived by the owner on Dec 26, 2018. It is now read-only.

findDOMNode(this) returns null in _animateCircle() #84

Open
easadler opened this issue Sep 19, 2016 · 1 comment
Open

findDOMNode(this) returns null in _animateCircle() #84

easadler opened this issue Sep 19, 2016 · 1 comment
Labels

Comments

@easadler
Copy link
Contributor

In VoroniCircleContainer.jsx in the linechart folder, findDOMNode is returning null, which is messing up the animation.

 _animateCircle() {
    const rect = findDOMNode(this).getElementsByTagName('circle')[0].getBoundingClientRect(); //here
    this.props.onMouseOver.call(this, rect.right, rect.top, this.props.dataPoint);
    this.setState({
      circleRadius: this.props.circleRadius * (5 / 4),
      circleFill: shade(this.props.circleFill, 0.2),
    });
  }

I haven't been able to diagnose the issue, but it appears to be passed to a child component, which could be confusing react for some reason or another. Any idea what is wrong?

I don't have a problem with my npm installed rd3, but am having it with the cloned version from this repo.

    let handleMouseOver;
    let handleMouseLeave;
    if (props.hoverAnimation) {
      handleMouseOver = this._animateCircle; // here
      handleMouseLeave = this._restoreCircle;
    } else {
      handleMouseOver = handleMouseLeave = null;
    }

    return (
      <g>
        <VoronoiCircle
          handleMouseOver={handleMouseOver} //here
          handleMouseLeave={handleMouseLeave}
          voronoiPath={this._drawPath(props.vnode)}
          cx={props.cx}
          cy={props.cy}
          circleRadius={this.state.circleRadius}
          circleFill={this.state.circleFill}
        />
      </g>
    );
@yang-wei
Copy link
Owner

I don't have a problem with my npm installed rd3, but am having it with the cloned version from this repo.

Oh? This is weird. https://github.com/yang-wei/rd3/tree/master/src/linechart do not has any new commit since the last release.

Can you show me the step you reproduce this bug ?

@yang-wei yang-wei added the bug label Sep 20, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants