added search results "more" screen

This commit is contained in:
austinried
2021-08-19 09:20:40 +09:00
parent ba2aea0fbe
commit 25b95a4b65
4 changed files with 187 additions and 59 deletions

View File

@@ -13,12 +13,14 @@ import { RouteProp, StackActions } from '@react-navigation/native'
import React, { useEffect } from 'react'
import { StyleSheet } from 'react-native'
import { createNativeStackNavigator, NativeStackNavigationProp } from 'react-native-screens/native-stack'
import SearchResultsView from '@app/screens/SearchResultsView'
type TabStackParamList = {
main: undefined
album: { id: string; title: string }
artist: { id: string; title: string }
playlist: { id: string; title: string }
results: { query: string; type: 'album' | 'song' | 'artist' }
}
type AlbumScreenNavigationProp = NativeStackNavigationProp<TabStackParamList, 'album'>
@@ -54,6 +56,17 @@ const PlaylistScreen: React.FC<PlaylistScreenProps> = ({ route }) => (
<SongListView id={route.params.id} title={route.params.title} type="playlist" />
)
type ResultsScreenNavigationProp = NativeStackNavigationProp<TabStackParamList, 'results'>
type ResultsScreenRouteProp = RouteProp<TabStackParamList, 'results'>
type ResultsScreenProps = {
route: ResultsScreenRouteProp
navigation: ResultsScreenNavigationProp
}
const ResultsScreen: React.FC<ResultsScreenProps> = ({ route }) => (
<SearchResultsView query={route.params.query} type={route.params.type} />
)
const styles = StyleSheet.create({
stackheaderStyle: {
backgroundColor: colors.gradient.high,
@@ -92,6 +105,7 @@ function createTabStackNavigator(Component: React.ComponentType<any>) {
<Stack.Screen name="album" component={AlbumScreen} options={itemScreenOptions} />
<Stack.Screen name="artist" component={ArtistScreen} options={{ headerShown: false }} />
<Stack.Screen name="playlist" component={PlaylistScreen} options={itemScreenOptions} />
<Stack.Screen name="results" component={ResultsScreen} options={itemScreenOptions} />
</Stack.Navigator>
)
}