This commit is contained in:
AllenFang 2019-04-07 17:33:00 +08:00
parent 363a43251f
commit 160dede412

View File

@ -17,13 +17,17 @@ class RowExpandProvider extends React.Component {
componentWillReceiveProps(nextProps) {
if (nextProps.expandRow) {
const nextExpanded = nextProps.expandRow.expanded || this.state.expanded;
const isClosing = this.state.expanded.reduce((acc, cur) => {
if (!nextProps.expandRow.expanded.includes(cur)) {
if (!nextExpanded.includes(cur)) {
acc.push(cur);
}
return acc;
}, []);
this.setState(() => ({ expanded: nextProps.expandRow.expanded, isClosing }));
this.setState(() => ({
expanded: nextExpanded,
isClosing
}));
} else {
this.setState(() => ({
expanded: this.state.expanded