Fixed search results not showing

This commit is contained in:
Arnaud Vergnet 2020-04-16 11:55:18 +02:00
parent 9baaed9f6a
commit b2d7cf61cc
2 changed files with 6 additions and 1 deletions

View file

@ -49,6 +49,7 @@ class GroupListAccordion extends React.Component<Props, State> {
renderItem = ({item}: Object) => { renderItem = ({item}: Object) => {
if (stringMatchQuery(item.name, this.props.currentSearchString)) { if (stringMatchQuery(item.name, this.props.currentSearchString)) {
const onPress = () => this.props.onGroupPress(item); const onPress = () => this.props.onGroupPress(item);
const onStartPress = () => this.props.onFavoritePress(item); const onStartPress = () => this.props.onFavoritePress(item);
return ( return (
@ -80,6 +81,9 @@ class GroupListAccordion extends React.Component<Props, State> {
render() { render() {
const item = this.props.item; const item = this.props.item;
console.log("=====================================================");
console.log(this.props.currentSearchString);
console.log(this.state.expanded);
return ( return (
<List.Accordion <List.Accordion
title={item.name} title={item.name}
@ -106,7 +110,7 @@ class GroupListAccordion extends React.Component<Props, State> {
keyExtractor={this.keyExtractor} keyExtractor={this.keyExtractor}
listKey={item.id} listKey={item.id}
// Performance props, see https://reactnative.dev/docs/optimizing-flatlist-configuration // Performance props, see https://reactnative.dev/docs/optimizing-flatlist-configuration
getItemLayout={this.itemLayout} // getItemLayout={this.itemLayout} // Broken with search
removeClippedSubviews={true} removeClippedSubviews={true}
/> />
</List.Accordion> </List.Accordion>

View file

@ -80,6 +80,7 @@ class GroupSelectionScreen extends React.Component<Props, State> {
* @param str The new search string * @param str The new search string
*/ */
onSearchStringChange = (str: string) => { onSearchStringChange = (str: string) => {
console.log('search');
this.setState({currentSearchString: str}) this.setState({currentSearchString: str})
}; };