Commit 4da7e7d7 authored by Mickaël Bourgier's avatar Mickaël Bourgier
Browse files

[Collapse] Deprecate default prop `appear`

parent 075a72c4
......@@ -103,6 +103,7 @@ class Collapse extends React.Component {
render() {
const {
appear = false,
children,
classes,
className,
......@@ -121,6 +122,7 @@ class Collapse extends React.Component {
return (
<Transition
appear={appear}
onEnter={this.handleEnter}
onEntered={this.handleEntered}
onEntering={this.handleEntering}
......@@ -166,7 +168,20 @@ Collapse.propTypes = {
/**
* Déclenche une transition lorsque le composant est monté
*/
appear: PropTypes.bool,
appear: (props, propName, componentName, location, propFullName) => {
const componentNameSafe = componentName || '<<anonymous>>';
const propFullNameSafe = propFullName || propName;
if (typeof props[propName] === 'undefined') {
return new Error(
`The default value of ${location} \`${propFullNameSafe}\` of ` +
`\`${componentNameSafe}\` and will change to \`true\` in v2.0. ` +
`Explicitly set the value to turn off this warning.`
);
}
return null;
},
/**
* Contenu du composant
......
......@@ -82,6 +82,7 @@ class DynamicProps extends Component {
</div>
<div className={classes.wrapper}>
<Collapse
appear={false}
duration={{
enter: durationEnter,
exit: durationExit
......@@ -91,6 +92,7 @@ class DynamicProps extends Component {
<div className={classes.box}>Play with me !</div>
</Collapse>
<Collapse
appear={false}
duration={{
enter: durationEnter,
exit: durationExit
......
......@@ -60,7 +60,7 @@ class NestedList extends Component {
<MdKeyboardArrowDown />
</ListItemIcon>
</ListItem>
<Collapse in={!collapsed} duration='auto'>
<Collapse appear={false} in={!collapsed} duration='auto'>
<List>
<ListItem>
<ListItemText>Une autre liste...</ListItemText>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment