fix: import multiple times

This commit is contained in:
dian.li 2019-08-15 09:47:04 +08:00
parent 882f343e10
commit 3e1560d753
3 changed files with 6 additions and 9 deletions

View File

@ -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<ScrollNumberProps, ScrollNumberState> {
class ScrollNumber extends React.Component<ScrollNumberProps, ScrollNumberState> {
static defaultProps = {
count: null,
onAnimated() {},
@ -127,7 +126,7 @@ class ScrollNumber extends Component<ScrollNumberProps, ScrollNumberState> {
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<ScrollNumberProps, ScrollNumberState> {
),
});
}
return createElement(component as any, newProps, this.renderNumberElement(prefixCls));
return React.createElement(component as any, newProps, this.renderNumberElement(prefixCls));
};
render() {

View File

@ -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<BreadcrumbProps, any> {
"Only accepts Breadcrumb.Item and Breadcrumb.Separator as it's children",
);
return cloneElement(element, {
return React.cloneElement(element, {
separator,
key: index,
});

View File

@ -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<any>) {
...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<TooltipProps, any> {
onVisibleChange={this.onVisibleChange}
onPopupAlign={this.onPopupAlign}
>
{visible ? cloneElement(child, { className: childCls }) : child}
{visible ? React.cloneElement(child, { className: childCls }) : child}
</RcTooltip>
);
};