From b391bf6831eab3e8e55ba8a12aeda6913a297869 Mon Sep 17 00:00:00 2001 From: Wei Zhu Date: Tue, 31 Oct 2017 15:06:18 +0800 Subject: [PATCH] Return children directly if fragment is supported --- src/Animate.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Animate.js b/src/Animate.js index 0a625ce..4a37f57 100644 --- a/src/Animate.js +++ b/src/Animate.js @@ -11,6 +11,8 @@ import AnimateChild from './AnimateChild'; const defaultKey = `rc_animate_${Date.now()}`; import animUtil from './util'; +const IS_FRAGMENT_SUPPORTED = React.version > '16'; + function getChildrenFromProps(props) { const children = props.children; if (React.isValidElement(children)) { @@ -328,6 +330,9 @@ export default class Animate extends React.Component { } return {children}; } + if (IS_FRAGMENT_SUPPORTED) { + return children; + } return children[0] || null; } }