Skip to content

Commit

Permalink
[changed] deprecated the Transition duration prop
Browse files Browse the repository at this point in the history
  • Loading branch information
jquense committed Aug 17, 2015
1 parent eeb0aea commit 03a6a61
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
16 changes: 16 additions & 0 deletions src/Collapse.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React from 'react';
import Transition from 'react-overlays/lib/Transition';
import domUtils from './utils/domUtils';
import CustomPropTypes from './utils/CustomPropTypes';
import deprecationWarning from './deprecationWarning';
import createChainedFunction from './utils/createChainedFunction';

let capitalize = str => str[0].toUpperCase() + str.substr(1);
Expand Down Expand Up @@ -140,6 +142,20 @@ Collapse.propTypes = {
*/
timeout: React.PropTypes.number,

/**
* duration
* @private
*/
duration: CustomPropTypes.all([
React.PropTypes.number,
(props)=> {
if (props.duration != null){
deprecationWarning('Collapse `duration`', 'the `timeout` prop');
}
return null;
}
]),

/**
* Callback fired before the component expands
*/
Expand Down
20 changes: 19 additions & 1 deletion src/Fade.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import React from 'react';
import Transition from 'react-overlays/lib/Transition';
import CustomPropTypes from './utils/CustomPropTypes';
import deprecationWarning from './deprecationWarning';

class Fade extends React.Component {
render() {
let timeout = this.props.timeout || this.props.duration;

return (
<Transition
{...this.props}
timeout={timeout}
className='fade'
enteredClassName='in'
enteringClassName='in'
Expand All @@ -18,7 +23,6 @@ class Fade extends React.Component {

// Explicitly copied from Transition for doc generation.
// TODO: Remove duplication once #977 is resolved.

Fade.propTypes = {
/**
* Show the component; triggers the fade in or fade out animation
Expand All @@ -43,6 +47,20 @@ Fade.propTypes = {
*/
timeout: React.PropTypes.number,

/**
* duration
* @private
*/
duration: CustomPropTypes.all([
React.PropTypes.number,
(props)=> {
if (props.duration != null){
deprecationWarning('Fade `duration`', 'the `timeout` prop');
}
return null;
}
]),

/**
* Callback fired before the component fades in
*/
Expand Down

0 comments on commit 03a6a61

Please sign in to comment.