Animation now works with custom expand management

This commit is contained in:
Yassien
2019-03-16 19:03:22 +02:00
parent 33c026c7e2
commit 8f304a849f

View File

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