feat: support React.Component in marks

This commit is contained in:
Benjy Cui
2016-03-22 16:53:38 +08:00
parent e030ba9f9d
commit 6a5573b6ca
2 changed files with 4 additions and 3 deletions
+2 -1
View File
@@ -20,7 +20,8 @@ const Marks = ({className, marks, included, upperBound, lowerBound, max, min}) =
style.left = (point - min) / range * 100 - markWidth / 2 + '%';
const markPoint = marks[point];
const markPointIsObject = typeof markPoint === 'object';
const markPointIsObject = typeof markPoint === 'object' &&
!React.isValidElement(markPoint);
const markLabel = markPointIsObject ? markPoint.label : markPoint;
const markStyle = markPointIsObject ?
{ ...style, ...markPoint.style } : style;