From b76472d2683e09ed7b7e2bdcea3680d376da6371 Mon Sep 17 00:00:00 2001 From: myxvisual Date: Wed, 21 Jun 2017 01:13:26 +0800 Subject: [PATCH] feat(API): Remove RatingControl iconNode props --- src/RatingControl/index.doc.json | 8 +------- src/RatingControl/index.tsx | 11 ++--------- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/src/RatingControl/index.doc.json b/src/RatingControl/index.doc.json index 7d9fe1c4..a3050e93 100644 --- a/src/RatingControl/index.doc.json +++ b/src/RatingControl/index.doc.json @@ -48,12 +48,6 @@ "isRequired": false, "type": "string" }, - { - "name": "iconNode", - "documentation": "Control show custom `React.ReactNode`.", - "isRequired": false, - "type": "ReactNode" - }, { "name": "iconStyle", "documentation": "Control custom `Icon Style`.", @@ -181,7 +175,7 @@ }, { "name": "renderRatings", - "initializerText": " (notRated = true) => {\n const { maxRating, iconNode, icon, iconStyle, iconRatedStyle, isReadOnly, iconPadding } = this.props;\n const { currRating } = this.state;\n const { theme } = this.context;\n const ratio = currRating / maxRating;\n const fontSize = iconStyle ? (+Number(iconStyle.fontSize) || 24) : 24;\n const width = fontSize * maxRating + iconPadding * (maxRating - 1);\n const offset = Math.floor(currRating) * (fontSize + iconPadding) + (currRating % 1) * fontSize;\n const lastIndex = maxRating - 1;\n\n const normalRatings = (\n \n {Array(maxRating).fill(0).map((zero, index) => (\n iconNode || (\n {\n this.handleRationClick(e, index);\n }}\n >\n {icon}\n \n )\n ))}\n \n );\n return normalRatings;\n }", + "initializerText": " (notRated = true) => {\n const { maxRating, icon, iconStyle, iconRatedStyle, isReadOnly, iconPadding } = this.props;\n const { currRating } = this.state;\n const { theme } = this.context;\n const ratio = currRating / maxRating;\n const fontSize = iconStyle ? (+Number(iconStyle.fontSize) || 24) : 24;\n const width = fontSize * maxRating + iconPadding * (maxRating - 1);\n const offset = Math.floor(currRating) * (fontSize + iconPadding) + (currRating % 1) * fontSize;\n const lastIndex = maxRating - 1;\n\n const normalRatings = (\n \n {Array(maxRating).fill(0).map((zero, index) => (\n {\n this.handleRationClick(e, index);\n }}\n >\n {icon}\n \n ))}\n \n );\n return normalRatings;\n }", "documentation": "", "type": "(notRated?: boolean) => Element" }, diff --git a/src/RatingControl/index.tsx b/src/RatingControl/index.tsx index cbeb8cd2..7e6ef01b 100644 --- a/src/RatingControl/index.tsx +++ b/src/RatingControl/index.tsx @@ -16,10 +16,6 @@ export interface DataProps { * Control show custom `Icon`. */ icon?: string; - /** - * Control show custom `React.ReactNode`. - */ - iconNode?: React.ReactNode; /** * Control custom `Icon Style`. */ @@ -91,7 +87,7 @@ export class RatingControl extends React.Component { - const { maxRating, iconNode, icon, iconStyle, iconRatedStyle, isReadOnly, iconPadding } = this.props; + const { maxRating, icon, iconStyle, iconRatedStyle, isReadOnly, iconPadding } = this.props; const { currRating } = this.state; const { theme } = this.context; const ratio = currRating / maxRating; @@ -114,8 +110,7 @@ export class RatingControl extends React.Component {Array(maxRating).fill(0).map((zero, index) => ( - iconNode || ( - {icon} - ) ))} ); @@ -141,7 +135,6 @@ export class RatingControl extends React.Component