From 3e1560d753cde5e9918308333c218965bcef4518 Mon Sep 17 00:00:00 2001 From: "dian.li" Date: Thu, 15 Aug 2019 09:47:04 +0800 Subject: [PATCH] fix: import multiple times --- components/badge/ScrollNumber.tsx | 7 +++---- components/breadcrumb/Breadcrumb.tsx | 3 +-- components/tooltip/index.tsx | 5 ++--- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/components/badge/ScrollNumber.tsx b/components/badge/ScrollNumber.tsx index 92f52db389..9917d7a52e 100644 --- a/components/badge/ScrollNumber.tsx +++ b/components/badge/ScrollNumber.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { createElement, Component } from 'react'; import omit from 'omit.js'; import classNames from 'classnames'; import { polyfill } from 'react-lifecycles-compat'; @@ -48,7 +47,7 @@ export interface ScrollNumberState { count?: string | number | null; } -class ScrollNumber extends Component { +class ScrollNumber extends React.Component { static defaultProps = { count: null, onAnimated() {}, @@ -127,7 +126,7 @@ class ScrollNumber extends Component { const position = this.getPositionByNum(num, i); const removeTransition = this.state.animateStarted || getNumberArray(this.lastCount)[i] === undefined; - return createElement( + return React.createElement( 'span', { className: `${prefixCls}-only`, @@ -201,7 +200,7 @@ class ScrollNumber extends Component { ), }); } - return createElement(component as any, newProps, this.renderNumberElement(prefixCls)); + return React.createElement(component as any, newProps, this.renderNumberElement(prefixCls)); }; render() { diff --git a/components/breadcrumb/Breadcrumb.tsx b/components/breadcrumb/Breadcrumb.tsx index de76e3f84c..4074e65f12 100755 --- a/components/breadcrumb/Breadcrumb.tsx +++ b/components/breadcrumb/Breadcrumb.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { cloneElement } from 'react'; import * as PropTypes from 'prop-types'; import classNames from 'classnames'; import BreadcrumbItem from './BreadcrumbItem'; @@ -152,7 +151,7 @@ export default class Breadcrumb extends React.Component { "Only accepts Breadcrumb.Item and Breadcrumb.Separator as it's children", ); - return cloneElement(element, { + return React.cloneElement(element, { separator, key: index, }); diff --git a/components/tooltip/index.tsx b/components/tooltip/index.tsx index 003c086fc5..7672d86382 100644 --- a/components/tooltip/index.tsx +++ b/components/tooltip/index.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { cloneElement } from 'react'; import { polyfill } from 'react-lifecycles-compat'; import RcTooltip from 'rc-tooltip'; import classNames from 'classnames'; @@ -116,7 +115,7 @@ function getDisabledCompatibleChildren(element: React.ReactElement) { ...omitted, pointerEvents: 'none', }; - const child = cloneElement(element, { + const child = React.cloneElement(element, { style: buttonStyle, className: null, }); @@ -264,7 +263,7 @@ class Tooltip extends React.Component { onVisibleChange={this.onVisibleChange} onPopupAlign={this.onPopupAlign} > - {visible ? cloneElement(child, { className: childCls }) : child} + {visible ? React.cloneElement(child, { className: childCls }) : child} ); };