Skip to content

Commit

Permalink
remove react-lifecycles-compat/babel-runtime/prop-types
Browse files Browse the repository at this point in the history
  • Loading branch information
afc163 committed May 7, 2020
1 parent 45eccd9 commit a1703a2
Show file tree
Hide file tree
Showing 15 changed files with 17 additions and 147 deletions.
5 changes: 2 additions & 3 deletions examples/CSSMotion.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* eslint no-console:0, react/no-multi-comp:0 */
/* eslint no-console:0, react/no-multi-comp:0, react/prop-types: 0 */

import React from 'react';
// import PropTypes from 'prop-types';
import ReactDOM from 'react-dom';
import { CSSMotion } from 'rc-animate';
import classNames from 'classnames';
Expand Down Expand Up @@ -155,4 +154,4 @@ ReactDOM.render(<Demo />, document.getElementById('__react-content'));

// Remove for IE9 test
// const aaa = document.getElementsByClassName('navbar')[0];
// aaa.parentNode.removeChild(aaa);
// aaa.parentNode.removeChild(aaa);
3 changes: 1 addition & 2 deletions examples/CSSMotionDeadline.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* eslint no-console:0, react/no-multi-comp:0 */
/* eslint no-console:0, react/no-multi-comp:0, react/prop-types: 0 */

import React from 'react';
// import PropTypes from 'prop-types';
import ReactDOM from 'react-dom';
import { CSSMotion } from 'rc-animate';
import classNames from 'classnames';
Expand Down
11 changes: 1 addition & 10 deletions examples/alert.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/* eslint no-console:0, react/no-multi-comp:0, react/jsx-no-bind:0 */

/* eslint no-console:0, react/no-multi-comp:0, react/jsx-no-bind:0, react/prop-types: 0 */
import React from 'react';
import PropTypes from 'prop-types';
import ReactDOM from 'react-dom';
import Animate from 'rc-animate';

Expand All @@ -10,13 +8,6 @@ import './assets/index.less';
let seed = 0;

class Alert extends React.Component {
static propTypes = {
time: PropTypes.number,
type: PropTypes.string,
str: PropTypes.string,
onEnd: PropTypes.func,
}

static defaultProps = {
onEnd() {},
time: 2000,
Expand Down
10 changes: 1 addition & 9 deletions examples/hide-todo.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
/* eslint no-console:0, react/no-multi-comp:0, react/jsx-no-bind:0 */
/* eslint no-console:0, react/no-multi-comp:0, react/jsx-no-bind:0, react/prop-types: 0 */

import React from 'react';
import PropTypes from 'prop-types';
import ReactDOM from 'react-dom';
import Animate from 'rc-animate';

import './assets/index.less';

class Todo extends React.Component {
static propTypes = {
children: PropTypes.any,
end: PropTypes.func,
onClick: PropTypes.func,
visible: PropTypes.bool,
}

static defaultProps = {
visible: true,
end() {},
Expand Down
7 changes: 1 addition & 6 deletions examples/simple-animation.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/* eslint no-console:0, react/no-multi-comp:0, react/jsx-no-bind:0 */
/* eslint no-console:0, react/no-multi-comp:0, react/jsx-no-bind:0, react/prop-types: 0 */

import Animate from 'rc-animate';
import React from 'react';
import PropTypes from 'prop-types';
import ReactDOM from 'react-dom';
import velocity from 'velocity-animate';

Expand All @@ -18,10 +17,6 @@ const Box = props => {
return (<div style={style} />);
};

Box.propTypes = {
visible: PropTypes.bool,
}

class Demo extends React.Component {
state = {
destroyed: false,
Expand Down
9 changes: 1 addition & 8 deletions examples/simple.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/* eslint no-console:0, react/no-multi-comp:0, react/jsx-no-bind:0 */
/* eslint no-console:0, react/no-multi-comp:0, react/jsx-no-bind:0, react/prop-types: 0 */

import Animate from 'rc-animate';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import ReactDOM from 'react-dom';

import './assets/slow.less';
Expand All @@ -13,13 +12,7 @@ const Div = (props) => {
return <div {...restProps} style={newStyle}/>;
};

Div.propTypes = {
style: PropTypes.object,
show: PropTypes.bool,
};

class Demo extends Component {

constructor(props) {
super(props);
this.state = {
Expand Down
9 changes: 1 addition & 8 deletions examples/todo-animation.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
/* eslint no-console:0, react/no-multi-comp:0, no-alert:0, no-undef:0, react/jsx-no-bind:0 */
/* eslint no-console:0, react/no-multi-comp:0, no-alert:0, no-undef:0, react/jsx-no-bind:0, react/prop-types: 0 */

import React from 'react';
import PropTypes from 'prop-types';
import ReactDOM from 'react-dom';
import Animate from 'rc-animate';
import velocity from 'velocity-animate';

import './assets/index.less';

class Todo extends React.Component {
static propTypes = {
children: PropTypes.any,
end: PropTypes.func,
onClick: PropTypes.func,
}

static defaultProps = {
end() {},
}
Expand Down
9 changes: 1 addition & 8 deletions examples/todo.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
/* eslint no-console:0, react/no-multi-comp:0, no-alert:0, no-undef:0, react/jsx-no-bind:0 */
/* eslint no-console:0, react/no-multi-comp:0, no-alert:0, no-undef:0, react/jsx-no-bind:0, react/prop-types: 0 */

import React from 'react';
import PropTypes from 'prop-types';
import ReactDOM from 'react-dom';
import Animate from 'rc-animate';

import './assets/index.less';

class Todo extends React.Component {
static propTypes = {
children: PropTypes.any,
end: PropTypes.func,
onClick: PropTypes.func,
}

static defaultProps = {
end() {},
}
Expand Down
7 changes: 1 addition & 6 deletions examples/transitionAppear.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/* eslint no-console:0, react/no-multi-comp:0 */
/* eslint no-console:0, react/no-multi-comp:0, react/prop-types: 0 */

import Animate from 'rc-animate';
import React from 'react';
import PropTypes from 'prop-types';
import ReactDOM from 'react-dom';

import './assets/slow.less';
Expand All @@ -19,10 +18,6 @@ const Box = props => {
return (<div style={style}/>);
};

Box.propTypes = {
visible: PropTypes.bool,
}

class Demo extends React.Component {
state = {
visible: true,
Expand Down
7 changes: 2 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"build": "rc-tools run build",
"gh-pages": "rc-tools run gh-pages",
"start": "rc-tools run server",
"pub": "rc-tools run pub --babel-runtime",
"pub": "rc-tools run pub",
"lint": "rc-tools run lint",
"karma": "rc-test run karma",
"saucelabs": "rc-test run saucelabs",
Expand All @@ -56,12 +56,9 @@
"lint"
],
"dependencies": {
"babel-runtime": "6.x",
"classnames": "^2.2.6",
"@ant-design/css-animation": "^1.7.2",
"prop-types": "15.x",
"raf": "^3.4.0",
"rc-util": "^4.15.3",
"react-lifecycles-compat": "^3.0.4"
"rc-util": "^4.15.3"
}
}
24 changes: 1 addition & 23 deletions src/Animate.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint react/prop-types: 0 */
import React from 'react';
import PropTypes from 'prop-types';
import unsafeLifecyclesPolyfill from 'rc-util/lib/unsafeLifecyclesPolyfill';
import {
toArrayChildren,
Expand Down Expand Up @@ -31,28 +31,6 @@ function noop() {
class Animate extends React.Component {
static isAnimate = true; // eslint-disable-line

static propTypes = {
className: PropTypes.string,
style: PropTypes.object,
component: PropTypes.any,
componentProps: PropTypes.object,
animation: PropTypes.object,
transitionName: PropTypes.oneOfType([
PropTypes.string,
PropTypes.object,
]),
transitionEnter: PropTypes.bool,
transitionAppear: PropTypes.bool,
exclusive: PropTypes.bool,
transitionLeave: PropTypes.bool,
onEnd: PropTypes.func,
onEnter: PropTypes.func,
onLeave: PropTypes.func,
onAppear: PropTypes.func,
showProp: PropTypes.string,
children: PropTypes.node,
}

static defaultProps = {
animation: {},
component: 'span',
Expand Down
8 changes: 1 addition & 7 deletions src/AnimateChild.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint react/prop-types: 0 */
import React from 'react';
import ReactDOM from 'react-dom';
import PropTypes from 'prop-types';
import cssAnimate, { isCssAnimationSupported } from '@ant-design/css-animation';
import animUtil from './util/animate';

Expand All @@ -11,12 +11,6 @@ const transitionMap = {
};

export default class AnimateChild extends React.Component {
static propTypes = {
children: PropTypes.any,
animation: PropTypes.any,
transitionName: PropTypes.any,
}

componentWillUnmount() {
this.stop();
}
Expand Down
35 changes: 1 addition & 34 deletions src/CSSMotion.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/* eslint-disable react/default-props-match-prop-types, react/no-multi-comp */
/* eslint-disable react/default-props-match-prop-types, react/no-multi-comp, react/prop-types */
import React from 'react';
import PropTypes from 'prop-types';
import { polyfill } from 'react-lifecycles-compat';
import findDOMNode from 'rc-util/lib/Dom/findDOMNode';
import classNames from 'classnames';
import raf from 'raf';
Expand All @@ -17,29 +15,6 @@ const STATUS_APPEAR = 'appear';
const STATUS_ENTER = 'enter';
const STATUS_LEAVE = 'leave';

export const MotionPropTypes = {
eventProps: PropTypes.object, // Internal usage. Only pass by CSSMotionList
visible: PropTypes.bool,
children: PropTypes.func,
motionName: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
motionAppear: PropTypes.bool,
motionEnter: PropTypes.bool,
motionLeave: PropTypes.bool,
motionLeaveImmediately: PropTypes.bool, // Trigger leave motion immediately
motionDeadline: PropTypes.number,
removeOnLeave: PropTypes.bool,
leavedClassName: PropTypes.string,
onAppearStart: PropTypes.func,
onAppearActive: PropTypes.func,
onAppearEnd: PropTypes.func,
onEnterStart: PropTypes.func,
onEnterActive: PropTypes.func,
onEnterEnd: PropTypes.func,
onLeaveStart: PropTypes.func,
onLeaveActive: PropTypes.func,
onLeaveEnd: PropTypes.func,
};

/**
* `transitionSupport` is used for none transition test case.
* Default we use browser transition event support check.
Expand All @@ -58,12 +33,6 @@ export function genCSSMotion(config) {
}

class CSSMotion extends React.Component {
static propTypes = {
...MotionPropTypes,

internalRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func]),
};

static defaultProps = {
visible: true,
motionEnter: true,
Expand Down Expand Up @@ -341,8 +310,6 @@ export function genCSSMotion(config) {
}
}

polyfill(CSSMotion);

if (!forwardRef) {
return CSSMotion;
}
Expand Down
11 changes: 1 addition & 10 deletions src/CSSMotionList.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* eslint react/prop-types: 0 */
import React from 'react';
import { polyfill } from 'react-lifecycles-compat';
import PropTypes from 'prop-types';
import OriginCSSMotion, { MotionPropTypes } from './CSSMotion';
import { supportTransition } from './util/motion';
import {
Expand All @@ -16,12 +15,6 @@ const MOTION_PROP_NAMES = Object.keys(MotionPropTypes);

export function genCSSMotionList(transitionSupport, CSSMotion = OriginCSSMotion) {
class CSSMotionList extends React.Component {
static propTypes = {
...CSSMotion.propTypes,
component: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
keys: PropTypes.array,
};

static defaultProps = {
component: 'div',
};
Expand Down Expand Up @@ -119,8 +112,6 @@ export function genCSSMotionList(transitionSupport, CSSMotion = OriginCSSMotion)
}
}

polyfill(CSSMotionList);

return CSSMotionList;
}

Expand Down
9 changes: 1 addition & 8 deletions tests/multiple.spec.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
/* eslint no-console:0, react/no-multi-comp:0, react/jsx-no-bind:0 */
/* eslint no-console:0, react/no-multi-comp:0, react/jsx-no-bind:0, react/prop-types:0 */
import React from 'react';
import ReactDOM from 'react-dom';
import PropTypes from 'prop-types';
import TestUtils from 'react-dom/test-utils';
import expect from 'expect.js';
import CssAnimation from '@ant-design/css-animation';
import Animate from '../';
import './index.spec.css';

class Todo extends React.Component {
static propTypes = {
end: PropTypes.func,
onClick: PropTypes.func,
children: PropTypes.node,
}

static defaultProps = {
end() {},
}
Expand Down

0 comments on commit a1703a2

Please sign in to comment.