From f52dcbfb376ad6d591daea1d47e4985428535937 Mon Sep 17 00:00:00 2001 From: Benjy Cui Date: Wed, 19 Oct 2016 09:45:46 +0800 Subject: [PATCH] chore: add warning for invalid usage, close: #3475 --- components/badge/index.tsx | 5 +++++ package.json | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/components/badge/index.tsx b/components/badge/index.tsx index 131605a383..cc08ca5b6c 100644 --- a/components/badge/index.tsx +++ b/components/badge/index.tsx @@ -2,6 +2,7 @@ import React from 'react'; import Animate from 'rc-animate'; import ScrollNumber from './ScrollNumber'; import classNames from 'classnames'; +import warning from 'warning'; import splitObject from '../_util/splitObject'; export interface BadgeProps { @@ -64,6 +65,10 @@ export default class Badge extends React.Component { [`${prefixCls}-not-a-wrapper`]: !children, }); + warning( + !(children && status), + '`Badge[children]` and `Badge[status]` cannot be used at the same time.' + ); // if (!children && status) { const statusCls = classNames({ diff --git a/package.json b/package.json index 31084f9781..0887ef9aba 100644 --- a/package.json +++ b/package.json @@ -82,7 +82,7 @@ "babel-jest": "^13.2.2", "babel-plugin-import": "^1.0.0", "babel-plugin-transform-runtime": "~6.15.0", - "bisheng": "^0.12.0", + "bisheng": "^0.13.0", "bisheng-plugin-antd": "~0.2.0", "bisheng-plugin-description": "^0.1.1", "bisheng-plugin-react": "^0.2.0",