11import * as c from '@frogpond/colors'
22import { LoadingView , NoticeView } from '@frogpond/notice'
3+ import { SearchButton } from '@frogpond/navigation-buttons'
34import { useNavigation } from '@react-navigation/native'
45import { NativeStackNavigationOptions } from '@react-navigation/native-stack'
56import { debounce , fromPairs } from 'lodash'
@@ -35,12 +36,15 @@ export const CourseSearchView = (): JSX.Element => {
3536 let [ typedQuery , setTypedQuery ] = React . useState ( '' )
3637
3738 React . useLayoutEffect ( ( ) => {
38- // TODO: refactor the SIS tabview to not be tabview in order to support search.
39- // search will not be injected properly embedded inside of a tab navigator and
40- // calling navigation.getParent() is not a solution because the parent is a tab
41- // navigator so all top-level tabs here would receive a searchbar. For now we
42- // can at least rely on the "browse all" button to let us view search.
4339 navigation . setOptions ( {
40+ headerRight : ( ) => (
41+ < SearchButton
42+ onPress = { ( ) =>
43+ navigation . navigate ( 'CourseSearchResults' , { initialQuery : '' } )
44+ }
45+ title = "Browse"
46+ />
47+ ) ,
4448 headerSearchBarOptions : {
4549 barTintColor : c . quaternarySystemFill ,
4650 onChangeText : ( event : ChangeTextEvent ) => {
@@ -63,10 +67,6 @@ export const CourseSearchView = (): JSX.Element => {
6367 } )
6468 } , [ showSearchResult , typedQuery ] )
6569
66- let browseAll = ( ) => {
67- navigation . navigate ( 'CourseSearchResults' , { initialQuery : '' } )
68- }
69-
7070 let onRecentFilterPress = React . useCallback (
7171 ( text : string ) => {
7272 let selectedFilterCombo = recentFilters . find (
@@ -120,11 +120,9 @@ export const CourseSearchView = (): JSX.Element => {
120120 title = "Recent"
121121 />
122122 < RecentItemsList
123- actionLabel = "Browse All"
124123 emptyHeader = "No recent filter combinations"
125124 emptyText = "Your recent filter combinations will appear here."
126125 items = { recentFilterDescriptions }
127- onAction = { browseAll }
128126 onItemPress = { onRecentFilterPress }
129127 title = "Browse"
130128 />
0 commit comments