import Button from '@app/components/Button' import GradientScrollView from '@app/components/GradientScrollView' import Header from '@app/components/Header' import ListItem from '@app/components/ListItem' import NothingHere from '@app/components/NothingHere' import TextInput from '@app/components/TextInput' import { withSuspense, withSuspenseMemo } from '@app/components/withSuspense' import { useQuerySearchResults } from '@app/hooks/query' import { useSetQueue } from '@app/hooks/trackplayer' import { Album, Artist, SearchResults, Song } from '@app/models/library' import colors from '@app/styles/colors' import font from '@app/styles/font' import { useFocusEffect, useNavigation } from '@react-navigation/native' import equal from 'fast-deep-equal/es6/react' import _ from 'lodash' import React, { useCallback, useMemo, useRef, useState } from 'react' import { useTranslation } from 'react-i18next' import { ActivityIndicator, InteractionManager, ScrollView, StyleSheet, TextInput as ReactTextInput, View, } from 'react-native' import { useSafeAreaInsets } from 'react-native-safe-area-context' const SongItem = React.memo<{ item: Song }>(({ item }) => { const { setQueue, contextId } = useSetQueue('song', [item]) return ( setQueue({ title: item.title, playTrack: 0 })} /> ) }, equal) const ResultsCategory = withSuspenseMemo<{ name: string query: string items: (Artist | Album | Song)[] type: 'artist' | 'album' | 'song' }>( ({ name, query, type, items }) => { const navigation = useNavigation() const { t } = useTranslation() if (items.length === 0) { return <> } return ( <>
{name}
{items.map(a => type === 'song' ? ( ) : ( ), )} {items.length === 5 && (