From d10309b86c12f8ed9b91c603f99cf551ce996869 Mon Sep 17 00:00:00 2001 From: Sebastian Silbermann Date: Fri, 8 Feb 2019 14:22:31 +0100 Subject: [PATCH] [Fade] Fix propTypes not warning on missing child element --- packages/material-ui/src/Fade/Fade.js | 4 ++-- pages/api/fade.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/material-ui/src/Fade/Fade.js b/packages/material-ui/src/Fade/Fade.js index 576153dbcc5e76..37654f391d9bf2 100644 --- a/packages/material-ui/src/Fade/Fade.js +++ b/packages/material-ui/src/Fade/Fade.js @@ -61,7 +61,7 @@ class Fade extends React.Component { const style = { ...styleProp, - ...(React.isValidElement(children) ? children.props.style : {}), + ...children.props.style, }; return ( @@ -87,7 +87,7 @@ Fade.propTypes = { /** * A single child content element. */ - children: PropTypes.oneOfType([PropTypes.element, PropTypes.func]), + children: PropTypes.element.isRequired, /** * If `true`, the component will transition in. */ diff --git a/pages/api/fade.md b/pages/api/fade.md index f3f8cf2be18d49..400657f8bf7441 100644 --- a/pages/api/fade.md +++ b/pages/api/fade.md @@ -21,7 +21,7 @@ The `hidden` prop will be set on the child according to the `in` prop. | Name | Type | Default | Description | |:-----|:-----|:--------|:------------| -| children | union: element |
 func
|   | A single child content element. | +| children * | element |   | A single child content element. | | in | bool |   | If `true`, the component will transition in. | | timeout | union: number |
 { enter?: number, exit?: number }
| { enter: duration.enteringScreen, exit: duration.leavingScreen,} | The duration for the transition, in milliseconds. You may specify a single timeout for all transitions, or individually with an object. |