import React, { PropTypes } from "react";
import Helpers from "../victory-util/helpers";
import { assign, isEqual } from "lodash";

export default class Circle extends React.Component {
  static propTypes = {
    active: PropTypes.bool,
    className: PropTypes.string,
    index: PropTypes.number,
    datum: PropTypes.any,
    data: PropTypes.array,
    cx: PropTypes.number,
    cy: PropTypes.number,
    r: PropTypes.number,
    style: PropTypes.object,
    events: PropTypes.object,
    role: PropTypes.string,
    shapeRendering: PropTypes.string
  };

  componentWillMount() {
    this.style = this.getStyle(this.props);
  }

  shouldComponentUpdate(nextProps) {
    const {cx, cy, r} = this.props;
    const style = this.getStyle(nextProps);
    if (cx !== nextProps.cx || cy !== nextProps.cy || r !== nextProps.r) {
      this.style = style;
      return true;
    }

    if (!isEqual(style, this.style)) {
      this.style = style;
      return true;
    }

    return false;
  }

  getStyle(props) {
    const { style, datum, active} = props;
    return Helpers.evaluateStyle(assign({stroke: "black", fill: "none"}, style), datum, active);
  }

  // Overridden in victory-core-native
  renderAxisLine(props, style, events) {
    const { role, shapeRendering, className, cx, cy, r } = props;
    return (
      <circle
        cx={cx} cy={cy} r={r}
        className={className}
        style={style}
        role={role || "presentation"}
        shapeRendering={shapeRendering || "auto"}
        {...events}
      />
    );
  }

  render() {
    const { cx, cy, r, events } = this.props;
    return this.renderAxisLine(this.props, this.style, events);
  }
}

@@ -9,11 +9,29 @@
 eact
-, %7B
+ from %22react%22;%0Aimport
  Pro
@@ -40,22 +40,25 @@
 ypes
- %7D
  from %22
-react
+prop-types
 %22;%0Ai
@@ -144,16 +144,58 @@
 lodash%22;
+%0Aimport CommonProps from %22./common-props%22;
 %0A%0Aexport
@@ -273,291 +273,107 @@
     
-active: PropTypes.bool,%0A    className: PropTypes.string,%0A    index: PropTypes.number,%0A    datum: PropTypes.any,%0A    data: PropTypes.array,%0A    cx: PropTypes.number,%0A    cy: PropTypes.number,%0A    r: PropTypes.number,%0A    style: PropTypes.object,%0A    events: PropTypes.object
+...CommonProps,%0A    cx: PropTypes.number,%0A    cy: PropTypes.number,%0A    datum: PropTypes.any
 ,%0A    r
-ole
 : Pr
@@ -384,52 +384,14 @@
 pes.
-string,%0A    shapeRendering: PropTypes.string
+number
 %0A  %7D
@@ -515,16 +515,17 @@
  const %7B
+ 
 cx, cy, 
@@ -525,16 +525,17 @@
 x, cy, r
+ 
 %7D = this
@@ -708,25 +708,24 @@
 true;%0A    %7D%0A
-%0A
     if (!isE
@@ -802,17 +802,16 @@
 ;%0A    %7D%0A
-%0A
     retu
@@ -877,16 +877,17 @@
 , active
+ 
 %7D = prop
@@ -930,16 +930,17 @@
 assign(%7B
+ 
 stroke: 
@@ -960,16 +960,17 @@
 : %22none%22
+ 
 %7D, style
@@ -1394,54 +1394,8 @@
 ) %7B%0A
-    const %7B cx, cy, r, events %7D = this.props;%0A
     
@@ -1441,24 +1441,35 @@
 this.style, 
+this.props.
 events);%0A  %7D

clean up Circle