|
@@ -12,7 +12,7 @@ type Props = {
|
12
|
12
|
title: string,
|
13
|
13
|
subtitle?: string,
|
14
|
14
|
left?: (props: { [keys: string]: any }) => React.Node,
|
15
|
|
- opened: boolean,
|
|
15
|
+ opened?: boolean,
|
16
|
16
|
unmountWhenCollapsed: boolean,
|
17
|
17
|
children?: React.Node,
|
18
|
18
|
}
|
|
@@ -26,7 +26,6 @@ const AnimatedListIcon = Animatable.createAnimatableComponent(List.Icon);
|
26
|
26
|
class AnimatedAccordion extends React.Component<Props, State> {
|
27
|
27
|
|
28
|
28
|
static defaultProps = {
|
29
|
|
- opened: false,
|
30
|
29
|
unmountWhenCollapsed: false,
|
31
|
30
|
}
|
32
|
31
|
chevronRef: { current: null | AnimatedListIcon };
|
|
@@ -35,7 +34,7 @@ class AnimatedAccordion extends React.Component<Props, State> {
|
35
|
34
|
animEnd: string;
|
36
|
35
|
|
37
|
36
|
state = {
|
38
|
|
- expanded: this.props.opened,
|
|
37
|
+ expanded: this.props.opened != null ? this.props.opened : false,
|
39
|
38
|
}
|
40
|
39
|
|
41
|
40
|
constructor(props) {
|
|
@@ -63,7 +62,8 @@ class AnimatedAccordion extends React.Component<Props, State> {
|
63
|
62
|
};
|
64
|
63
|
|
65
|
64
|
shouldComponentUpdate(nextProps: Props) {
|
66
|
|
- this.state.expanded = nextProps.opened;
|
|
65
|
+ if (nextProps.opened != null)
|
|
66
|
+ this.state.expanded = nextProps.opened;
|
67
|
67
|
this.setupChevron();
|
68
|
68
|
return true;
|
69
|
69
|
}
|