Fix snapshot generate, close #7318

This commit is contained in:
afc163 2017-08-27 16:07:07 +08:00
parent 53ffc83d23
commit d84452e8b8

View File

@ -1,6 +1,5 @@
import React from 'react';
import PropTypes from 'prop-types';
import { findDOMNode } from 'react-dom';
import classNames from 'classnames';
import Animate from 'rc-animate';
import isCssAnimationSupported from '../_util/isCssAnimationSupported';
@ -50,7 +49,9 @@ export default class Spin extends React.Component<SpinProps, any> {
componentDidMount() {
if (!isCssAnimationSupported()) {
// Show text in IE8/9
findDOMNode(this).className += ` ${this.props.prefixCls}-show-text`;
this.setState({
notCssAnimationSupported: true,
});
}
}
@ -89,13 +90,13 @@ export default class Spin extends React.Component<SpinProps, any> {
}
render() {
const { className, size, prefixCls, tip, wrapperClassName, ...restProps } = this.props;
const { spinning } = this.state;
const { spinning, notCssAnimationSupported } = this.state;
const spinClassName = classNames(prefixCls, {
[`${prefixCls}-sm`]: size === 'small',
[`${prefixCls}-lg`]: size === 'large',
[`${prefixCls}-spinning`]: spinning,
[`${prefixCls}-show-text`]: !!tip,
[`${prefixCls}-show-text`]: !!tip || notCssAnimationSupported,
}, className);
// fix https://fb.me/react-unknown-prop