update search
This commit is contained in:
@@ -43,6 +43,17 @@ export default function ExploreScreen() {
|
||||
Keyboard.dismiss();
|
||||
}
|
||||
|
||||
function tagRemoved(tag: AutoCompleteItem) {
|
||||
const nextTags = tags.filter((t) => t.text !== tag.text);
|
||||
setTags(nextTags);
|
||||
const inputs = nextTags.map((t) => t.text);
|
||||
getSearchResults(inputs, 50)
|
||||
.then((items) => {
|
||||
setResults(items || []);
|
||||
})
|
||||
.catch(console.error);
|
||||
}
|
||||
|
||||
// Keep our local show cache in sync with SHOW items returned by search
|
||||
React.useEffect(() => {
|
||||
const fromResults: Record<number, Show> = {};
|
||||
@@ -161,7 +172,10 @@ export default function ExploreScreen() {
|
||||
key={tag.text}
|
||||
icon={getIconName(tag.type)}
|
||||
label={tag.text}
|
||||
onPress={() => setTags((prev) => prev.filter((t) => t.text !== tag.text))}
|
||||
onPress={() => {
|
||||
tagRemoved(tag);
|
||||
|
||||
}}
|
||||
/>
|
||||
))}
|
||||
</View>
|
||||
|
||||
Reference in New Issue
Block a user