diff --git a/src/components/Animations/AnimatedAccordion.js b/src/components/Animations/AnimatedAccordion.js index 62c6454..9cc7dba 100644 --- a/src/components/Animations/AnimatedAccordion.js +++ b/src/components/Animations/AnimatedAccordion.js @@ -63,7 +63,9 @@ class AnimatedAccordion extends React.Component { }; shouldComponentUpdate(nextProps: Props, nextState: State): boolean { - return nextState.expanded !== this.state.expanded; + if (nextProps.opened != null && nextProps.opened !== this.props.opened) + this.state.expanded = nextProps.opened; + return true; } render() { diff --git a/src/components/Lists/PlanexGroups/GroupListAccordion.js b/src/components/Lists/PlanexGroups/GroupListAccordion.js index 6dbfecc..73139cd 100644 --- a/src/components/Lists/PlanexGroups/GroupListAccordion.js +++ b/src/components/Lists/PlanexGroups/GroupListAccordion.js @@ -23,10 +23,6 @@ const LIST_ITEM_HEIGHT = 64; class GroupListAccordion extends React.Component { - constructor(props) { - super(props); - } - shouldComponentUpdate(nextProps: Props) { return (nextProps.currentSearchString !== this.props.currentSearchString) || (nextProps.favoriteNumber !== this.props.favoriteNumber) @@ -35,19 +31,26 @@ class GroupListAccordion extends React.Component { keyExtractor = (item: group) => item.id.toString(); - renderItem = ({item}: {item: group}) => { - if (stringMatchQuery(item.name, this.props.currentSearchString)) { - const onPress = () => this.props.onGroupPress(item); - const onStarPress = () => this.props.onFavoritePress(item); - return ( - - ); - } else - return null; + renderItem = ({item}: { item: group }) => { + const onPress = () => this.props.onGroupPress(item); + const onStarPress = () => this.props.onFavoritePress(item); + return ( + + ); + } + + getData() { + const originalData = this.props.item.content; + let displayData = []; + for (let i = 0; i < originalData.length; i++) { + if (stringMatchQuery(originalData[i].name, this.props.currentSearchString)) + displayData.push(originalData[i]); + } + return displayData; } render() { @@ -73,7 +76,7 @@ class GroupListAccordion extends React.Component { > {/*$FlowFixMe*/}