Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
91f63f3
transition check inline
zombieJ May 23, 2018
7f42155
support exclusive
zombieJ May 23, 2018
7058a95
not display animate when browser not support
zombieJ May 23, 2018
8a320b1
clean appear logic
zombieJ May 23, 2018
00ac611
adjust appear logic
zombieJ May 23, 2018
0b568a2
use native event listener
zombieJ May 23, 2018
07d3819
fix example
zombieJ May 23, 2018
7156338
keep the transition
zombieJ May 23, 2018
db3e211
support animation
zombieJ May 24, 2018
f4da567
put animate handler into state
zombieJ May 24, 2018
aaf2569
sync logic in didMount
zombieJ May 25, 2018
25fc778
update func name
zombieJ May 25, 2018
2761c29
support customize handler display
zombieJ May 25, 2018
1e17078
adjust animate show logic
zombieJ May 25, 2018
6267a5f
use old velocity
zombieJ May 25, 2018
3bc933d
adjust logic of leave
zombieJ May 25, 2018
92a67fb
adjust leave logic
zombieJ May 25, 2018
f38ab44
fix in IE
zombieJ May 25, 2018
4a5eb53
redesign the animate logic
zombieJ May 28, 2018
4588898
trigger onEvent
zombieJ May 28, 2018
7c7348d
addtional leave trigger when transitionLeave is false
zombieJ May 28, 2018
4de2060
clean up when new event come
zombieJ May 28, 2018
e736890
event will only fire once
zombieJ May 28, 2018
8fa534d
fit for es5
zombieJ May 29, 2018
16053da
clean up
zombieJ May 29, 2018
fdbce3d
add additional check if transition event not fire
zombieJ May 29, 2018
10231c5
add key match test case
zombieJ May 30, 2018
73d7caf
add util related test case
zombieJ May 30, 2018
ec375c3
add children remove test case
zombieJ May 30, 2018
f7354ed
add event dedup test
zombieJ May 30, 2018
b114904
add exclusive test case
zombieJ May 30, 2018
c1b3b15
add exclusive test case
zombieJ May 30, 2018
bf3833b
trigger remove when transitionLeave i false
zombieJ May 30, 2018
cf93061
add animation clean up test
zombieJ May 30, 2018
e99a003
add wrapper for test usage
zombieJ May 30, 2018
7d092fd
onXXX event test case
zombieJ May 30, 2018
1f5a5a1
keep show when animate object exist
zombieJ May 30, 2018
ef63427
fix coverage in react 16.4
zombieJ Jun 1, 2018
ae673fa
add get dom element func
zombieJ Jun 6, 2018
125bbe0
fix for new lint
zombieJ Jun 11, 2018
c9840d5
skip event if animateObj is empty
zombieJ Jun 11, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions examples/alert.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
/* eslint no-console:0, react/no-multi-comp:0 */

import './assets/index.less';
import React from 'react';
import PropTypes from 'prop-types';
import ReactDOM from 'react-dom';
import Animate from 'rc-animate';
import './assets/index.less';

let seed = 0;

class Alert extends React.Component {
Expand Down Expand Up @@ -77,13 +78,12 @@ class AlertGroup extends React.Component {

render() {
const alerts = this.state.alerts;
const self = this;
const children = alerts.map((a) => {
if (!a.key) {
seed++;
a.key = String(seed);
}
return <Alert {...a} onEnd={self.onEnd.bind(self, a.key)}/>;
return <Alert {...a} onEnd={() => { this.onEnd(a.key); }} />;
});
const style = {
position: 'fixed',
Expand Down
8 changes: 5 additions & 3 deletions examples/hide-todo.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
/* eslint no-console:0, react/no-multi-comp:0 */

import './assets/index.less';
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 = {
Expand Down Expand Up @@ -48,7 +49,8 @@ class TodoList extends React.Component {
{ content: 'hello', visible: true },
{ content: 'world', visible: true },
{ content: 'click', visible: true },
{ content: 'me', visible: true }],
{ content: 'me', visible: true },
],
}

handleHide = (i, item) => {
Expand All @@ -66,7 +68,7 @@ class TodoList extends React.Component {
<Todo
key={item.content}
visible={item.visible}
onClick={this.handleHide.bind(this, i, item)}
onClick={() => { this.handleHide(i, item); }}
>
{item.content}
</Todo>
Expand Down
32 changes: 15 additions & 17 deletions examples/simple-animation.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
/* eslint no-console:0, react/no-multi-comp:0 */

import './assets/index.less';
import Animate from 'rc-animate';
import React from 'react';
import PropTypes from 'prop-types';
import ReactDOM from 'react-dom';
import velocity from 'velocity-animate';
import './assets/index.less';

class Box extends React.Component {
static propTypes = {
visible: PropTypes.bool,
}
const Box = (props) => {
const style = {
width: '200px',
display: props.visible ? 'block' : 'none',
height: '200px',
backgroundColor: 'red',
};
return (<div style={style} />);
};

render() {
const style = {
width: '200px',
display: this.props.visible ? 'block' : 'none',
height: '200px',
backgroundColor: 'red',
};
return (<div style={style}></div>);
}
}
Box.propTypes = {
visible: PropTypes.bool,
};

class Demo extends React.Component {
state = {
Expand Down Expand Up @@ -108,14 +106,14 @@ class Demo extends React.Component {
<div>
<label><input
type="checkbox"
onChange={this.toggle.bind(this, 'visible')}
onChange={() => { this.toggle('visible'); }}
checked={this.state.visible}
/>
show</label>
&nbsp;
<label><input
type="checkbox"
onChange={this.toggle.bind(this, 'exclusive')}
onChange={() => { this.toggle('exclusive'); }}
checked={this.state.exclusive}
/>
exclusive</label>
Expand Down
2 changes: 1 addition & 1 deletion examples/simple-remove.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* eslint no-console:0, react/no-multi-comp:0 */

import './assets/index.less';
import Animate from 'rc-animate';
import React from 'react';
import ReactDOM from 'react-dom';
import './assets/index.less';

class Demo extends React.Component {
state = {
Expand Down
6 changes: 3 additions & 3 deletions examples/simple.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/* eslint no-console:0, react/no-multi-comp:0 */

import './assets/slow.less';
import Animate from 'rc-animate';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import ReactDOM from 'react-dom';
import './assets/slow.less';

const Div = (props) => {
const { style, show, ...restProps } = props;
Expand Down Expand Up @@ -43,14 +43,14 @@ class Demo extends Component {
<div>
<label><input
type="checkbox"
onChange={this.toggle.bind(this, 'enter')}
onChange={() => { this.toggle('enter'); }}
checked={this.state.enter}
/>
show</label>
&nbsp;
<label><input
type="checkbox"
onChange={this.toggle.bind(this, 'exclusive')}
onChange={() => { this.toggle('exclusive'); }}
checked={this.state.exclusive}
/>
exclusive</label>
Expand Down
8 changes: 4 additions & 4 deletions examples/todo-animation.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/* eslint no-console:0, react/no-multi-comp:0, no-alert:0 */

import './assets/index.less';
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 = {
Expand Down Expand Up @@ -94,7 +94,7 @@ class TodoList extends React.Component {

handleAdd = () => {
const newItems =
this.state.items.concat([prompt('Enter some text')]);
this.state.items.concat([prompt('Enter some text')]); // eslint-disable-line
this.setState({ items: newItems });
}

Expand All @@ -113,7 +113,7 @@ class TodoList extends React.Component {
render() {
const items = this.state.items.map((item, i) => {
return (
<Todo key={item} onClick={this.handleRemove.bind(this, i)}>
<Todo key={item} onClick={() => { this.handleRemove(i); }}>
{item}
</Todo>
);
Expand All @@ -129,7 +129,7 @@ class TodoList extends React.Component {
<label>
<input
type="checkbox"
onChange={this.toggle.bind(this, 'exclusive')}
onChange={() => { this.toggle('exclusive'); }}
checked={this.state.exclusive}
/>
exclusive</label>
Expand Down
6 changes: 3 additions & 3 deletions examples/todo.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/* eslint no-console:0, react/no-multi-comp:0, no-alert:0 */

import './assets/index.less';
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 = {
Expand Down Expand Up @@ -45,7 +45,7 @@ class TodoList extends React.Component {
}

handleAdd = () => {
const items = this.state.items.concat([prompt('Enter some text')]);
const items = this.state.items.concat([prompt('Enter some text')]); // eslint-disable-line
this.setState({ items });
}

Expand All @@ -58,7 +58,7 @@ class TodoList extends React.Component {
render() {
const items = this.state.items.map((item, i) => {
return (
<Todo key={item} onClick={this.handleRemove.bind(this, i)}>
<Todo key={item} onClick={() => { this.handleRemove(i) }}>
{item}
</Todo>
);
Expand Down
32 changes: 15 additions & 17 deletions examples/transitionAppear.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
/* eslint no-console:0, react/no-multi-comp:0 */

import './assets/slow.less';
import Animate from 'rc-animate';
import React from 'react';
import PropTypes from 'prop-types';
import ReactDOM from 'react-dom';
import './assets/slow.less';

class Box extends React.Component {
static propTypes = {
visible: PropTypes.bool,
}
const Box = (props) => {
console.log('render', props.visible);
const style = {
display: props.visible ? 'block' : 'none',
marginTop: '20px',
width: '200px',
height: '200px',
backgroundColor: 'red',
};
return (<div style={style} />);
};

render() {
console.log('render', this.props.visible);
const style = {
display: this.props.visible ? 'block' : 'none',
marginTop: '20px',
width: '200px',
height: '200px',
backgroundColor: 'red',
};
return (<div style={style}/>);
}
}
Box.propTypes = {
visible: PropTypes.bool,
};

class Demo extends React.Component {
state = {
Expand Down
2 changes: 1 addition & 1 deletion examples/transitionLeave.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* eslint no-console:0, react/no-multi-comp:0 */

import './assets/index.less';
import Animate from 'rc-animate';
import React from 'react';
import ReactDOM from 'react-dom';
import './assets/index.less';

class Demo extends React.Component {
state = {
Expand Down
13 changes: 9 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
"jquery": "^3.3.1",
"pre-commit": "1.x",
"rc-test": "6.x",
"rc-tools": "6.x",
"react": "^16.0.0",
"rc-tools": "8.x",
"react": "^16.3.0",
"react-dom": "^16.0.0",
"velocity-animate": "~1.2.2"
},
Expand All @@ -56,7 +56,12 @@
],
"dependencies": {
"babel-runtime": "6.x",
"css-animation": "^1.3.2",
"prop-types": "15.x"
"classnames": "^2.2.5",
"component-classes": "^1.2.6",
"fbjs": "^0.8.16",
"prop-types": "15.x",
"raf": "^3.4.0",
"rc-util": "^4.5.0",
"react-lifecycles-compat": "^3.0.4"
}
}
Loading