diff --git a/src/components/Animations/AnimatedAccordion.js b/src/components/Animations/AnimatedAccordion.js index f54da60..5e4acb9 100644 --- a/src/components/Animations/AnimatedAccordion.js +++ b/src/components/Animations/AnimatedAccordion.js @@ -57,8 +57,8 @@ class AnimatedAccordion extends React.Component { } setupChevron() { - const {state} = this; - if (state.expanded) { + const {expanded} = this.state; + if (expanded) { this.chevronIcon = 'chevron-up'; this.animStart = '180deg'; this.animEnd = '0deg'; @@ -70,12 +70,14 @@ class AnimatedAccordion extends React.Component { } toggleAccordion = () => { - const {state} = this; + const {expanded} = this.state; if (this.chevronRef.current != null) { this.chevronRef.current.transitionTo({ - rotate: state.expanded ? this.animStart : this.animEnd, + rotate: expanded ? this.animStart : this.animEnd, }); - this.setState({expanded: !state.expanded}); + this.setState((prevState: StateType): {expanded: boolean} => ({ + expanded: !prevState.expanded, + })); } }; @@ -87,15 +89,16 @@ class AnimatedAccordion extends React.Component { ( )} left={props.left} diff --git a/src/components/Lists/PlanexGroups/GroupListAccordion.js b/src/components/Lists/PlanexGroups/GroupListAccordion.js index 75ffce7..1a15bfe 100644 --- a/src/components/Lists/PlanexGroups/GroupListAccordion.js +++ b/src/components/Lists/PlanexGroups/GroupListAccordion.js @@ -96,7 +96,6 @@ class GroupListAccordion extends React.Component { } unmountWhenCollapsed // Only render list if expanded for increased performance opened={props.item.id === 0 || props.currentSearchString.length > 0}> - {/* $FlowFixMe */}